Skip to content
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

test: unflake test_page_route_should_work_with_redirects_for_subresources #2110

Closed
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
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_()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Node.js we don't await I think, not sure how it helps with flakiness.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, not landing for now.

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
Loading