@@ -9,13 +9,7 @@ async function performLogin(userName = 'admin', password = '1234') {
99
1010 await browser . flutterByValueKey$ ( 'password_text_field' ) . clearValue ( ) ;
1111 await browser . flutterByValueKey$ ( 'password' ) . addValue ( password ) ;
12- expect (
13- await browser
14- . flutterByType$ ( 'ElevatedButton' )
15- . flutterByType$ ( 'Text' )
16- . getText ( ) ,
17- ) . toEqual ( 'Login' ) ;
18- await browser . flutterByType$ ( 'ElevatedButton' ) . click ( ) ;
12+ await browser . flutterByValueKey$ ( 'LoginButton' ) . click ( ) ;
1913}
2014
2115async function openScreen ( screenTitle ) {
@@ -35,7 +29,7 @@ describe('My Login application', () => {
3529 }
3630 await browser . installApp ( process . env . APP_PATH ) ;
3731 await browser . pause ( 2000 ) ;
38- if ( await browser . isAppInstalled ( appID ) ) {
32+ if ( await browser . isAppInstalled ( appID ) ) {
3933 console . log ( 'App is installed' ) ;
4034 await browser . execute ( 'flutter: launchApp' , {
4135 appId : appID ,
@@ -49,7 +43,7 @@ describe('My Login application', () => {
4943 await performLogin ( ) ;
5044 await openScreen ( 'Double Tap' ) ;
5145 const element = await browser
52- . flutterBySemanticsLabel $( 'double_tap_button' )
46+ . flutterByValueKey $( 'double_tap_button' )
5347 . flutterByText$ ( 'Double Tap' ) ;
5448 expect ( await element . getText ( ) ) . toEqual ( 'Double Tap' ) ;
5549 await browser . flutterDoubleClick ( {
@@ -72,16 +66,16 @@ describe('My Login application', () => {
7266 it ( 'Wait Test' , async ( ) => {
7367 await performLogin ( ) ;
7468 await openScreen ( 'Lazy Loading' ) ;
75- const message = await browser . flutterBySemanticsLabel $( 'message_field' ) ;
69+ const message = await browser . flutterByValueKey $( 'message_field' ) ;
7670 expect ( await message . getText ( ) ) . toEqual ( 'Hello world' ) ;
77- await browser . flutterBySemanticsLabel $( 'toggle_button' ) . click ( ) ;
71+ await browser . flutterByValueKey $( 'toggle_button' ) . click ( ) ;
7872 await browser . flutterWaitForAbsent ( { element : message , timeout : 10 } ) ;
7973 expect (
8074 await (
81- await browser . flutterBySemanticsLabel $$( 'message_field' )
75+ await browser . flutterByValueKey $$( 'message_field' )
8276 ) . length ,
8377 ) . toEqual ( 0 ) ;
84- await browser . flutterBySemanticsLabel $( 'toggle_button' ) . click ( ) ;
78+ await browser . flutterByValueKey $( 'toggle_button' ) . click ( ) ;
8579 await browser . flutterWaitForVisible ( { element : message , timeout : 10 } ) ;
8680 expect ( await message . getText ( ) ) . toEqual ( 'Hello world' ) ;
8781 } ) ;
@@ -112,7 +106,7 @@ describe('My Login application', () => {
112106 await performLogin ( ) ;
113107 await openScreen ( 'Long Press' ) ;
114108 const longPressElement =
115- await browser . flutterBySemanticsLabel $( 'long_press_button' ) ;
109+ await browser . flutterByValueKey $( 'long_press_button' ) ;
116110 await browser . flutterLongPress ( { element : longPressElement } ) ;
117111 const popUpText = await browser
118112 . flutterByText$ ( 'It was a long press' )
@@ -218,8 +212,8 @@ describe('My Login application', () => {
218212 it ( 'Drag and Drop' , async ( ) => {
219213 await performLogin ( ) ;
220214 await openScreen ( 'Drag & Drop' ) ;
221- const dragElement = await browser . flutterBySemanticsLabel $( 'drag_me' ) ;
222- const dropElement = await browser . flutterBySemanticsLabel $( 'drop_zone' ) ;
215+ const dragElement = await browser . flutterByValueKey $( 'drag_me' ) ;
216+ const dropElement = await browser . flutterByValueKey $( 'drop_zone' ) ;
223217 await browser . flutterDragAndDrop ( {
224218 source : dragElement ,
225219 target : dropElement ,
0 commit comments