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: flaky test Snap Account Signatures and Disconnects can connect to the Test Dapp, then #signTypedDataV3, disconnect then connect, then #signTypedDataV4 (async flow approve) #27887

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Oct 16, 2024

Description

After connecting to the test dapp we are automatically switched to Mainnet (this is a recent change, didn't happen before). Then there is a race condition where the network the dapp sees is different from the wallet one, causing a miss-match and making the signature fail never opening the dialog.

This seems an issue on the wallet side, as we should preserve the selected network after connecting, as we used to do before.

I've opened an issue for that here.

This just fixes the issue on the e2e side, but it needs to be fixed on the wallet side and remove the extra step again once the issue is fixed.

Open in GitHub Codespaces

Related issues

Fixes: #27892

Manual testing steps

  1. Check ci

Screenshots/Recordings

See how you are automatically switched to mainnet

switched-to-mainnet.mp4

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.

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.

@seaona seaona changed the title fix: flaky test snap fix: flaky test Snap Account Signatures and Disconnects can connect to the Test Dapp, then #signTypedDataV3, disconnect then connect, then #signTypedDataV4 (async flow approve) Oct 16, 2024
@seaona seaona self-assigned this Oct 16, 2024
@seaona seaona added flaky tests area-qa Relating to QA work (Quality Assurance) labels Oct 16, 2024
text: 'Edit',
tag: 'button',
});
await edit[1].click();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since there are 2 elements with the exact same test id and text, we use findClickableElements and then click. Since findClickableElements already makes sure that the element is clickable, we won't run into any race condition where we try to click an element that is not clickable

await driver.waitForSelector({
css: '[id="chainId"]',
text: '0x539',
});
Copy link
Contributor Author

@seaona seaona Oct 16, 2024

Choose a reason for hiding this comment

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

we make sure that we continue to be on localhost in the test dapp, after connecting. There's no reason to change networks.
This will make that the test fails deterministically in the future, if there's ever an unintended network switch

@metamaskbot
Copy link
Collaborator

Builds ready [80d2704]
Page Load Metrics (2148 ± 171 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint43526991938587282
domContentLoaded155326672111344165
load156327402148356171
domInteractive28111602311
backgroundConnect8158353416
firstReactRender473701247234
getState4112262713
initialActions00000
loadScripts114820071588266128
setupStore1081332412
uiStartup171735612447526253
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

sonarcloud bot commented Oct 16, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [4c888ce]
Page Load Metrics (2066 ± 139 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34729101710708340
domContentLoaded164428572016270129
load166429072066289139
domInteractive16197553919
backgroundConnect10204604120
firstReactRender472921417335
getState592333215
initialActions01000
loadScripts121124211519259124
setupStore11105413416
uiStartup186633662426374179
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@HowardBraham HowardBraham left a comment

Choose a reason for hiding this comment

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

Works when I try it, let's see if it reduces flakiness

@HowardBraham HowardBraham added this pull request to the merge queue Oct 16, 2024
Merged via the queue into develop with commit bb2e2a9 Oct 16, 2024
93 checks passed
@HowardBraham HowardBraham deleted the snap-sign-flaky branch October 16, 2024 11:30
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
@metamaskbot metamaskbot added the release-12.7.0 Issue or pull request that will be included in release 12.7.0 label Oct 16, 2024
@gauthierpetetin gauthierpetetin added release-12.6.0 Issue or pull request that will be included in release 12.6.0 and removed release-12.7.0 Issue or pull request that will be included in release 12.7.0 labels Oct 21, 2024
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.6.0 Issue or pull request that will be included in release 12.6.0 team-extension-platform
Projects
Archived in project
6 participants