@@ -9,13 +9,7 @@ async function performLogin(userName = 'admin', password = '1234') {
9
9
10
10
await browser . flutterByValueKey$ ( 'password_text_field' ) . clearValue ( ) ;
11
11
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 ( ) ;
19
13
}
20
14
21
15
async function openScreen ( screenTitle ) {
@@ -35,7 +29,7 @@ describe('My Login application', () => {
35
29
}
36
30
await browser . installApp ( process . env . APP_PATH ) ;
37
31
await browser . pause ( 2000 ) ;
38
- if ( await browser . isAppInstalled ( appID ) ) {
32
+ if ( await browser . isAppInstalled ( appID ) ) {
39
33
console . log ( 'App is installed' ) ;
40
34
await browser . execute ( 'flutter: launchApp' , {
41
35
appId : appID ,
@@ -49,7 +43,7 @@ describe('My Login application', () => {
49
43
await performLogin ( ) ;
50
44
await openScreen ( 'Double Tap' ) ;
51
45
const element = await browser
52
- . flutterBySemanticsLabel $( 'double_tap_button' )
46
+ . flutterByValueKey $( 'double_tap_button' )
53
47
. flutterByText$ ( 'Double Tap' ) ;
54
48
expect ( await element . getText ( ) ) . toEqual ( 'Double Tap' ) ;
55
49
await browser . flutterDoubleClick ( {
@@ -72,16 +66,16 @@ describe('My Login application', () => {
72
66
it ( 'Wait Test' , async ( ) => {
73
67
await performLogin ( ) ;
74
68
await openScreen ( 'Lazy Loading' ) ;
75
- const message = await browser . flutterBySemanticsLabel $( 'message_field' ) ;
69
+ const message = await browser . flutterByValueKey $( 'message_field' ) ;
76
70
expect ( await message . getText ( ) ) . toEqual ( 'Hello world' ) ;
77
- await browser . flutterBySemanticsLabel $( 'toggle_button' ) . click ( ) ;
71
+ await browser . flutterByValueKey $( 'toggle_button' ) . click ( ) ;
78
72
await browser . flutterWaitForAbsent ( { element : message , timeout : 10 } ) ;
79
73
expect (
80
74
await (
81
- await browser . flutterBySemanticsLabel $$( 'message_field' )
75
+ await browser . flutterByValueKey $$( 'message_field' )
82
76
) . length ,
83
77
) . toEqual ( 0 ) ;
84
- await browser . flutterBySemanticsLabel $( 'toggle_button' ) . click ( ) ;
78
+ await browser . flutterByValueKey $( 'toggle_button' ) . click ( ) ;
85
79
await browser . flutterWaitForVisible ( { element : message , timeout : 10 } ) ;
86
80
expect ( await message . getText ( ) ) . toEqual ( 'Hello world' ) ;
87
81
} ) ;
@@ -112,7 +106,7 @@ describe('My Login application', () => {
112
106
await performLogin ( ) ;
113
107
await openScreen ( 'Long Press' ) ;
114
108
const longPressElement =
115
- await browser . flutterBySemanticsLabel $( 'long_press_button' ) ;
109
+ await browser . flutterByValueKey $( 'long_press_button' ) ;
116
110
await browser . flutterLongPress ( { element : longPressElement } ) ;
117
111
const popUpText = await browser
118
112
. flutterByText$ ( 'It was a long press' )
@@ -218,8 +212,8 @@ describe('My Login application', () => {
218
212
it ( 'Drag and Drop' , async ( ) => {
219
213
await performLogin ( ) ;
220
214
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' ) ;
223
217
await browser . flutterDragAndDrop ( {
224
218
source : dragElement ,
225
219
target : dropElement ,
0 commit comments