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: remove unnecessary delays and wait for condition with waitForUrlContaning #30265

Merged
merged 8 commits into from
Feb 12, 2025

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Feb 12, 2025

Description

Just a small enhancement to remove some unnecessary delays in bridge specs.
This PR adds a new function in the driver waitForUrlContaning, which just checks for a substring, instead of the exact match with the waitForUrl. We can now use this and remove the hardcoded delays

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Check ci

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@seaona seaona requested a review from a team as a code owner February 12, 2025 14:05
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-qa QA team label Feb 12, 2025
@seaona seaona changed the title test: remove unnecessary delays with waitforurlcontaning test: remove unnecessary delays with waitForUrlContaning Feb 12, 2025
@seaona seaona self-assigned this Feb 12, 2025
@seaona seaona added flaky tests area-qa Relating to QA work (Quality Assurance) labels Feb 12, 2025
@seaona seaona changed the title test: remove unnecessary delays with waitForUrlContaning test: remove unnecessary delays and wait for condition instead with waitForUrlContaning Feb 12, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [08a9ed8]
Page Load Metrics (1750 ± 92 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32221351683364175
domContentLoaded14942068171617584
load15032152175019192
domInteractive27121482813
backgroundConnect10137343014
firstReactRender1677332110
getState45720199
initialActions01000
loadScripts10591528125514369
setupStore76217178
uiStartup168928432036261125
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

assert.ok((await this.driver.getCurrentUrl()).includes('asset'));
await this.driver.waitForUrlContaining({
url: 'asset',
timeout: this.driver.timeout,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this.driver.timeout the same as the default timeout? if so, should we just remove timeout: this.driver.timeout, from these calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is the same, indeed, but lint is failing if I don't add it explicitly :/

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, you need to define the type as optional in the JSDoc for the function . See the "Optional parameter" section at https://jsdoc.app/tags-type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aww got it 😍 thank you so much, learning a lot from your reviews 🙏

: expectedHandleCount + 1,
);
assert.match(await this.driver.getCurrentUrl(), /.+cross-chain\/swaps/u);
await this.driver.waitUntilXWindowHandles(expectedHandleCount);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why this is needed. seems like waitForUrlContaining should just wait.

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 agree, this is not needed. I left the validation because this was explicitly validated in the original spec, but happy to remove it! We can completely remove the expectedHandleCount in the func singature too then 🙏

test/e2e/webdriver/driver.js Outdated Show resolved Hide resolved
test/e2e/webdriver/driver.js Outdated Show resolved Hide resolved
@seaona seaona requested a review from a team as a code owner February 12, 2025 16:41
@@ -147,7 +146,6 @@ workflows:
- prep-build-test
- get-changed-files-with-git-diff
- test-e2e-firefox:
<<: *main_master_rc_only
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just for testing ci, will be removed once finished

Copy link
Contributor Author

Choose a reason for hiding this comment

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

danjm
danjm previously approved these changes Feb 12, 2025
@seaona seaona changed the title test: remove unnecessary delays and wait for condition instead with waitForUrlContaning test: remove unnecessary delays and wait for condition with waitForUrlContaning Feb 12, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [b02539b]
Page Load Metrics (1764 ± 74 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint27321531695358172
domContentLoaded15132100173414067
load15212187176415474
domInteractive267843178
backgroundConnect877302311
firstReactRender1697312411
getState483262512
initialActions00000
loadScripts11061550127311957
setupStore865242211
uiStartup173925762050217104
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@seaona seaona added this pull request to the merge queue Feb 12, 2025
Merged via the queue into main with commit 297e327 Feb 12, 2025
76 checks passed
@seaona seaona deleted the e2e-wait-url-containing branch February 12, 2025 18:52
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2025
@metamaskbot metamaskbot added the release-12.13.0 Issue or pull request that will be included in release 12.13.0 label Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-qa Relating to QA work (Quality Assurance) flaky tests release-12.13.0 Issue or pull request that will be included in release 12.13.0 team-qa QA team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants