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 Navigation Signature - Different signature types initiates multiple signatures and rejects all #27481

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Sep 30, 2024

Description

There is a delay for waiting the signatures to be queued, which sometimes is not enough. In this fix, we remove the delay and we add conditions to wait for (each new signature is added in the navigation), so the behaviour is deterministic.

Open in GitHub Codespaces

Related issues

Fixes: #27480

Manual testing steps

  1. Check ci
  2. Run test locally yarn test:e2e:single test/e2e/tests/confirmations/navigation.spec.ts --browser=chrome --leave-running=true

Screenshots/Recordings

See how the last signature is not properly queued, so in the last screen we don't see the navigation. We should wait on each new signature to be added in the navigation queue, before adding a new one

queued-sign-flaky.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.

@seaona seaona added team-extension-platform flaky tests area-qa Relating to QA work (Quality Assurance) labels Sep 30, 2024
@seaona seaona self-assigned this Sep 30, 2024
@seaona seaona requested a review from a team as a code owner September 30, 2024 07:34
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.

@@ -98,7 +98,6 @@ describe('Navigation Signature - Different signature types', function (this: Sui
await unlockWallet(driver);
await openDapp(driver);
await queueSignatures(driver);
await driver.delay(regularDelayMs);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this makes the test fail when the delay is not enough


await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp);
await driver.clickElement('#signTypedDataV4');
await driver.waitUntilXWindowHandles(3);
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
await driver.waitForSelector(By.xpath("//div[normalize-space(.)='1 of 3']"));
Copy link
Contributor Author

@seaona seaona Sep 30, 2024

Choose a reason for hiding this comment

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

we wait for the navigation to be loaded. Since the inner value has spaces we need to normalize it

Screenshot from 2024-09-30 09-41-44

Copy link
Contributor

Choose a reason for hiding this comment

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

@seaona, small nit could it possible to wait for any other stable element in the dialog to load?

Copy link
Contributor Author

@seaona seaona Sep 30, 2024

Choose a reason for hiding this comment

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

hi @hjetpoluru I've seen that waiting for the navigation to be loaded ensures that the signatures have been queued.
We could wait for the signature content, but that's not directly fixing the issue. What were you thinking on?

[Edit] I think with page objects, we could add a function for checking that the complete signature page is loaded if we want to, though I would leave this out of scope for this fix

Copy link
Contributor

Choose a reason for hiding this comment

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

@seaona, I was thinking about waiting for the buttons to load. But after reading your reply, it looks like we need to wait for the navigation to be loaded to ensure the signatures are queued. Maybe we could add a data-testId to the page loader? Otherwise, I will approve this PR as it looks good.

Copy link
Contributor Author

@seaona seaona Sep 30, 2024

Choose a reason for hiding this comment

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

so in this case, we need to wait for the content of the element, to ensure that it has the expected value (1 of 2 or 1 of 3 etc.), looking just for the element itself with a data test id, could cause a race condition of the element being present, but not fulfilling the condition we need (the number of signatures queued). Let me know if this makes sense 🙇‍♀️

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh perfect @seaona thanks for your patience and explaining this to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no problem! Thank you for your detailed review @hjetpoluru 🙇‍♀️

Copy link

sonarcloud bot commented Sep 30, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [9922b38]
Page Load Metrics (1777 ± 111 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint31223061605461221
domContentLoaded155223401755228109
load156123961777232111
domInteractive21131482713
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

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

LGTM !

@hjetpoluru hjetpoluru self-requested a review September 30, 2024 15:02
Copy link
Contributor

@hjetpoluru hjetpoluru left a comment

Choose a reason for hiding this comment

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

LGTM

@hjetpoluru hjetpoluru merged commit 98a9df7 into develop Sep 30, 2024
83 checks passed
@hjetpoluru hjetpoluru deleted the flaky-queue-signatures branch September 30, 2024 15:03
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 30, 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
Development

Successfully merging this pull request may close these issues.

Fix "Navigation Signature - Different signature types initiates multiple signatures and rejects all"
4 participants