1
+ import { Browser , By } from 'selenium-webdriver' ;
1
2
import FixtureBuilder from '../../fixture-builder' ;
2
3
import { withFixtures } from '../../helpers' ;
3
4
import { shortenAddress } from '../../../../ui/helpers/utils/util' ;
@@ -9,6 +10,8 @@ import HomePage from '../../page-objects/pages/home/homepage';
9
10
import SelectHardwareWalletAccountPage from '../../page-objects/pages/hardware-wallet/select-hardware-wallet-account-page' ;
10
11
import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow' ;
11
12
13
+ const IS_FIREFOX = process . env . SELENIUM_BROWSER === Browser . FIREFOX ;
14
+
12
15
describe ( 'Ledger Hardware' , function ( ) {
13
16
it ( 'derives the correct accounts and unlocks the first account' , async function ( ) {
14
17
await withFixtures (
@@ -31,32 +34,40 @@ describe('Ledger Hardware', function () {
31
34
await connectHardwareWalletPage . check_pageIsLoaded ( ) ;
32
35
await connectHardwareWalletPage . openConnectLedgerPage ( ) ;
33
36
34
- const selectLedgerAccountPage = new SelectHardwareWalletAccountPage (
35
- driver ,
36
- ) ;
37
- await selectLedgerAccountPage . check_pageIsLoaded ( ) ;
37
+ if ( IS_FIREFOX ) {
38
+ // check Firefox Not Supported text exists and stop test
39
+ await driver . findElement (
40
+ By . xpath ( "//*[contains(text(), 'Firefox Not Supported')]" ) ,
41
+ ) ;
42
+ } else {
43
+ const selectLedgerAccountPage = new SelectHardwareWalletAccountPage (
44
+ driver ,
45
+ ) ;
38
46
39
- // Check that the first page of accounts is correct
40
- await selectLedgerAccountPage . check_accountNumber ( ) ;
41
- for ( const { address } of KNOWN_PUBLIC_KEY_ADDRESSES . slice ( 0 , 4 ) ) {
42
- const shortenedAddress = `${ address . slice ( 0 , 4 ) } ...${ address . slice (
43
- - 4 ,
44
- ) } `;
45
- await selectLedgerAccountPage . check_addressIsDisplayed (
46
- shortenedAddress ,
47
+ await selectLedgerAccountPage . check_pageIsLoaded ( ) ;
48
+
49
+ // Check that the first page of accounts is correct
50
+ await selectLedgerAccountPage . check_accountNumber ( ) ;
51
+ for ( const { address } of KNOWN_PUBLIC_KEY_ADDRESSES . slice ( 0 , 4 ) ) {
52
+ const shortenedAddress = `${ address . slice ( 0 , 4 ) } ...${ address . slice (
53
+ - 4 ,
54
+ ) } `;
55
+ await selectLedgerAccountPage . check_addressIsDisplayed (
56
+ shortenedAddress ,
57
+ ) ;
58
+ }
59
+
60
+ // Unlock first account of first page and check that the correct account has been added
61
+ await selectLedgerAccountPage . unlockAccount ( 1 ) ;
62
+ await headerNavbar . check_pageIsLoaded ( ) ;
63
+ await new HomePage ( driver ) . check_expectedBalanceIsDisplayed ( '0' ) ;
64
+ await headerNavbar . openAccountMenu ( ) ;
65
+ await accountListPage . check_pageIsLoaded ( ) ;
66
+ await accountListPage . check_accountDisplayedInAccountList ( 'Ledger 1' ) ;
67
+ await accountListPage . check_accountAddressDisplayedInAccountList (
68
+ shortenAddress ( KNOWN_PUBLIC_KEY_ADDRESSES [ 0 ] . address ) ,
47
69
) ;
48
70
}
49
-
50
- // Unlock first account of first page and check that the correct account has been added
51
- await selectLedgerAccountPage . unlockAccount ( 1 ) ;
52
- await headerNavbar . check_pageIsLoaded ( ) ;
53
- await new HomePage ( driver ) . check_expectedBalanceIsDisplayed ( '0' ) ;
54
- await headerNavbar . openAccountMenu ( ) ;
55
- await accountListPage . check_pageIsLoaded ( ) ;
56
- await accountListPage . check_accountDisplayedInAccountList ( 'Ledger 1' ) ;
57
- await accountListPage . check_accountAddressDisplayedInAccountList (
58
- shortenAddress ( KNOWN_PUBLIC_KEY_ADDRESSES [ 0 ] . address ) ,
59
- ) ;
60
71
} ,
61
72
) ;
62
73
} ) ;
0 commit comments