Skip to content

Commit

Permalink
test: update CCTP withdrawal test (#1894)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx authored Sep 13, 2024
1 parent da4e2ad commit 0d22757
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/arb-token-bridge-ui/synpress.cctp.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>)[] = []
Expand Down
16 changes: 10 additions & 6 deletions packages/arb-token-bridge-ui/tests/e2e/specs/withdrawCctp.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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()
Expand All @@ -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()

Expand Down
4 changes: 3 additions & 1 deletion packages/arb-token-bridge-ui/tests/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0d22757

Please sign in to comment.