Skip to content

test: unflake test_assertions_page_to_have_{title,url} #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/async/test_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ async def test_assertions_page_to_have_title(page: Page, server: Server) -> None
await expect(page).to_have_title("new title")
await expect(page).to_have_title(re.compile("new title"))
with pytest.raises(AssertionError):
await expect(page).to_have_title("not the current title", timeout=100)
await expect(page).to_have_title("not the current title", timeout=750)
with pytest.raises(AssertionError):
await expect(page).to_have_title(
re.compile("not the current title"), timeout=100
re.compile("not the current title"), timeout=750
)
with pytest.raises(AssertionError):
await expect(page).not_to_have_title(re.compile("new title"), timeout=100)
await expect(page).not_to_have_title(re.compile("new title"), timeout=750)
with pytest.raises(AssertionError):
await expect(page).not_to_have_title("new title", timeout=100)
await expect(page).not_to_have_title("great title", timeout=100)
await expect(page).not_to_have_title("new title", timeout=750)
await expect(page).not_to_have_title("great title", timeout=750)
await page.evaluate(
"""
setTimeout(() => {
Expand All @@ -53,9 +53,9 @@ async def test_assertions_page_to_have_url(page: Page, server: Server) -> None:
await expect(page).to_have_url(server.EMPTY_PAGE)
await expect(page).to_have_url(re.compile(r".*/empty\.html"))
with pytest.raises(AssertionError):
await expect(page).to_have_url("nooooo", timeout=100)
await expect(page).to_have_url("nooooo", timeout=750)
with pytest.raises(AssertionError):
await expect(page).to_have_url(re.compile("not-the-url"), timeout=100)
await expect(page).to_have_url(re.compile("not-the-url"), timeout=750)
await page.evaluate(
"""
setTimeout(() => {
Expand All @@ -64,13 +64,13 @@ async def test_assertions_page_to_have_url(page: Page, server: Server) -> None:
"""
)
await expect(page).to_have_url(server.PREFIX + "/grid.html")
await expect(page).not_to_have_url(server.EMPTY_PAGE, timeout=100)
await expect(page).not_to_have_url(server.EMPTY_PAGE, timeout=750)
with pytest.raises(AssertionError):
await expect(page).not_to_have_url(re.compile(r".*/grid\.html"), timeout=100)
await expect(page).not_to_have_url(re.compile(r".*/grid\.html"), timeout=750)
with pytest.raises(AssertionError):
await expect(page).not_to_have_url(server.PREFIX + "/grid.html", timeout=100)
await expect(page).not_to_have_url(server.PREFIX + "/grid.html", timeout=750)
await expect(page).to_have_url(re.compile(r".*/grid\.html"))
await expect(page).not_to_have_url("**/empty.html", timeout=100)
await expect(page).not_to_have_url("**/empty.html", timeout=750)


async def test_assertions_page_to_have_url_with_base_url(
Expand Down
22 changes: 11 additions & 11 deletions tests/sync/test_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def test_assertions_page_to_have_title(page: Page, server: Server) -> None:
expect(page).to_have_title("new title")
expect(page).to_have_title(re.compile("new title"))
with pytest.raises(AssertionError):
expect(page).to_have_title("not the current title", timeout=100)
expect(page).to_have_title("not the current title", timeout=750)
with pytest.raises(AssertionError):
expect(page).to_have_title(re.compile("not the current title"), timeout=100)
expect(page).to_have_title(re.compile("not the current title"), timeout=750)
with pytest.raises(AssertionError):
expect(page).not_to_have_title(re.compile("new title"), timeout=100)
expect(page).not_to_have_title(re.compile("new title"), timeout=750)
with pytest.raises(AssertionError):
expect(page).not_to_have_title("new title", timeout=100)
expect(page).not_to_have_title("great title", timeout=100)
expect(page).not_to_have_title("new title", timeout=750)
expect(page).not_to_have_title("great title", timeout=750)
page.evaluate(
"""
setTimeout(() => {
Expand All @@ -51,9 +51,9 @@ def test_assertions_page_to_have_url(page: Page, server: Server) -> None:
expect(page).to_have_url(server.EMPTY_PAGE)
expect(page).to_have_url(re.compile(r".*/empty\.html"))
with pytest.raises(AssertionError):
expect(page).to_have_url("nooooo", timeout=100)
expect(page).to_have_url("nooooo", timeout=750)
with pytest.raises(AssertionError):
expect(page).to_have_url(re.compile("not-the-url"), timeout=100)
expect(page).to_have_url(re.compile("not-the-url"), timeout=750)
page.evaluate(
"""
setTimeout(() => {
Expand All @@ -62,13 +62,13 @@ def test_assertions_page_to_have_url(page: Page, server: Server) -> None:
"""
)
expect(page).to_have_url(server.PREFIX + "/grid.html")
expect(page).not_to_have_url(server.EMPTY_PAGE, timeout=100)
expect(page).not_to_have_url(server.EMPTY_PAGE, timeout=750)
with pytest.raises(AssertionError):
expect(page).not_to_have_url(re.compile(r".*/grid\.html"), timeout=100)
expect(page).not_to_have_url(re.compile(r".*/grid\.html"), timeout=750)
with pytest.raises(AssertionError):
expect(page).not_to_have_url(server.PREFIX + "/grid.html", timeout=100)
expect(page).not_to_have_url(server.PREFIX + "/grid.html", timeout=750)
expect(page).to_have_url(re.compile(r".*/grid\.html"))
expect(page).not_to_have_url("**/empty.html", timeout=100)
expect(page).not_to_have_url("**/empty.html", timeout=750)


def test_assertions_page_to_have_url_with_base_url(
Expand Down