Repository navigation
test: fix flaky test malicious-signatures inline alert click during smooth scroll - #47724
Conversation
…mooth scroll Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
✨ Files requiring CODEOWNER review ✨🧪 @MetaMask/qa (1 files, +1 -0)
|
Builds ready [5d0a6fa] [reused from 22d3d74]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 2 warn · 🔴 3 fail)
Bundle Size Diffs
|
Builds ready [153aeea] [reused from 58e30f8]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 3 warn · 🔴 3 fail)
Bundle Size Diffs
|
Description
Flake type: Race Conditions with React Re-renders
Root cause:
Request fromrow shows an inline warning button ([data-testid="inline-alert"]).clickScrollToBottomButton()), which starts a smooth scroll down the confirmation page.clickInlineAlert()) while the page is still scrolling down.Request fromrow upward and out of view, the click misses the warning button.acknowledgeAlert()) times out waiting for the modal checkbox.Solution:
[data-testid="inline-alert"]) to stop moving insideConfirmation.clickInlineAlert()before clicking it - so smooth scrolling or layout shifts cannot cause the click to miss.confirmation.clickScrollToBottomButton()call beforeconfirmation.clickInlineAlert()in the bad-domain signature test - so the page stays at the top when clicking the top inline warning, whilescrollAndConfirmAndAssertConfirm(driver)still scrolls to the bottom before clicking Confirm.Slack: https://consensys.slack.com/archives/CTQAGKY5V/p1794215081050339?thread_ts=1794212189.357149&cid=CTQAGKY5V
Changelog
CHANGELOG entry: null
Manual testing steps
yarn start:test(oryarn build:test).Malicious Confirmation Signature - Bad Domainpass.Screenshots/Recordings
Before
CI failure screenshot (
test-failure-screenshot-4.png, MetaMask Dialog confirmation popup inMalicious Confirmation Signature - Bad Domain displays alert for domain binding and confirms): The SIWE Bad Domain confirmation popup is scrolled partway down to theMessagecard becauseclickScrollToBottomButton()triggered a smooth scroll immediately beforeclickInlineAlert(). The topRequest fromrow containing the inline alert button ([data-testid="inline-alert"]) scrolled above the viewport while WebDriver tried to click it, so the alert modal ([data-testid="alert-modal-acknowledge-checkbox"]) never opened and the footer button is still showingReview alert.After
No product UI change. The test clicks the top inline alert while it is stationary at the top of the confirmation popup (with
Confirmation.clickInlineAlert()waiting for the button to stop moving before clicking), acknowledges the alert modal, and then scrolls to the bottom to confirm the signature.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Test-only changes; no production UI or application logic.
Overview
Fixes a flaky malicious SIWE bad-domain E2E test where the inline warning at the top of the confirmation dialog was clicked while the page was still smoothly scrolling, so the click missed and the alert modal never opened.
Confirmation.clickInlineAlert()now waits for[data-testid="inline-alert"]to stop moving (same pattern as other confirmation page objects) before clicking.In
malicious-signatures.spec.ts, the test no longer callsclickScrollToBottomButton()beforeclickInlineAlert(); it acknowledges the top inline alert first, then uses the existingscrollAndConfirmAndAssertConfirmflow to scroll and confirm.Reviewed by Cursor Bugbot for commit 153aeea. Bugbot is set up for automated code reviews on this repo. Configure here.