-
Notifications
You must be signed in to change notification settings - Fork 42
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
Refactor options to const #1044
base: main
Are you sure you want to change the base?
Commits on Sep 21, 2023
-
Add a WaitForEventOptions type
This is where the options or predicate function will be parsed. This aligns with how we're parsing options in other APIs.
Configuration menu - View commit details
-
Copy full SHA for f62d724 - Browse repository at this point
Copy the full SHA f62d724View commit details -
Add the implementation to parse the options
This copies the parsing logic from the existing browserContext.waitFor Event() into the new WaitForEventOptions type's parse method. It also modifies it so that the data that is parsed is updated in the type and during parsing it will return an error instead of panicking.
Configuration menu - View commit details
-
Copy full SHA for 7221b56 - Browse repository at this point
Copy the full SHA 7221b56View commit details -
Refactor WaitForEvent to work with its parser
This commit refactors the code so that it works with the new WaitForEventOptions type.
Configuration menu - View commit details
-
Copy full SHA for 29aa69e - Browse repository at this point
Copy the full SHA 29aa69eView commit details -
Fix browserContext.waitForEvent's timeout
This now defaults to the browserContext's default timeout. This should fix the confusion of mixing seconds and milliseconds when working with the timeouts in this API. NOTE though that there is a default timeout of 30 seconds now, whereas in PW there is no timeout unless one is set explicitly in browserContext using SetDefaultTimeout.
Configuration menu - View commit details
-
Copy full SHA for 8c734f4 - Browse repository at this point
Copy the full SHA 8c734f4View commit details -
Update waitForEvent to clarify page support
At the moment we only support working with the new page creation event (i.e. "page" event) when waitForEvent is used. This commit helps clarify this to users.
Configuration menu - View commit details
-
Copy full SHA for 1314be4 - Browse repository at this point
Copy the full SHA 1314be4View commit details -
Update messaging around the other cases
When working with waitForEvent we now notify the user if the timeout was reached, or whether the context is closed (i.e. the test iteration has ended).
Configuration menu - View commit details
-
Copy full SHA for ff2b281 - Browse repository at this point
Copy the full SHA ff2b281View commit details -
Refactor waitForEvent to work with errors
Instead of panicking when an error occurs, this commit refactors waitForEvent to return an error back to the mapping layer where it can do what it needs with the error.
Configuration menu - View commit details
-
Copy full SHA for 1020eef - Browse repository at this point
Copy the full SHA 1020eefView commit details -
Fix parsing of waitForEvent options
This new way of working allows us to test the code with integration tests, and it still works as expected when we run the API through a test script. Before it seemed overly complex to try to create a goja object that required reflection.
Configuration menu - View commit details
-
Copy full SHA for fb354e4 - Browse repository at this point
Copy the full SHA fb354e4View commit details -
Update to allow nil predicate function
It's valid for a user not to pass anything but the event. A change needed to be made to allow for a nil predicate to allow for this.
Configuration menu - View commit details
-
Copy full SHA for e8fec53 - Browse repository at this point
Copy the full SHA e8fec53View commit details -
Refactor duplicate code into defer
When a return occurs from runWaitForEventHandler it needs to perform the same steps for all returns out of the method. This refactors those duplicate steps into a defer function.
Configuration menu - View commit details
-
Copy full SHA for 3c37f9f - Browse repository at this point
Copy the full SHA 3c37f9fView commit details -
Update mapping to promisify waitForEvent
waitForEvent is useless without it being promisified. This changes that so that waitForEvent returns a promise, allowing the user to set a waitForEvent and then call further APIs which will unblock the waitForEvent when possible (only for new page creations and if the predicate function is set and returns a truthy value).
Configuration menu - View commit details
-
Copy full SHA for 2e2e063 - Browse repository at this point
Copy the full SHA 2e2e063View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa5952b - Browse repository at this point
Copy the full SHA aa5952bView commit details -
Configuration menu - View commit details
-
Copy full SHA for c00acd5 - Browse repository at this point
Copy the full SHA c00acd5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0be19f3 - Browse repository at this point
Copy the full SHA 0be19f3View commit details -
Add a new waitForEventType type
This helps make things more maintainable and reduces the risk of typos when working with the event types for waitForEvent. Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for 4c096de - Browse repository at this point
Copy the full SHA 4c096deView commit details -
Refactor error message for incorrect event
Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for d741d45 - Browse repository at this point
Copy the full SHA d741d45View commit details -
Update log message with correct method name
Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for af81e9a - Browse repository at this point
Copy the full SHA af81e9aView commit details -
This helps tidy up the code and keeps the happy path more left aligned. Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for bbfe8df - Browse repository at this point
Copy the full SHA bbfe8dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 232422c - Browse repository at this point
Copy the full SHA 232422cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f0b44a - Browse repository at this point
Copy the full SHA 4f0b44aView commit details -
Refactor to early exit if opts doesn't exist
Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for 3d1f558 - Browse repository at this point
Copy the full SHA 3d1f558View commit details -
Refactor comments to align with 80 chars line len
This just helps make the line lengths of comments consistent.
Configuration menu - View commit details
-
Copy full SHA for 855850a - Browse repository at this point
Copy the full SHA 855850aView commit details -
Refactor test names to be less verbose
This not only use a more concise naming convention it also adds '_' to the names, which makes it easier to find tests if they fail. Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
Configuration menu - View commit details
-
Copy full SHA for b2d2503 - Browse repository at this point
Copy the full SHA b2d2503View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8fd96c5 - Browse repository at this point
Copy the full SHA 8fd96c5View commit details -
Add a const for the timeout option
This will help avoid typo issues and make the code more maintainable.
Configuration menu - View commit details
-
Copy full SHA for d8c52f9 - Browse repository at this point
Copy the full SHA d8c52f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4b8d60d - Browse repository at this point
Copy the full SHA 4b8d60dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5e72dc1 - Browse repository at this point
Copy the full SHA 5e72dc1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5485c29 - Browse repository at this point
Copy the full SHA 5485c29View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7fa2466 - Browse repository at this point
Copy the full SHA 7fa2466View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c8b776 - Browse repository at this point
Copy the full SHA 6c8b776View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a46fac - Browse repository at this point
Copy the full SHA 0a46facView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d037f3 - Browse repository at this point
Copy the full SHA 9d037f3View commit details -
Configuration menu - View commit details
-
Copy full SHA for e51fbcf - Browse repository at this point
Copy the full SHA e51fbcfView commit details -
Configuration menu - View commit details
-
Copy full SHA for e597d69 - Browse repository at this point
Copy the full SHA e597d69View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7f8673e - Browse repository at this point
Copy the full SHA 7f8673eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 53d63ea - Browse repository at this point
Copy the full SHA 53d63eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 57467a7 - Browse repository at this point
Copy the full SHA 57467a7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 50791d6 - Browse repository at this point
Copy the full SHA 50791d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71178ef - Browse repository at this point
Copy the full SHA 71178efView commit details -
Configuration menu - View commit details
-
Copy full SHA for f06d53a - Browse repository at this point
Copy the full SHA f06d53aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 90b47b3 - Browse repository at this point
Copy the full SHA 90b47b3View commit details