Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[fix] browser only redirect during load #2462
[fix] browser only redirect during load #2462
Changes from 8 commits
f6109b4
5621908
e1f6b15
b99330a
d3eb920
fe6db2e
4df87fd
cac6cf2
d4c971d
47634cf
085967c
8c299ca
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although I don't think this NOTE makes sense and I'd probably just remove it.
goto
on the previous line waits for the pageload
event, which is the same thingwaitForNavigation
would do. So it can't be any slower. Maybe the issue is that it's already been awaited for, but then the issue is waiting twice for the same event and not that the method is too slowI think I'd just remove this line since it adds more confusion than it helps with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although now I'm confused because I don't know exactly where you were going to call
waitForNavigation
. The other option might be to move that comment to be right above the line where you might use itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But In most cases, the test failed due to the bellow error without this change.
I think this is similar to microsoft/playwright#4192.
And I can't move this waiting process to
redirect-on-load
test file.Because this error comes before called
callback
function.But I have modified the code in response to the comment below that you gave me.
Could you please check the updated code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand in the NOTE above where you were suggesting the
waitForNavigation
might be called. I think that this would be a good place to do it though as an alternative to callingsetTimeout
. I'd prefer not to callsetTimeout
if possibleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah Definitely! I should update it!
[This is just additional explanation]
If error comes during
await context.pages.js.evaluate(() => window.started);
,it means already navigation was changed.
So after call
await context.pages.js.waitForNavigation();
,await context.pages.js.evaluate(() => window.started);
should be succeed.(But run a for loop in case of multiple redirects.)