@@ -202,72 +202,76 @@ describe('Application launch', () => {
202
202
} ) ;
203
203
204
204
it ( 'should have @@INIT action on Redux DevTools' , async ( ) => {
205
- expect (
206
- await mainWindow . textContent ( '//div[contains(@class, "actionListRows-")]' )
207
- ) . toMatch ( / @ @ r e d u x \/ I N I T / ) ; // Last store is `RemoteDev store instance 1`
205
+ const el = await mainWindow . locator ( 'div' ) . filter ( { hasText : '@@redux/INIT' } ) . first ( ) ;
206
+ expect ( await el . isVisible ( ) ) . toBeTruthy ( ) ; // Last store is `RemoteDev store instance 1`
208
207
} ) ;
209
208
210
209
let currentInstance = 'Autoselect instances' ; // Default instance
211
210
const wait = ( ) => delay ( 750 ) ;
212
211
const selectInstance = async ( instance ) => {
213
- await mainWindow . click ( `//div[text()="${ currentInstance } "]` ) ;
212
+ let el = mainWindow . locator ( `//div[text()="${ currentInstance } "]` ) ;
213
+ expect ( await el . isVisible ( ) ) . toBeTruthy ( ) ;
214
+ await el . click ( { force : true } ) ;
214
215
await wait ( ) ;
215
216
currentInstance = instance ;
216
- await mainWindow . click ( `//div[text()="${ instance } "]` ) ;
217
+ el = mainWindow . locator ( `//div[text()="${ instance } "]` ) ;
218
+ expect ( await el . isVisible ( ) ) . toBeTruthy ( ) ;
219
+ await el . click ( { force : true } ) ;
217
220
await wait ( ) ;
218
221
} ;
219
222
const commit = async ( ) => {
220
- await mainWindow . click ( '//div [text()="Commit"]' ) ;
223
+ await mainWindow . click ( '//button [text()="Commit"]' , { force : true } ) ;
221
224
await wait ( ) ;
222
225
} ;
223
226
224
227
const expectActions = {
225
228
'Redux store instance 1' : {
226
229
expt : [
227
- / @ @ I N I T / ,
228
- / T E S T _ P A S S _ F O R _ R E D U X _ S T O R E _ 1 / ,
229
- / S H O W _ F O R _ R E D U X _ S T O R E _ 1 / ,
230
+ ' @@INIT' ,
231
+ ' TEST_PASS_FOR_REDUX_STORE_1' ,
232
+ ' SHOW_FOR_REDUX_STORE_1' ,
230
233
] ,
231
- notExpt : [ / N O T _ S H O W _ F O R _ R E D U X _ S T O R E _ 1 / , / T E S T _ P A S S _ F O R _ R E D U X _ S T O R E _ 2 / ] ,
234
+ notExpt : [ ' NOT_SHOW_FOR_REDUX_STORE_1' , ' TEST_PASS_FOR_REDUX_STORE_2' ] ,
232
235
} ,
233
236
'Redux store instance 2' : {
234
- expt : [ / @ @ I N I T / , / T E S T _ P A S S _ F O R _ R E D U X _ S T O R E _ 2 / ] ,
237
+ expt : [ ' @@INIT' , ' TEST_PASS_FOR_REDUX_STORE_2' ] ,
235
238
notExpt : [
236
- / T E S T _ P A S S _ F O R _ R E D U X _ S T O R E _ 1 / ,
237
- / N O T _ S H O W _ 1 _ F O R _ R E D U X _ S T O R E _ 2 / ,
238
- / N O T _ S H O W _ 2 _ F O R _ R E D U X _ S T O R E _ 2 / ,
239
- / N O T _ S H O W _ 3 _ F O R _ R E D U X _ S T O R E _ 2 / ,
239
+ ' TEST_PASS_FOR_REDUX_STORE_1' ,
240
+ ' NOT_SHOW_1_FOR_REDUX_STORE_2' ,
241
+ ' NOT_SHOW_2_FOR_REDUX_STORE_2' ,
242
+ ' NOT_SHOW_3_FOR_REDUX_STORE_2' ,
240
243
] ,
241
244
} ,
242
245
'MobX store instance 1' : {
243
- expt : [ / @ @ I N I T / , / t e s t P a s s F o r M o b X S t o r e 1 / ] ,
244
- notExpt : [ / T E S T _ P A S S _ F O R _ R E D U X _ S T O R E _ 2 / ] ,
246
+ expt : [ ' @@INIT' , ' testPassForMobXStore1' ] ,
247
+ notExpt : [ ' TEST_PASS_FOR_REDUX_STORE_2' ] ,
245
248
} ,
246
249
'MobX store instance 2' : {
247
- expt : [ / @ @ I N I T / , / t e s t P a s s F o r M o b X S t o r e 2 / ] ,
248
- notExpt : [ / t e s t P a s s F o r M o b X S t o r e 1 / ] ,
250
+ expt : [ ' @@INIT' , ' testPassForMobXStore2' ] ,
251
+ notExpt : [ ' testPassForMobXStore1' ] ,
249
252
} ,
250
253
'RemoteDev store instance 1' : {
251
- expt : [ / @ @ r e d u x \ /I N I T / , / T E S T _ P A S S _ F O R _ R E M O T E D E V _ S T O R E _ 1 / ] ,
252
- notExpt : [ / t e s t P a s s F o r M o b X S t o r e 2 / ] ,
254
+ expt : [ ' @@redux/INIT' , ' TEST_PASS_FOR_REMOTEDEV_STORE_1' ] ,
255
+ notExpt : [ ' testPassForMobXStore2' ] ,
253
256
} ,
254
257
} ;
255
258
256
- const runExpectActions = ( name , val ) => {
259
+ const runExpectActions = async ( name ) => {
257
260
const { expt, notExpt } = expectActions [ name ] ;
258
261
259
262
for ( const action of expt ) {
260
- expect ( val ) . toMatch ( action ) ;
263
+ const el = await mainWindow . locator ( 'div' ) . filter ( { hasText : action } ) . first ( ) ;
264
+ expect ( await el . isVisible ( ) ) . toBeTruthy ( ) ;
261
265
}
262
266
for ( const action of notExpt ) {
263
- expect ( val ) . not . toMatch ( action ) ;
267
+ const el = await mainWindow . locator ( 'div' ) . filter ( { hasText : action } ) . first ( ) ;
268
+ expect ( await el . isVisible ( ) ) . toBeFalsy ( ) ;
264
269
}
265
270
} ;
266
271
267
272
const checkInstance = async ( name ) => {
268
273
await selectInstance ( name ) ;
269
- const val = await mainWindow . textContent ( '//div[contains(@class, "actionListRows-")]' ) ;
270
- runExpectActions ( name , val ) ;
274
+ await runExpectActions ( name ) ;
271
275
await commit ( ) ;
272
276
} ;
273
277
0 commit comments