-
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
1 parent
89a9788
commit 7d6e724
Showing
1 changed file
with
24 additions
and
4 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 |
---|---|---|
@@ -1,5 +1,25 @@ | ||
from playwright.sync_api import Page, expect | ||
import asyncio | ||
from playwright.async_api import async_playwright | ||
|
||
def test_has_title(page: Page): | ||
page.goto("https://joshuamae.com") | ||
expect(page).to_have_title("Joshua Mae") | ||
async def test_title(url, expected_title): | ||
async with async_playwright() as p: | ||
browsers = [ | ||
("Chromium", p.chromium), | ||
("Firefox", p.firefox), | ||
("WebKit", p.webkit) | ||
] | ||
for browser_name, browser_type in browsers: | ||
browser = await browser_type.launch() | ||
page = await browser.new_page() | ||
await page.goto(url) | ||
title = await page.title() | ||
|
||
assert title == expected_title, f"{browser_name} - Title does not match. Expected: {expected_title}, but got: {title}" | ||
|
||
await browser.close() | ||
print(f"{browser_name} - Test passed") | ||
|
||
if __name__ == "__main__": | ||
url = "https://joshuamae.com.com" | ||
expected_title = "Joshua Mae" | ||
asyncio.run(test_title(url, expected_title)) |