Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-mae committed May 30, 2024
1 parent 89a9788 commit 7d6e724
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions playwright-tests/test_firstload.py
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))

0 comments on commit 7d6e724

Please sign in to comment.