Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/run-e2e-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,53 @@ jobs:
if: false
uses: ./.github/workflows/run-e2e-api-specs.yml
secrets: inherit

report-e2e-smoke-tests:
name: Report E2E Smoke Tests
runs-on: ubuntu-latest
if: false
needs:
- smoke-confirmations-ios
- smoke-confirmations-android
- smoke-confirmations-redesigned-ios
- smoke-trade-ios
- smoke-trade-android
- smoke-wallet-platform-ios
- smoke-wallet-platform-android
- smoke-identity-ios
- smoke-identity-android
- smoke-accounts-ios
- smoke-accounts-android
- smoke-network-abstraction-ios
- smoke-network-abstraction-android
- smoke-network-expansion-ios
- smoke-network-expansion-android
- smoke-performance-ios
- smoke-performance-android
- smoke-api-specs

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download all test results
uses: actions/download-artifact@v4
with:
path: all-test-results/
pattern: "*-test-results"

- name: Post Test Report
uses: dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3
with:
name: "E2E Smoke Test Results"
path: "all-test-results/**/*.xml"
reporter: "jest-junit"
fail-on-error: false
list-suites: "all"
list-tests: "all"

- name: Upload merged report
uses: actions/upload-artifact@v4
with:
name: merged-test-report
path: all-test-results/**/*.xml
6 changes: 5 additions & 1 deletion app/components/Nav/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ const OnboardingNav = () => (
<Stack.Screen name="Onboarding" component={Onboarding} />
<Stack.Screen name="OnboardingCarousel" component={OnboardingCarousel} />
<Stack.Screen name="ChoosePassword" component={ChoosePassword} />
<Stack.Screen name="AccountBackupStep1" component={AccountBackupStep1} />
<Stack.Screen
name="AccountBackupStep1"
component={AccountBackupStep1}
options={{ headerShown: false }}
/>
<Stack.Screen name="AccountBackupStep1B" component={AccountBackupStep1B} />
<Stack.Screen
name={Routes.ONBOARDING.SUCCESS_FLOW}
Expand Down
182 changes: 26 additions & 156 deletions app/components/UI/Bridge/Views/BridgeView/BridgeView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1015,18 +1015,7 @@ describe('BridgeView', () => {
jest.mocked(isHardwareAccount).mockReturnValue(false);
});

it('should navigate to blockaid modal on validation error for Solana swap', async () => {
// Mock validation result with validation error
mockValidateBridgeTx.mockResolvedValue({
status: 'ERROR',
result: {
validation: {
reason: 'Transaction may result in loss of funds',
},
},
error: null,
});

it('should submit transaction for Solana swap', async () => {
// Set route params for swap mode
mockRoute.params.bridgeViewMode = BridgeViewMode.Swap;

Expand Down Expand Up @@ -1079,35 +1068,17 @@ describe('BridgeView', () => {
fireEvent.press(continueButton);
});

await waitFor(() => {
expect(mockValidateBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.BRIDGE.MODALS.ROOT, {
screen: Routes.BRIDGE.MODALS.BLOCKAID_MODAL,
params: {
errorType: 'validation',
errorMessage: 'Transaction may result in loss of funds',
},
await act(async () => {
await waitFor(() => {
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});
});

// Should not submit the transaction
expect(mockSubmitBridgeTx).not.toHaveBeenCalled();
});

it('should navigate to blockaid modal on simulation error for Solana to EVM bridge', async () => {
// Mock validation result with simulation error
mockValidateBridgeTx.mockResolvedValue({
status: 'ERROR',
result: {
validation: {
reason: null,
},
},
error: 'Simulation failed',
});

it('should submit transaction for Solana to EVM bridge', async () => {
// Set route params for bridge mode
mockRoute.params.bridgeViewMode = BridgeViewMode.Bridge;

Expand Down Expand Up @@ -1163,110 +1134,17 @@ describe('BridgeView', () => {
fireEvent.press(continueButton);
});

await waitFor(() => {
expect(mockValidateBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.BRIDGE.MODALS.ROOT, {
screen: Routes.BRIDGE.MODALS.BLOCKAID_MODAL,
params: {
errorType: 'simulation',
errorMessage: 'Simulation failed',
},
});
});

// Should not submit the transaction
expect(mockSubmitBridgeTx).not.toHaveBeenCalled();
});

it('should prioritize validation error over simulation error', async () => {
// Mock validation result with both validation and simulation errors
mockValidateBridgeTx.mockResolvedValue({
status: 'ERROR',
result: {
validation: {
reason: 'Transaction may result in loss of funds',
},
},
error: 'Simulation failed',
});

// Set route params for swap mode
mockRoute.params.bridgeViewMode = BridgeViewMode.Swap;

const testState = createBridgeTestState({
bridgeControllerOverrides: {
quotesLoadingStatus: RequestStatus.FETCHED,
quotes: [mockQuote],
quotesLastFetched: 12,
},
bridgeReducerOverrides: {
sourceAmount: '1.0',
sourceToken: {
address: 'So11111111111111111111111111111111111111112',
chainId: SolScope.Mainnet,
decimals: 9,
image: '',
name: 'Solana',
symbol: 'SOL',
},
destToken: {
address: 'So11111111111111111111111111111111111111112',
chainId: SolScope.Mainnet,
decimals: 9,
image: '',
name: 'Solana',
symbol: 'SOL',
},
},
});

jest
.mocked(useBridgeQuoteData as unknown as jest.Mock)
.mockImplementation(() => ({
...mockUseBridgeQuoteData,
activeQuote: mockQuote,
isLoading: false,
}));

const { getByText } = renderScreen(
BridgeView,
{
name: Routes.BRIDGE.ROOT,
},
{ state: testState },
);

// Find and press the continue button
const continueButton = getByText(strings('bridge.confirm_swap'));
await act(async () => {
fireEvent.press(continueButton);
});

await waitFor(() => {
expect(mockNavigate).toHaveBeenCalledWith(Routes.BRIDGE.MODALS.ROOT, {
screen: Routes.BRIDGE.MODALS.BLOCKAID_MODAL,
params: {
errorType: 'validation', // Should prioritize validation over simulation
errorMessage: 'Transaction may result in loss of funds',
},
await waitFor(() => {
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});
});
});

it('should proceed with transaction when no validation errors', async () => {
// Mock validation result with no errors
mockValidateBridgeTx.mockResolvedValue({
status: 'SUCCESS',
result: {
validation: {
reason: null,
},
},
error: null,
});

it('should proceed with transaction when continue is pressed', async () => {
// Set route params for swap mode
mockRoute.params.bridgeViewMode = BridgeViewMode.Swap;

Expand Down Expand Up @@ -1319,20 +1197,13 @@ describe('BridgeView', () => {
fireEvent.press(continueButton);
});

await waitFor(() => {
expect(mockValidateBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
await act(async () => {
await waitFor(() => {
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});

// Should not navigate to blockaid modal
expect(mockNavigate).not.toHaveBeenCalledWith(Routes.BRIDGE.MODALS.ROOT, {
screen: Routes.BRIDGE.MODALS.BLOCKAID_MODAL,
params: expect.any(Object),
});
});

Expand Down Expand Up @@ -1389,15 +1260,14 @@ describe('BridgeView', () => {
fireEvent.press(continueButton);
});

await waitFor(() => {
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
await act(async () => {
await waitFor(() => {
expect(mockSubmitBridgeTx).toHaveBeenCalledWith({
quoteResponse: mockQuote,
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});
expect(mockNavigate).toHaveBeenCalledWith(Routes.TRANSACTIONS_VIEW);
});

// Should not call validation for non-Solana transactions
expect(mockValidateBridgeTx).not.toHaveBeenCalled();
});
});
});
Loading
Loading