Skip to content

Commit

Permalink
Test: fix tests
Browse files Browse the repository at this point in the history
Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Attempt to fix tests

Test: Investigate error message

Test: Attempt to fix tests

Chore: Cleanup code

Test: Attempt to fix tests

Test: Attempt to fix tests
  • Loading branch information
chakflying committed Nov 17, 2021
1 parent df813fb commit 7f4d5a0
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
33 changes: 33 additions & 0 deletions config/jest-debug-env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const PuppeteerEnvironment = require("jest-environment-puppeteer");
const util = require("util");

class DebugEnv extends PuppeteerEnvironment {
async handleTestEvent(event, state) {
const ignoredEvents = [
"setup",
"add_hook",
"start_describe_definition",
"add_test",
"finish_describe_definition",
"run_start",
"run_describe_start",
"test_start",
"hook_start",
"hook_success",
"test_fn_start",
"test_fn_success",
"test_done",
"run_describe_finish",
"run_finish",
"teardown",
"test_fn_failure",
];
if (!ignoredEvents.includes(event.name)) {
console.log(
new Date().toString() + ` Unhandled event [${event.name}] ` + util.inspect(event)
);
}
}
}

module.exports = DebugEnv;
12 changes: 10 additions & 2 deletions config/jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
module.exports = {
"launch": {
"dumpio": true,
"slowMo": 500,
"headless": process.env.HEADLESS_TEST || false,
"userDataDir": "./data/test-chrome-profile",
args: [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-gpu",
"--disable-dev-shm-usage"
"--disable-dev-shm-usage",
"--no-default-browser-check",
"--no-experiments",
"--no-first-run",
"--no-pings",
"--no-sandbox",
"--no-zygote",
"--single-process",
],
}
};
1 change: 1 addition & 0 deletions config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
"__DEV__": true
},
"testRegex": "./test/e2e.spec.js",
"testEnvironment": "./config/jest-debug-env.js",
"rootDir": "..",
"testTimeout": 30000,
};
Expand Down
2 changes: 1 addition & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ exports.entryPage = "dashboard";

await updateMonitorNotification(bean.id, notificationIDList);

await startMonitor(socket.userID, bean.id);
await sendMonitorList(socket);
await startMonitor(socket.userID, bean.id);

callback({
ok: true,
Expand Down
6 changes: 6 additions & 0 deletions test/e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ describe("Init", () => {
await page.click("#url", { clickCount: 3 });
await page.keyboard.type(baseURL);
await page.keyboard.press("Enter");

await page.waitForFunction(() => {
const badge = document.querySelector("span.badge");
return badge && badge.innerText == "100%";
}, { timeout: 5000 });

});

// Settings Page
Expand Down

0 comments on commit 7f4d5a0

Please sign in to comment.