import { BrowserDriver , createTestSelector , selectTestNet , setupBrowser } from '../utils' ; import { WalletPage } from '../../page-objects/wallet.page' ; import { RouteUrls } from '@shared/route-urls' ; import { BalanceSelectors } from '@tests/integration/balance.selectors' ; import { SECRET_KEY_2 } from '@tests/mocks' ; jest . setTimeout ( 50000 ) ; jest . retryTimes ( process . env . CI ? 2 : 0 ) ; const getAmount = ( stxAmount ) => { return stxAmount ? parseFloat ( stxAmount . replace ( /,/g , '' ) ) : 0 ; } ; describe ( `Wallet Balance integration tests` , ( ) => { const BEFORE_ALL_TIMEOUT = 60000 ; let browser ; let wallet ; beforeAll ( async ( ) => { browser = await setupBrowser ( ) ; wallet = await WalletPage . init ( browser , RouteUrls . Onboarding ) ; await wallet . clickAllowAnalytics ( ) ; await wallet . signIn ( SECRET_KEY_2 ) ; await selectTestNet ( wallet ) ; await wallet . waitForHomePage ( ) ; } , BEFORE_ALL_TIMEOUT ) ; afterAll ( async ( ) => { try { await browser . context . close ( ) ; } catch ( error ) { } } ) ; it ( 'checks Stacks Token balance is greater than 0' , async ( ) => { const stxAmount = await wallet . page . textContent ( createTestSelector ( BalanceSelectors . StacksToken ) ) ; const actualAmount = stxAmount && getAmount ( stxAmount ) ; expect ( actualAmount ) . toBeGreaterThan ( 0 ) ; } ) ; it ( 'Check rocket token balance is greater than 0' , async ( ) => { const rocketAmount = await wallet . page . textContent ( createTestSelector ( BalanceSelectors . RocketToken ) ) ; const actualAmount = rocketAmount && getAmount ( rocketAmount ) ; expect ( actualAmount ) . toBeGreaterThan ( 0 ) ; } ) ; it ( 'Check stella token balance is greater than 0' , async ( ) => { const stellaAmount = await wallet . page . textContent ( createTestSelector ( BalanceSelectors . StellaToken ) ) ; const actualAmount = stellaAmount && getAmount ( stellaAmount ) ; expect ( actualAmount ) . toBeGreaterThan ( 0 ) ; } ) ; } ) ;