From 0d227578adb4c1d82ae5e9bd83a5d22f4f2d56fd Mon Sep 17 00:00:00 2001 From: Christophe Deveaux Date: Fri, 13 Sep 2024 18:18:16 +0200 Subject: [PATCH] test: update CCTP withdrawal test (#1894) --- .../arb-token-bridge-ui/synpress.cctp.config.ts | 4 ++-- .../tests/e2e/specs/withdrawCctp.cy.ts | 16 ++++++++++------ .../tests/support/commands.ts | 4 +++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/arb-token-bridge-ui/synpress.cctp.config.ts b/packages/arb-token-bridge-ui/synpress.cctp.config.ts index 6b35dfbdd1..edaa1ffd27 100644 --- a/packages/arb-token-bridge-ui/synpress.cctp.config.ts +++ b/packages/arb-token-bridge-ui/synpress.cctp.config.ts @@ -113,10 +113,10 @@ async function fundWallets() { } /** - * We need 0.0002 USDC per test (0.0001 for same address and 0.0001 for custom address) + * We need 0.0002 USDC per test (0.0001 for same address and 0.00011 for custom address) * And in the worst case, we run each tests 3 time */ - const usdcAmount = utils.parseUnits('0.0006', 6) + const usdcAmount = utils.parseUnits('0.00063', 6) const ethAmountSepolia = utils.parseEther('0.025') const ethAmountArbSepolia = utils.parseEther('0.006') const ethPromises: (() => Promise)[] = [] diff --git a/packages/arb-token-bridge-ui/tests/e2e/specs/withdrawCctp.cy.ts b/packages/arb-token-bridge-ui/tests/e2e/specs/withdrawCctp.cy.ts index 661a66e6a0..758f81a9c8 100644 --- a/packages/arb-token-bridge-ui/tests/e2e/specs/withdrawCctp.cy.ts +++ b/packages/arb-token-bridge-ui/tests/e2e/specs/withdrawCctp.cy.ts @@ -51,9 +51,6 @@ export const confirmAndApproveCctpWithdrawal = () => { } describe('Withdraw USDC through CCTP', () => { - // Happy Path - const USDCAmountToSend = 0.0001 - beforeEach(() => { cy.login({ networkType: 'childChain', networkName: 'arbitrum-sepolia' }) cy.findSourceChainButton('Arbitrum Sepolia') @@ -64,16 +61,16 @@ describe('Withdraw USDC through CCTP', () => { tokenName: 'USDC', tokenAddress: CommonAddress.ArbitrumSepolia.USDC }) + }) + it('should initiate withdrawing USDC to the same address through CCTP successfully', () => { + const USDCAmountToSend = 0.0001 cy.typeAmount(USDCAmountToSend) cy.findByText('Gas estimates are not available for this action.').should( 'be.visible' ) cy.findGasFeeForChain(/You'll have to pay Sepolia gas fee upon claiming./i) - }) - - it('should initiate withdrawing USDC to the same address through CCTP successfully', () => { cy.findMoveFundsButton().click() confirmAndApproveCctpWithdrawal() @@ -88,6 +85,13 @@ describe('Withdraw USDC through CCTP', () => { }) it('should initiate withdrawing USDC to custom destination address through CCTP successfully', () => { + const USDCAmountToSend = 0.00011 + cy.typeAmount(USDCAmountToSend) + + cy.findByText('Gas estimates are not available for this action.').should( + 'be.visible' + ) + cy.findGasFeeForChain(/You'll have to pay Sepolia gas fee upon claiming./i) cy.fillCustomDestinationAddress() cy.findMoveFundsButton().click() diff --git a/packages/arb-token-bridge-ui/tests/support/commands.ts b/packages/arb-token-bridge-ui/tests/support/commands.ts index 89ce122009..b636e7ac86 100644 --- a/packages/arb-token-bridge-ui/tests/support/commands.ts +++ b/packages/arb-token-bridge-ui/tests/support/commands.ts @@ -285,8 +285,10 @@ export function findTransactionInTransactionHistory({ amount: number duration?: string }) { + // Replace . with \. + const parsedAmount = amount.toString().replace(/\./g, '\\.') const rowId = new RegExp( - `(claimable|deposit)-row-[0-9xabcdef]*-${amount}${symbol}` + `(claimable|deposit)-row-[0-9xabcdef]*-${parsedAmount}${symbol}` ) cy.findByTestId(rowId).as('row') if (duration) {