-
Notifications
You must be signed in to change notification settings - Fork 203
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 e2e #2158
test: fix flaky e2e #2158
Changes from 7 commits
e38abfd
f52ae6b
c5972d1
bfb1b93
8017f89
7929fdc
32efe7f
af65c68
b03cf03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ describe('Approve token for deposit', () => { | |
timeout: 50000, | ||
interval: 500 | ||
}) | ||
cy.findMoveFundsButton().click() | ||
cy.startTransfer({ shouldConfirmInMetamask: false }) | ||
cy.findByText(/pay a one-time approval fee/).click() | ||
cy.findByRole('button', { | ||
name: /Pay approval fee of/ | ||
|
@@ -50,7 +50,7 @@ describe('Approve token for deposit', () => { | |
* If confirm spending fails, test is still considered to be passing by Cypress | ||
* We add another check to make sure the test fails if needed | ||
*/ | ||
cy.wait(10_000) | ||
cy.wait(25_000) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Orbit chains may take longer, sometimes the tests fail because they don't have enough time to run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we only make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's good to have it for both, I'm only guessing it's for Orbit only as I've observed in the videos. But to be sure I'd leave it for both. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway, 15 extra seconds doesn't matter because we always wait for withdrawal e2e to finish at the end, they take a bit longer |
||
cy.rejectMetamaskTransaction() | ||
}) | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,11 +141,7 @@ describe('Batch Deposit', () => { | |
context('deposit should complete successfully', () => { | ||
cy.selectTransactionsPanelTab('settled') | ||
|
||
cy.waitUntil(() => cy.findTransactionInTransactionHistory(txData), { | ||
errorMsg: 'Could not find settled ERC20 Batch Deposit transaction', | ||
timeout: 60_000, | ||
interval: 500 | ||
}) | ||
cy.findTransactionInTransactionHistory(txData) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
cy.findTransactionInTransactionHistory({ | ||
duration: 'a few seconds ago', | ||
|
@@ -156,23 +152,29 @@ describe('Batch Deposit', () => { | |
|
||
context('funds should reach destination account successfully', () => { | ||
// should have more funds on destination chain | ||
cy.findByLabelText(`${ERC20TokenSymbol} balance amount on childChain`) | ||
.invoke('text') | ||
.then(parseFloat) | ||
.should('be.gt', Number(parentErc20Balance)) | ||
cy.findByLabelText(`${nativeTokenSymbol} balance amount on childChain`) | ||
.invoke('text') | ||
.then(parseFloat) | ||
.should( | ||
'be.gt', | ||
cy.findByLabelText( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can also add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a default timeout of 20_000 for all commands now. Currently we used synpress's default timeout of 4_000 for all commands. This is not enough and caused some flakiness. With 20_000 we don't really make the tests longer, they will only fail longer if they do. |
||
`${ERC20TokenSymbol} balance amount on childChain` | ||
).should($el => { | ||
const currentBalance = parseFloat($el.text()) | ||
expect(currentBalance).to.be.gt(Number(parentErc20Balance)) | ||
}) | ||
|
||
cy.findByLabelText( | ||
`${nativeTokenSymbol} balance amount on childChain` | ||
).should($el => { | ||
const currentBalance = parseFloat($el.text()) | ||
expect(currentBalance).to.be.gt( | ||
Number(parentNativeTokenBalance) + nativeCurrencyAmountToSend | ||
) | ||
}) | ||
|
||
// the balance on the source chain should not be the same as before | ||
cy.findByLabelText(`${ERC20TokenSymbol} balance amount on parentChain`) | ||
.invoke('text') | ||
.then(parseFloat) | ||
.should('be.lt', Number(parentErc20Balance)) | ||
cy.findByLabelText( | ||
`${ERC20TokenSymbol} balance amount on parentChain` | ||
).should($el => { | ||
const currentBalance = parseFloat($el.text()) | ||
expect(currentBalance).to.be.lt(Number(parentErc20Balance)) | ||
}) | ||
}) | ||
|
||
context('transfer panel amount should be reset', () => { | ||
|
@@ -251,11 +253,7 @@ describe('Batch Deposit', () => { | |
context('deposit should complete successfully', () => { | ||
cy.selectTransactionsPanelTab('settled') | ||
|
||
cy.waitUntil(() => cy.findTransactionInTransactionHistory(txData), { | ||
errorMsg: 'Could not find settled ERC20 Batch Deposit transaction', | ||
timeout: 60_000, | ||
interval: 500 | ||
}) | ||
cy.findTransactionInTransactionHistory(txData) | ||
|
||
cy.findTransactionInTransactionHistory({ | ||
duration: 'a few seconds ago', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ describe('Withdraw ERC20 Token', () => { | |
}) | ||
|
||
context('should show clickable withdraw button', () => { | ||
cy.findMoveFundsButton().click() | ||
cy.startTransfer({ shouldConfirmInMetamask: false }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}) | ||
|
||
context('should withdraw successfully', () => { | ||
|
@@ -218,7 +218,7 @@ describe('Withdraw ERC20 Token', () => { | |
}) | ||
|
||
context('should show clickable withdraw button', () => { | ||
cy.findMoveFundsButton().click() | ||
cy.startTransfer({ shouldConfirmInMetamask: false }) | ||
}) | ||
|
||
context('should initiate withdrawal successfully', () => { | ||
|
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.
By default it's set to 4_000. It's not enough given a lot of things are awaited for (e.g. balance changes after transfer etc), so we bump it by a significant amount.
This won't make checks any longer than they are now, only if it fails it will take a bit longer to fail. But it's a good tradeoff to eliminate flakiness.