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(navigation): fix flaky networkidle tests #1058

Merged
merged 2 commits into from
Feb 19, 2020

Conversation

JoelEinbinder
Copy link
Contributor

The network idle tests were waiting for requests to appear on the server, but not for playwright to be notified of the request via protocol. They also assumed performance.now would match up with setTimeout times.

frame._page.waitForRequest(server.PREFIX + suffix),
])
}
frame.setContent
Copy link
Contributor

Choose a reason for hiding this comment

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

stray change

const waitForRequest = suffix => {
return Promise.all([
server.waitForRequest(suffix),
frame._page.waitForRequest(server.PREFIX + suffix),
Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious why do we need to waitForRequest for the test to pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't remember, but it is definitely required. I'll look at it again tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The protocol events for firefox come in a strange order if we dont await the request events on the frontend:

  1. requestWIllBeSent A
  2. responseRecieved A
  3. requestWillBeSent B
  4. requestWillBeSent C

Because A appears to be resolved before B and C are sent, networkidle2 is never trigged, and the timer resolves 500ms after the initial index.html request, not the responseRecieved A as was intended.

@JoelEinbinder JoelEinbinder merged commit 568c6cb into microsoft:master Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants