@@ -2,6 +2,7 @@ import { test, expect, Page } from '@playwright/test';
2
2
import dotenv from 'dotenv' ;
3
3
import path from 'path' ;
4
4
import { BridgeView } from '../views/bridge' ;
5
+ import { RedeemView } from '../views/redeem' ;
5
6
6
7
// Read from .env* files
7
8
// This is only for local testing overrides
@@ -31,28 +32,27 @@ const ARB_USDC_CONTRACT = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
31
32
const BASE_USDC_CONTRACT = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ;
32
33
33
34
let page : Page ;
35
+ let bridgeView : BridgeView ;
36
+ let redeemView : RedeemView ;
34
37
35
38
// Annotate entire file as serial.
36
39
test . describe . configure ( { mode : 'serial' } ) ;
37
40
38
41
test . beforeAll ( async ( { browser } ) => {
39
42
page = await browser . newPage ( ) ;
43
+ bridgeView = new BridgeView ( page ) ;
44
+ redeemView = new RedeemView ( page ) ;
40
45
} ) ;
41
46
42
47
test . afterAll ( async ( ) => {
43
48
await page . close ( ) ;
44
49
} ) ;
45
50
46
51
test ( 'should configure transaction' , async ( ) => {
47
- // Navigate to the root page
52
+ // Navigate to brige view
48
53
await page . goto ( `http://localhost:5173/?config=${ DEFAULT_CONFIG } ` ) ;
49
54
50
- // Wait for the main container to be visible
51
- await page . waitForSelector ( '#sample-app' , {
52
- state : 'visible' ,
53
- } ) ;
54
-
55
- const bridgeView = new BridgeView ( page ) ;
55
+ // Verify key elements are present in bridge view
56
56
await bridgeView . verifyElements ( ) ;
57
57
58
58
// Set source wallet
@@ -78,28 +78,18 @@ test('should configure transaction', async () => {
78
78
79
79
// Mayan Swift route should be visible and selected by default
80
80
await expect ( page . getByTestId ( 'route-MayanSwapSWIFT-selected' ) ) . toBeVisible ( ) ;
81
-
82
- // Verify Confirm transaction button and start transaction
83
- const confirmButton = page . getByTestId ( 'confirm-transaction-button' ) ;
84
- await expect ( confirmButton ) . toHaveText ( 'Confirm transaction' ) ;
85
- await expect ( confirmButton ) . toBeEnabled ( ) ;
86
81
} ) ;
87
82
88
83
test ( 'should initiate transaction' , async ( ) => {
89
84
// Start transaction
90
- const confirmButton = page . getByTestId ( 'confirm-transaction-button' ) ;
91
- await confirmButton . click ( ) ;
92
- // Wait for Confirm transaction button to be in Preparing state
93
- await expect ( confirmButton ) . toHaveText ( 'Preparing transaction' ) ;
85
+ await bridgeView . startTransaction ( ) ;
94
86
95
87
// Wait for Redeem view
96
- await expect ( page . getByTestId ( 'redeem-view' ) ) . toBeVisible ( { timeout : 30000 } ) ;
88
+ await redeemView . verifyElements ( ) ;
97
89
98
90
// Verify transaction status as submitted
99
- const statusHeader = page . getByTestId ( 'redeem-view-status-header ') ;
100
- await expect ( statusHeader ) . toHaveText ( 'Transaction submitted' ) ;
91
+ await redeemView . confirmTransactionState ( 'Transaction submitted ') ;
92
+
101
93
// Wait for transaction completion
102
- await expect ( statusHeader ) . toHaveText ( 'Transaction complete' , {
103
- timeout : 30000 ,
104
- } ) ;
94
+ await redeemView . confirmTransactionState ( 'Transaction completed' ) ;
105
95
} ) ;
0 commit comments