Skip to content

Commit

Permalink
test: unflake test_page_route_should_work_with_redirects_for_subresou…
Browse files Browse the repository at this point in the history
…rces
  • Loading branch information
mxschmitt committed Oct 12, 2023
1 parent 2886f00 commit eab76fd
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/async/test_interception.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,12 @@ async def test_page_route_should_not_work_with_redirects(page, server):

async def test_page_route_should_work_with_redirects_for_subresources(page, server):
intercepted = []
await page.route(
"**/*",
lambda route: (
asyncio.create_task(route.continue_()),
intercepted.append(route.request),
),
)

async def handle_route(route) -> None:
await route.continue_()
intercepted.append(route.request)

await page.route("**/*", handle_route)

server.set_redirect("/one-style.css", "/two-style.css")
server.set_redirect("/two-style.css", "/three-style.css")
Expand All @@ -348,8 +347,7 @@ async def test_page_route_should_work_with_redirects_for_subresources(page, serv
assert response.status == 200
assert "one-style.html" in response.url

# TODO: https://github.com/microsoft/playwright/issues/12789
assert len(intercepted) >= 2
assert len(intercepted) == 2
assert intercepted[0].resource_type == "document"
assert "one-style.html" in intercepted[0].url

Expand Down

0 comments on commit eab76fd

Please sign in to comment.