-
Notifications
You must be signed in to change notification settings - Fork 5k
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 25912 #25913
fix: flaky test 25912 #25913
Conversation
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. |
@@ -102,7 +102,16 @@ async function createSwap(driver: Driver) { | |||
swapFrom: 'TESTETH', | |||
swapTo: 'USDC', | |||
}); | |||
|
|||
await driver.waitForSelector({ text: 'Swap', tag: 'button' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this won''t have any effect as the clickElement
function already waits for the element to be visible and clickable
{ | ||
text: 'View in activity', | ||
tag: 'button', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that this is still no enough. From the flow we can know that:
- the
View in activity
remains present until the tx is confirmed - once the tx is confirmed, the
View in activity
disappears and theClose
button appears
In the failed tests screenshots we can see how we are still in the View activity phase, meaning that the transaction is not yet confirmed. I think we could investigate why the transaction takes so much to be confirmed. Maybe some mock is missing? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree @seaona. Test has failed 4 times in this PR and as you suggested I will investigate why the transaction is taking longer than expected from the mocks perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can revert this change, as now we've seen that the root cause was that a mock was missing, causing a non-deterministic delay in the API response for the trades
@@ -429,6 +429,291 @@ const TRADES_API_MOCK_RESULT = [ | |||
}, | |||
]; | |||
|
|||
const SWAP_TRANSACTION_TRADES_QUOTE_MOCK = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be good if we add a more explicit name, so it can be re-used in another test if needed. Something like:
const SWAP_TRANSACTION_TRADES_QUOTE_MOCK = [ | |
const SWAP_ETH_USDC_TRADES_MOCK = [ |
Co-authored-by: seaona <[email protected]>
Co-authored-by: seaona <[email protected]>
…xtension into fix-flaky-test-25912
… fix-flaky-test-25912
… fix-flaky-test-25912
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request addresses the flaky test issue in the 'User Operations from swap' test case by introducing additional wait times and implementing checks to ensure the 'View in activity' button is absent.
- test/data/mock-data.js: Added
SWAP_TEST_ETH_USDC_TRADES_MOCK
to support various swap scenarios. - test/e2e/flask/user-operations.spec.ts: Introduced mock data and server utility, added a function to mock swap transaction quotes, and updated test setup to use this mock function for consistent test conditions.
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice work @hjetpoluru 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Thanks for the fix !
… fix-flaky-test-25912
Thanks @seaona for helping me in analyzing and guiding the process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
This PR addresses the flaky test issue in the 'User Operations from swap' test case by introducing additional wait times and implementing checks to ensure the 'View in activity' button is absent.
- test/e2e/flask/user-operations.spec.ts: Introduced mock data and server utility, added a function to mock swap transaction quotes, and updated test setup to use this mock function for consistent test conditions.
- app/scripts/controllers/user-storage/user-storage-controller.ts: Updated
isProfileSyncingEnabled
property to allow anull
value, requiring careful testing to ensure all code paths handlenull
correctly. - app/scripts/migrations/120.1.ts: Added migration to set
isProfileSyncingEnabled
tonull
inUserStorageController
state, ensuring consistency in user data. - app/scripts/migrations/122.ts: Added migration to set
redesignedConfirmationsEnabled
totrue
inPreferencesController
, enabling redesigned confirmations by default. - test/e2e/helpers.js: Introduced
tempToggleSettingRedesignedConfirmations
function to ensure redesigned confirmation settings are applied during tests.
47 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
This PR addresses the flaky test issue in the 'User Operations from swap' test case by introducing mocks and additional wait times to stabilize the test.
- .circleci/config.yml: Removed
test-e2e-swap-playwright
job to streamline CI pipeline. - app/scripts/background.js: Introduced mock implementations for Trezor and Ledger bridges in test environments.
- app/scripts/lib/hardware-keyring-builder-factory.ts: Added
FakeKeyringBridge
type for improved testing. - test/e2e/api-specs/ConfirmationRejectionRule.ts: Simplified logic to always click 'Cancel' instead of 'Reject'.
- test/stub/keyring-bridge.js: Added mock implementations for keyring bridges to improve test reliability.
8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #25913 +/- ##
========================================
Coverage 69.68% 69.68%
========================================
Files 1405 1405
Lines 49701 49701
Branches 13738 13738
========================================
Hits 34630 34630
Misses 15071 15071 ☔ View full report in Codecov by Sentry. |
Builds ready [afefcf2]
Page Load Metrics (189 ± 192 ms)
Bundle size diffs
|
Description
This PR is to fix the flaky test associated with the 'User Operations from swap' test case. While I couldn't replicate the issue locally, the screenshots suggest a delay in transitioning from the swap action to clicking the close button.
Upon further investigation with @seaona, we determined that processing the swap transaction was taking time, as shown in the screenshot below. Consequently, a mock for the swap has been introduced.
Related issues
Fixes: #25912
Manual testing steps
Run the test locally or in codespaces using below commands:
yarn
yarn build:test:flask
yarn test:e2e:single test/e2e/flask/user-operations.spec.ts --browser=chrome
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist