@@ -3,7 +3,7 @@ import { WalletPage } from './shared/pages/WalletPage';
33import { WalletValidator } from './shared/validators/WalletValidator' ;
44import { ModalPage } from './shared/pages/ModalPage' ;
55import { ModalValidator } from './shared/validators/ModalValidator' ;
6- import { DEFAULT_CHAIN_NAME } from './shared/constants' ;
6+ import { DEFAULT_CHAIN_NAME , TEST_CHAINS } from './shared/constants' ;
77
88let modalPage : ModalPage ;
99let modalValidator : ModalValidator ;
@@ -37,21 +37,36 @@ sampleWalletTest.afterAll(async () => {
3737} ) ;
3838
3939// -- Tests --------------------------------------------------------------------
40+ /**
41+ * Connection Tests
42+ * Tests the basic connection functionality including:
43+ * - Page refresh behavior
44+ * - Network switching
45+ * - Disconnection flows
46+ */
47+
4048sampleWalletTest ( 'it should be connected instantly after page refresh' , async ( ) => {
4149 await modalPage . page . reload ( ) ;
4250 await modalValidator . expectToBeConnectedInstantly ( ) ;
4351} ) ;
4452
53+ /**
54+ * Network Tests
55+ * Tests network-related functionality including:
56+ * - Disabled networks visibility
57+ * - Network switching
58+ * - Network persistence after refresh
59+ */
60+
4561sampleWalletTest ( 'it should show disabled networks' , async ( ) => {
46- const disabledNetworks = 'Gnosis' ;
4762 await modalPage . openAccountModal ( ) ;
4863 await modalPage . goToNetworks ( ) ;
49- await modalValidator . expectNetworksDisabled ( disabledNetworks ) ;
64+ await modalValidator . expectNetworksDisabled ( TEST_CHAINS . GNOSIS ) ;
5065 await modalPage . closeModal ( ) ;
5166} ) ;
5267
5368sampleWalletTest ( 'it should switch networks and sign' , async ( ) => {
54- const chains = [ 'Polygon' , 'Ethereum' ] ;
69+ const chains = [ TEST_CHAINS . POLYGON , TEST_CHAINS . ETHEREUM ] ;
5570
5671 async function processChain ( index : number ) {
5772 if ( index >= chains . length ) {
@@ -77,34 +92,45 @@ sampleWalletTest('it should switch networks and sign', async () => {
7792 await processChain ( index + 1 ) ;
7893 }
7994
80- // Start processing from the first chain
8195 await processChain ( 0 ) ;
8296} ) ;
8397
8498sampleWalletTest ( 'it should show last connected network after refreshing' , async ( ) => {
85- const chainName = 'Polygon' ;
86-
8799 await modalPage . openAccountModal ( ) ;
88100 await modalPage . goToNetworks ( ) ;
89- await modalPage . switchNetwork ( chainName ) ;
90- await modalValidator . expectSwitchedNetwork ( chainName ) ;
101+ await modalPage . switchNetwork ( TEST_CHAINS . POLYGON ) ;
102+ await modalValidator . expectSwitchedNetwork ( TEST_CHAINS . POLYGON ) ;
91103 await modalPage . closeModal ( ) ;
92104
93105 await modalPage . page . reload ( ) ;
94106
95107 await modalPage . openAccountModal ( ) ;
96- await modalValidator . expectSwitchedNetwork ( chainName ) ;
108+ await modalValidator . expectSwitchedNetwork ( TEST_CHAINS . POLYGON ) ;
97109 await modalPage . closeModal ( ) ;
98110} ) ;
99111
112+ /**
113+ * Signing Tests
114+ * Tests message signing functionality including:
115+ * - Successful signing flow
116+ * - Rejection flow
117+ */
118+
100119sampleWalletTest ( 'it should reject sign' , async ( ) => {
101- const chainName = 'Polygon' ;
102120 await modalPage . sign ( ) ;
103- await walletValidator . expectReceivedSign ( { chainName } ) ;
121+ await walletValidator . expectReceivedSign ( { chainName : TEST_CHAINS . POLYGON } ) ;
104122 await walletPage . handleRequest ( { accept : false } ) ;
105123 await modalValidator . expectRejectedSign ( ) ;
106124} ) ;
107125
126+ /**
127+ * Disconnection Tests
128+ * Tests various disconnection scenarios including:
129+ * - Hook-based disconnection
130+ * - Wallet-initiated disconnection
131+ * - Manual disconnection
132+ */
133+
108134sampleWalletTest ( 'it should disconnect using hook' , async ( ) => {
109135 await modalValidator . expectConnected ( ) ;
110136 await modalPage . clickHookDisconnectButton ( ) ;
@@ -129,6 +155,14 @@ sampleWalletTest('it should disconnect as expected', async () => {
129155 await modalValidator . expectDisconnected ( ) ;
130156} ) ;
131157
158+ /**
159+ * Activity Screen Tests
160+ * Tests the Activity screen behavior including:
161+ * - Loader visibility on first visit
162+ * - Loader behavior on subsequent visits
163+ * - Loader behavior after network changes
164+ */
165+
132166sampleWalletTest ( 'shows loader behavior on first visit to Activity screen' , async ( ) => {
133167 // Connect to wallet
134168 await modalPage . qrCodeFlow ( modalPage , walletPage ) ;
@@ -158,8 +192,8 @@ sampleWalletTest('shows loader behavior after network change in Activity screen'
158192
159193 // Change network
160194 await modalPage . goToNetworks ( ) ;
161- await modalPage . switchNetwork ( 'Polygon' ) ;
162- await modalValidator . expectSwitchedNetwork ( 'Polygon' ) ;
195+ await modalPage . switchNetwork ( TEST_CHAINS . POLYGON ) ;
196+ await modalValidator . expectSwitchedNetwork ( TEST_CHAINS . POLYGON ) ;
163197
164198 // Visit Activity screen after network change
165199 await modalPage . goToActivity ( ) ;
0 commit comments