@@ -202,72 +202,76 @@ describe('Application launch', () => {
202202 } ) ;
203203
204204 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`
208207 } ) ;
209208
210209 let currentInstance = 'Autoselect instances' ; // Default instance
211210 const wait = ( ) => delay ( 750 ) ;
212211 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 } ) ;
214215 await wait ( ) ;
215216 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 } ) ;
217220 await wait ( ) ;
218221 } ;
219222 const commit = async ( ) => {
220- await mainWindow . click ( '//div [text()="Commit"]' ) ;
223+ await mainWindow . click ( '//button [text()="Commit"]' , { force : true } ) ;
221224 await wait ( ) ;
222225 } ;
223226
224227 const expectActions = {
225228 'Redux store instance 1' : {
226229 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' ,
230233 ] ,
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' ] ,
232235 } ,
233236 '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' ] ,
235238 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' ,
240243 ] ,
241244 } ,
242245 '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' ] ,
245248 } ,
246249 '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' ] ,
249252 } ,
250253 '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' ] ,
253256 } ,
254257 } ;
255258
256- const runExpectActions = ( name , val ) => {
259+ const runExpectActions = async ( name ) => {
257260 const { expt, notExpt } = expectActions [ name ] ;
258261
259262 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 ( ) ;
261265 }
262266 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 ( ) ;
264269 }
265270 } ;
266271
267272 const checkInstance = async ( name ) => {
268273 await selectInstance ( name ) ;
269- const val = await mainWindow . textContent ( '//div[contains(@class, "actionListRows-")]' ) ;
270- runExpectActions ( name , val ) ;
274+ await runExpectActions ( name ) ;
271275 await commit ( ) ;
272276 } ;
273277
0 commit comments