-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Ensure browsers are installed | ||
run: python -m playwright install --with-deps | ||
- name: Run your tests | ||
run: pytest --tracing=retain-on-failure | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-traces | ||
path: test-results/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.37 MB
test-results/test-example0-py-test-get-started-link-chromium/trace.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
import re | ||
from playwright.sync_api import Page, expect | ||
|
||
@pytest.fixture(scope="function", autouse=True) | ||
def before_each_after_each(page: Page): | ||
# Chromium, Firefox, or WebKit | ||
# chromium.launch(headless=False, slow_mo=100) | ||
|
||
print("before the test runs") | ||
|
||
# Go to the starting url before each test. | ||
page.goto("https://playwright.dev/") | ||
yield | ||
|
||
print("after the test runs") | ||
|
||
def test_has_title(page: Page): | ||
|
||
# Expect a title "to contain" a substring. | ||
expect(page).to_have_title(re.compile("Playwright")) | ||
|
||
def test_get_started_link(page: Page): | ||
# page.wait_for_timeout(6000); | ||
# Click the get started link. | ||
page.get_by_role("link", name="Get started").click() | ||
|
||
# Expects page to have a heading with the name of Installation. | ||
expect(page.get_by_role("heading", name="Installation")).to_be_visible() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import re | ||
from playwright.sync_api import Page, expect | ||
|
||
|
||
def test_example(page: Page) -> None: | ||
page.goto("https://demo.playwright.dev/todomvc/#/") | ||
page.get_by_placeholder("What needs to be done?").click() | ||
page.get_by_placeholder("What needs to be done?").fill("Search for Googl") | ||
page.get_by_placeholder("What needs to be done?").press("Enter") | ||
page.get_by_label("Toggle Todo").check() | ||
page.get_by_placeholder("What needs to be done?").click() | ||
page.get_by_placeholder("What needs to be done?").fill("Learn python") | ||
page.get_by_placeholder("What needs to be done?").press("Enter") | ||
page.locator("li").filter(has_text="Learn python").get_by_label("Toggle Todo").check() | ||
page.get_by_role("link", name="Active").click() | ||
page.get_by_role("link", name="Completed").click() | ||
page.get_by_role("button", name="Clear completed").click() | ||
page.get_by_placeholder("What needs to be done?").click(button="right") | ||
expect(page.get_by_placeholder("What needs to be done?")).to_be_visible() | ||
expect(page.get_by_placeholder("What needs to be done?")).to_be_empty(); | ||
|