@@ -25,15 +25,15 @@ export default (app: Application) => {
2525 await app . waitUntilLoaded ( )
2626 } )
2727
28- afterEach ( async ( ) => {
28+ afterEach ( async ( ) => {
2929 const { client } = app . spectron
3030 client . click ( 'button[type=reset]' )
3131 await client . waitUntilWindowLoaded ( )
3232 } )
3333
3434 describe ( 'Test address field boundary validation' , ( ) => {
3535 app . test ( 'Invalid address should show alert' , async ( ) => {
36- const { client } = app . spectron
36+ const { client } = app . spectron
3737 const invalidAddress = 'invalid-address'
3838 const inputs = await app . elements ( 'input' )
3939 client . elementIdValue ( inputs . value [ 0 ] . ELEMENT , invalidAddress )
@@ -52,7 +52,6 @@ export default (app: Application) => {
5252 const errorMessage = await app . element ( '.ms-TextField-errorMessage' )
5353 const msg = await client . elementIdText ( errorMessage . value . ELEMENT )
5454 expect ( msg . value ) . toBe ( 'Address cannot be empty' )
55-
5655 } )
5756
5857 app . test ( 'Valid address should not show alert' , async ( ) => {
@@ -66,8 +65,6 @@ export default (app: Application) => {
6665 } )
6766 } )
6867
69-
70-
7168 describe ( 'Test amount field boundary validation' , ( ) => {
7269 const validAddress = 'ckt1qyq0cwanfaf2t2cwmuxd8ujv2ww6kjv7n53sfwv2l0'
7370 app . test ( 'Amount 60.99999999 is too small, 61 CKB is required' , async ( ) => {
@@ -110,5 +107,44 @@ export default (app: Application) => {
110107 expect ( msg . value ) . toBe ( 'Amount is not enough' )
111108 } )
112109 } )
113- }
114110
111+ describe ( 'Test the transaction fee operations' , ( ) => {
112+ beforeAll ( async ( ) => {
113+ const { client } = app . spectron
114+ client . click ( 'button[role=switch]' )
115+ await app . waitUntilLoaded ( )
116+ } )
117+
118+ app . test ( 'default price should be 0 and default speed should be 3min' , async ( ) => {
119+ const { client } = app . spectron
120+ const transactionFeePanel = client . $ ( 'div[aria-label="transaction fee"]' )
121+ const [ , priceField ] = await transactionFeePanel . $$ ( 'input' )
122+ expect ( ( await client . elementIdAttribute ( priceField . value . ELEMENT , 'value' ) ) . value ) . toBe ( '0' )
123+ const speedDropdown = await client . $ ( 'div[role=listbox]' )
124+ expect ( ( await client . elementIdAttribute ( speedDropdown . value . ELEMENT , 'innerText' ) ) . value ) . toBe ( '~ 3min' )
125+ } )
126+
127+ app . test ( 'Change speed to immediately and the price should be 180' , async ( ) => {
128+ const { client } = app . spectron
129+ client . click ( 'div[role=listbox]' )
130+ await app . waitUntilLoaded ( )
131+ client . click ( 'button[title=immediately]' )
132+ await app . waitUntilLoaded ( )
133+ const transactionFeePanel = client . $ ( 'div[aria-label="transaction fee"]' )
134+ const [ , priceField ] = await transactionFeePanel . $$ ( 'input' )
135+ expect ( ( await client . elementIdAttribute ( priceField . value . ELEMENT , 'value' ) ) . value ) . toBe ( '180' )
136+ } )
137+
138+ app . test ( 'Change the price to 150 and the speed should switch to ~ 30s' , async ( ) => {
139+ const { client } = app . spectron
140+ const transactionFeePanel = client . $ ( 'div[aria-label="transaction fee"]' )
141+ const [ , priceField ] = await transactionFeePanel . $$ ( 'input' )
142+ client . elementIdClear ( priceField . value . ELEMENT )
143+ await app . waitUntilLoaded ( )
144+ client . elementIdValue ( priceField . value . ELEMENT , '150' )
145+ const speedDropdown = await client . $ ( 'div[role=listbox]' )
146+
147+ expect ( ( await client . elementIdAttribute ( speedDropdown . value . ELEMENT , 'innerText' ) ) . value ) . toBe ( '~ 30s' )
148+ } )
149+ } )
150+ }
0 commit comments