-
Notifications
You must be signed in to change notification settings - Fork 2
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
4 changed files
with
65 additions
and
25 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
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,9 @@ | ||
from playwright.async_api import Page | ||
import pytest | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_page_async(page_async: Page): | ||
print(f'\n{page_async = }') | ||
await page_async.goto('https://playwright.dev/') | ||
assert 'Playwright' in await page_async.title() |
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,28 @@ | ||
""" | ||
https://playwright.dev/python/docs/writing-tests#first-test | ||
""" | ||
|
||
import re | ||
|
||
from playwright.async_api import Page | ||
from playwright.async_api import expect | ||
import pytest | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_has_title(page_async: Page): | ||
await page_async.goto('https://playwright.dev/') | ||
|
||
# Expect a title "to contain" a substring. | ||
await expect(page_async).to_have_title(re.compile('Playwright')) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_started_link(page_async: Page): | ||
await page_async.goto('https://playwright.dev/') | ||
|
||
# Click the get started link. | ||
await page_async.get_by_role('link', name='Get started').click() | ||
|
||
# Expects page to have a heading with the name of Installation. | ||
await expect(page_async.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