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

Fix WaitForLoadState and add tests #628

Merged
merged 5 commits into from
Nov 4, 2022
Merged

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Nov 3, 2022

This PR was opened to help in part with issue #593.

This PR's aim is to do two things:

  1. Add missing tests for WaitForLoadState when using waitUntil options.
  2. Fix an issue where WaitForLoadState needs to wait for new events from the browser.

#623 needs to be merged into main first before this PR.

The tests all follow a similar setup to what is already present in main and in #623.

The fix involved copying the waitUntil logic used in FrameManager.NavigateFrame.

@ankur22 ankur22 added the bug Something isn't working label Nov 3, 2022
@ankur22 ankur22 added this to the v0.6.0 milestone Nov 3, 2022
@ankur22 ankur22 requested a review from inancgumus November 3, 2022 14:07
@ankur22 ankur22 self-assigned this Nov 3, 2022
Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

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

Thank you 🙇‍♂️ I see no issues. Commits are clearly organized 👍

@ankur22 ankur22 force-pushed the refactor/593-waitforloadstate branch from 2651bbf to cfc2d95 Compare November 3, 2022 14:13
@ankur22 ankur22 force-pushed the bug/622-waituntil-reload branch from aa4e84c to e05b8d6 Compare November 4, 2022 14:48
@ankur22 ankur22 force-pushed the refactor/593-waitforloadstate branch from cfc2d95 to e8c762a Compare November 4, 2022 14:53
Base automatically changed from bug/622-waituntil-reload to main November 4, 2022 15:26
This test will ensure that when WaitForLoadState with waitUntil load is
called, that it doesn't block on waiting for the lifecycle event if it
has already fired, and so it uses the saved state of the frame to work
out if the load lifecycle event has fired.
This test will ensure that when WaitForLoadState with waitUntil
domcontentloaded is called, that it doesn't block for the lifecycle
event if that event has already fired, and so using the frame's
internal state to unblock quickly.
This test will ensure that when WaitForLoadState with waituntil
networkidle is called, that it doesn't block for the lifecycle event
if that event has already fired, and so uses the frame's internal
state to unblock quickly.
This fixes an issue when we actually have to wait for a lifecycle
event to be received from the browser since we've not received one
yet and so we can't rely on the frame's state.

The logic to wait for the lifecycle event has been copied from
FrameManager.NavigateFrame.
This function is no longer being used.
Also removing a todo comment which no longer is needed since these
tests have been implemented in this PR.
@ankur22 ankur22 force-pushed the refactor/593-waitforloadstate branch from e8c762a to 8573887 Compare November 4, 2022 15:27
@ankur22 ankur22 merged commit bf9d7ff into main Nov 4, 2022
@ankur22 ankur22 deleted the refactor/593-waitforloadstate branch November 4, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants