Skip to content

test(bridge): Add integration tests for transfer panel#182

Open
chrstph-dvx wants to merge 9 commits intomasterfrom
integration-tests
Open

test(bridge): Add integration tests for transfer panel#182
chrstph-dvx wants to merge 9 commits intomasterfrom
integration-tests

Conversation

@chrstph-dvx
Copy link
Copy Markdown
Contributor

@chrstph-dvx chrstph-dvx commented Feb 25, 2026

Summary

Steps to test

Copilot AI review requested due to automatic review settings February 25, 2026 18:52
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arbitrum-portal Ready Ready Preview Apr 22, 2026 5:21pm

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive integration tests for the TransferPanel component, which handles token transfers between different blockchain networks. The tests verify that the correct tokens are displayed and available for selection across various transfer scenarios including default token transfers, USDC transfers, ETH/WETH overrides, and token swaps.

Changes:

  • Added integration test infrastructure with separate Vitest configuration and setup files
  • Implemented 569-line integration test suite covering multiple transfer scenarios across Ethereum, ApeChain, and Superposition networks
  • Fixed a bug in useNativeCurrency.ts where the wrong address was being used to fetch ERC20 data
  • Enhanced useGasEstimates.ts to properly handle different route types (canonical, LiFi, CCTP, OftV2)
  • Fixed HTML semantic issues in NetworkSelectionContainer by replacing nested <p> tags with <div> and <span>

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
vitest.integration.config.ts New Vitest configuration for integration tests with 120s timeout and happy-dom environment
vitest.integration.setup.ts Setup file that configures axios defaults, mocks animations API, and sets public RPC URLs
vitest.config.ts Updated to exclude integration tests and add @/components alias
integration-test-wrapper.tsx Test wrapper utility providing Overmind, QueryParam, Wagmi, and SWR contexts
TransferPanel.integration.test.tsx Comprehensive integration tests for TransferPanel covering default, USDC, ETH/WETH, and swap scenarios
useNativeCurrency.ts Added try-catch error handling and fallback to config data when ERC20 fetch fails
useGasEstimates.ts Enhanced route selection logic to support LiFi, CCTP, and OftV2 route types
DestinationTokenButton.tsx Simplified to use networks.destinationChainProvider directly
NetworkSelectionContainer.tsx Fixed invalid HTML nesting by changing <p> to <div> and nested <p> to <span>
package.json (both) Added test:integration scripts and jsdom-testing-mocks dependency
yarn.lock Updated dependencies including @WalletConnect, @reown/appkit, and various cryptographic libraries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/arb-token-bridge-ui/vitest.integration.config.ts
Comment thread packages/arb-token-bridge-ui/vitest.integration.setup.tsx
Comment thread packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts Outdated
Comment thread packages/arb-token-bridge-ui/src/hooks/useNativeCurrency.ts Outdated

const { childChainProvider } = useNetworksRelationship(networks);
const nativeCurrency = useNativeCurrency({ provider: childChainProvider });
const nativeCurrency = useNativeCurrency({ provider: networks.destinationChainProvider });
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't a big issue, but destination provider is more correct than child here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong. it introduces a regression bug for custom native token chain withdrawals.

Image

<span className="truncate text-base">{network.name}</span>

<p className="text-xs leading-none text-white/70">
<div className="text-xs leading-none text-white/70">
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small fix: it was spamming the console, about p being a parent of p

[key: string]: string | string[] | undefined;
},
baseUrl: string,
) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was called on the server, integration test is skipping it. So this util was extracted (without the redirect) to be called in integration test.

Copy link
Copy Markdown
Member

@fionnachan fionnachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR shouldn't change any logic in the code because a seemingly small change could break the app

let's only introduce the tests without making any changes unless they are purely HTML element changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting failure on L434

(sourceChainNativeCurrency.isCustom && destinationChainNativeCurrency.isCustom) ||
networks.sourceChain.id === ChainId.ApeChain
) {
if (sourceChainNativeCurrency.isCustom && destinationChainNativeCurrency.isCustom) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this change for?


const { childChainProvider } = useNetworksRelationship(networks);
const nativeCurrency = useNativeCurrency({ provider: childChainProvider });
const nativeCurrency = useNativeCurrency({ provider: networks.destinationChainProvider });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong. it introduces a regression bug for custom native token chain withdrawals.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants