Skip to content

Commit ce1879e

Browse files
committed
Update E2E tests
1 parent b22c364 commit ce1879e

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

__e2e__/app.spec.js

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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(/@@redux\/INIT/); // 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-
/@@INIT/,
228-
/TEST_PASS_FOR_REDUX_STORE_1/,
229-
/SHOW_FOR_REDUX_STORE_1/,
230+
'@@INIT',
231+
'TEST_PASS_FOR_REDUX_STORE_1',
232+
'SHOW_FOR_REDUX_STORE_1',
230233
],
231-
notExpt: [/NOT_SHOW_FOR_REDUX_STORE_1/, /TEST_PASS_FOR_REDUX_STORE_2/],
234+
notExpt: ['NOT_SHOW_FOR_REDUX_STORE_1', 'TEST_PASS_FOR_REDUX_STORE_2'],
232235
},
233236
'Redux store instance 2': {
234-
expt: [/@@INIT/, /TEST_PASS_FOR_REDUX_STORE_2/],
237+
expt: ['@@INIT', 'TEST_PASS_FOR_REDUX_STORE_2'],
235238
notExpt: [
236-
/TEST_PASS_FOR_REDUX_STORE_1/,
237-
/NOT_SHOW_1_FOR_REDUX_STORE_2/,
238-
/NOT_SHOW_2_FOR_REDUX_STORE_2/,
239-
/NOT_SHOW_3_FOR_REDUX_STORE_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: [/@@INIT/, /testPassForMobXStore1/],
244-
notExpt: [/TEST_PASS_FOR_REDUX_STORE_2/],
246+
expt: ['@@INIT', 'testPassForMobXStore1'],
247+
notExpt: ['TEST_PASS_FOR_REDUX_STORE_2'],
245248
},
246249
'MobX store instance 2': {
247-
expt: [/@@INIT/, /testPassForMobXStore2/],
248-
notExpt: [/testPassForMobXStore1/],
250+
expt: ['@@INIT', 'testPassForMobXStore2'],
251+
notExpt: ['testPassForMobXStore1'],
249252
},
250253
'RemoteDev store instance 1': {
251-
expt: [/@@redux\/INIT/, /TEST_PASS_FOR_REMOTEDEV_STORE_1/],
252-
notExpt: [/testPassForMobXStore2/],
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

Comments
 (0)