66 isVisible ,
77} from './helpers' ;
88
9- const d = checkComplete ( [ 'numberpad-1 ' , 'numberpad-2 ' ] )
9+ const d = checkComplete ( [ 'numberpad-modern ' , 'numberpad-classic ' ] )
1010 ? describe . skip
1111 : describe ;
1212
@@ -27,22 +27,14 @@ d('NumberPad', () => {
2727 // - no multiple zeros (000.23 -> 0.23)
2828 // - no multiple decimal symbols (0...23 -> 0.23)
2929 // - correct placeholders
30+ // - classic denomination
3031
3132 // Receive
3233 // - no exceeding maxAmount
3334 // - numberPadTextField value still there after navigating back and forth
3435
35- // Send
36- // TODO:
37-
38- // Lightning
39- // TODO:
40-
41- // NumberPadWeeks
42- // TODO:
43-
44- it ( 'Can enter amounts and switch units' , async ( ) => {
45- if ( checkComplete ( 'numberpad-1' ) ) {
36+ it ( 'Can enter amounts in modern denomination' , async ( ) => {
37+ if ( checkComplete ( 'numberpad-modern' ) ) {
4638 return ;
4739 }
4840
@@ -60,61 +52,84 @@ d('NumberPad', () => {
6052 await element ( by . id ( 'N000' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
6153 await expect ( element ( by . text ( '123 000' ) ) ) . toBeVisible ( ) ;
6254
55+ // Switch to USD
56+ await element ( by . id ( 'ReceiveNumberPadUnit' ) ) . tap ( ) ;
57+ // reset to 0
6358 await element (
6459 by . id ( 'NRemove' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
65- ) . tap ( ) ;
66- await expect ( element ( by . text ( '12 300 ' ) ) ) . toBeVisible ( ) ;
67-
68- // Switch to BTC
69- await element ( by . id ( 'ReceiveNumberPadUnit' ) ) . multiTap ( 2 ) ;
70- await expect ( element ( by . text ( '0.00012300' ) ) ) . toBeVisible ( ) ;
60+ ) . multiTap ( 8 ) ;
61+ await expect ( element ( by . text ( '0.00 ' ) ) ) . toBeVisible ( ) ;
62+ await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . multiTap (
63+ 2 ,
64+ ) ;
65+ await element ( by . id ( 'N1' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
7166 await element (
72- by . id ( 'NRemove' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
73- ) . multiTap ( 7 ) ;
74- await element ( by . id ( 'N4' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
67+ by . id ( 'NDecimal' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
68+ ) . multiTap ( 2 ) ;
69+ await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
70+ await element ( by . id ( 'N1' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
7571 await element (
7672 by . id ( 'NDecimal' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
7773 ) . tap ( ) ;
78- await element ( by . id ( 'N2' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
79- await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
80- await element ( by . id ( 'N6' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
81- await element ( by . id ( 'N9' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
82- await expect ( element ( by . text ( '4.20690000' ) ) ) . toBeVisible ( ) ;
74+ await expect ( element ( by . text ( '1.01' ) ) ) . toBeVisible ( ) ;
8375
84- // Switch back to sats
76+ // Switch back to BTC
8577 await element ( by . id ( 'ReceiveNumberPadUnit' ) ) . tap ( ) ;
8678
87- markComplete ( 'numberpad-1 ' ) ;
79+ markComplete ( 'numberpad-modern ' ) ;
8880 } ) ;
8981
90- it ( 'Cannot enter more than one zero or decimal symbol ' , async ( ) => {
91- if ( checkComplete ( 'numberpad-2 ' ) ) {
82+ it ( 'Can enter amounts in classic denomination ' , async ( ) => {
83+ if ( checkComplete ( 'numberpad-classic ' ) ) {
9284 return ;
9385 }
9486
87+ // switch to classic denomination
88+ await element ( by . id ( 'Settings' ) ) . tap ( ) ;
89+ await element ( by . id ( 'GeneralSettings' ) ) . tap ( ) ;
90+ await element ( by . id ( 'UnitSettings' ) ) . tap ( ) ;
91+ await element ( by . id ( 'DenominationClassic' ) ) . tap ( ) ;
92+ await element ( by . id ( 'NavigationClose' ) ) . tap ( ) ;
93+
9594 await element ( by . id ( 'Receive' ) ) . tap ( ) ;
9695 if ( await isVisible ( 'UnderstoodButton' ) ) {
9796 await element ( by . id ( 'UnderstoodButton' ) ) . tap ( ) ;
9897 }
9998 await element ( by . id ( 'SpecifyInvoiceButton' ) ) . tap ( ) ;
10099 await element ( by . id ( 'ReceiveNumberPadTextField' ) ) . tap ( ) ;
101100
102- // Switch to BTC
103- await element ( by . id ( 'ReceiveNumberPadUnit' ) ) . multiTap ( 2 ) ;
104- await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . multiTap (
105- 2 ,
106- ) ;
101+ // Unit set to BTC
107102 await element ( by . id ( 'N1' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
103+ await expect ( element ( by . text ( '1.00000000' ) ) ) . toBeVisible ( ) ;
104+
105+ // can only enter one decimal symbol
108106 await element (
109107 by . id ( 'NDecimal' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
110108 ) . multiTap ( 2 ) ;
111- await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
112- await element ( by . id ( 'N1' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
109+ await expect ( element ( by . text ( '1.00000000' ) ) ) . toBeVisible ( ) ;
110+
111+ await element (
112+ by . id ( 'NRemove' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
113+ ) . tap ( ) ;
114+ await expect ( element ( by . text ( '1.00000000' ) ) ) . toBeVisible ( ) ;
115+ await element (
116+ by . id ( 'NDecimal' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
117+ ) . tap ( ) ;
118+
119+ // reset to 0
120+ await element (
121+ by . id ( 'NRemove' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
122+ ) . multiTap ( 8 ) ;
123+ await element ( by . id ( 'N4' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
113124 await element (
114125 by . id ( 'NDecimal' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ,
115126 ) . tap ( ) ;
116- await expect ( element ( by . text ( '1.01000000' ) ) ) . toBeVisible ( ) ;
127+ await element ( by . id ( 'N2' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
128+ await element ( by . id ( 'N0' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
129+ await element ( by . id ( 'N6' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
130+ await element ( by . id ( 'N9' ) . withAncestor ( by . id ( 'ReceiveNumberPad' ) ) ) . tap ( ) ;
131+ await expect ( element ( by . text ( '4.20690000' ) ) ) . toBeVisible ( ) ;
117132
118- markComplete ( 'numberpad-2 ' ) ;
133+ markComplete ( 'numberpad-classic ' ) ;
119134 } ) ;
120135} ) ;
0 commit comments