-
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
test: fix flaky test Increase Token Allowance increases token spending cap to allow other accounts to transfer tokens @no-mmi
#24734
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. |
@@ -272,10 +272,14 @@ describe('Increase Token Allowance', function () { | |||
tag: 'button', | |||
text: 'Next', | |||
}); | |||
driver.waitForSelector({ | |||
await driver.waitForSelector({ |
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 await was missing, but it's not the cause of the flakiness
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.
Nice catch.
await driver.waitForSelector({ | ||
tag: 'h6', | ||
text: '0.000062 ETH', | ||
}); |
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.
here we await for the correct gas estimate. This way we ensure that the increaseAllowance tx is successful and we can proceed with the transferFrom, from account 2
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.
(could) add explicit expected maximum timeout in seconds here
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.
thank you for the review @legobeat 🙇♀️ I think in this case is safe to rely on the default timeout, since I've observed that the gas update is really a matter of ms, so the default timeout seems more than enough.
But let me know if you think otherwise and we could add it 🙏
async waitForSelector(
rawLocator,
{ timeout = this.timeout, state = 'visible' } = {}
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.
ℹ️ after talking with Lego, we've agreed to merge this PR but we could have another task to look into explicit timeouts more generally
Builds ready [798cf22]
Page Load Metrics (904 ± 550 ms)
Bundle size diffs
|
Missing release label release-11.16.3 on PR. Adding release label release-11.16.3 on PR and removing other release labels(release-11.18.0), as PR was cherry-picked in branch 11.16.3. |
Description
This PR fixes the flaky test
Increase Token Allowance increases token spending cap to allow other accounts to transfer tokens @no-mmi).
The problem with this flaky test is that we are changing the allowance amount (from 0 to 1) and we confirm the transaction before the gas has been updated. This makes that the increase token allowance transaction fails, and the subsequent transaction with the Account 2 cannot be performed as it doesn't have the allowance for doing a transfer from action. So the dialog window cannot be found, as the popup is never triggered (see dapp error).
The fix is to simply await for the expected gas for the increaseAllowance with amount 1.
This can be clearly seen when you check the tx history from Account 1:
31000
-- correct26776
-- incorrect (this value corresponds to the increaseAllowance with amount 0)Related issues
Fixes: one of this cases, but not all of them, as the rest of testcases need to be looked separately #24603
Manual testing steps
yarn test:e2e:single test/e2e/tests/tokens/increase-token-allowance.spec.js --browser=firefox --leave-running --retryUntilFailure --retries=10
Screenshots/Recordings
increase-token-allowance-flaky.mp4
Pre-merge author checklist
Pre-merge reviewer checklist