Skip to content

Commit c6d9345

Browse files
author
veeck
committed
update test suite to allow checking for a state
1 parent 1c6cbbc commit c6d9345

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/electron/helpers/global-setup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ exports.stopApplication = async () => {
4949
process.env.MOCK_DATE = undefined;
5050
};
5151

52-
exports.getElement = async (selector) => {
52+
exports.getElement = async (selector, state = "visible") => {
5353
expect(global.page).not.toBeNull();
54-
let elem = global.page.locator(selector);
55-
await elem.waitFor();
54+
const elem = global.page.locator(selector);
55+
await elem.waitFor({ state: state });
5656
expect(elem).not.toBeNull();
5757
return elem;
5858
};

tests/electron/modules/compliments_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ describe("Compliments module", () => {
77
* @param {Array} complimentsArray The array of compliments.
88
* @returns {boolean} result
99
*/
10-
const doTest = async (complimentsArray) => {
11-
await helpers.getElement(".compliments");
12-
const elem = await helpers.getElement(".module-content");
10+
const doTest = async (complimentsArray, state = "visible") => {
11+
await helpers.getElement(".compliments", state);
12+
const elem = await helpers.getElement(".module-content", state);
1313
expect(elem).not.toBeNull();
1414
expect(complimentsArray).toContain(await elem.textContent());
1515
return true;

0 commit comments

Comments
 (0)