Skip to content

Commit

Permalink
checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdesignory committed Dec 2, 2024
1 parent 240ef74 commit e57bffb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 14 additions & 1 deletion tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,20 @@
});
}

window.addEventListener("start-test", startTest);
let runnerReady = false;
let domReady = false;
function checkIn(type) {
if (type === "runner")
runnerReady = true;
else
domReady = true;

if (runnerReady && domReady)
startTest();
}

window.addEventListener("start-test", () => checkIn("runner"));
document.addEventListener('readystatechange', () => checkIn("dom"));
</script>
</body>
</html>
6 changes: 1 addition & 5 deletions tests/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ function printTree(node) {

async function test() {
driver = await new Builder().withCapabilities(capabilities).build();

try {
await driver.get(`http://localhost:${PORT}/tests/index.html`);
const result = await driver.executeAsyncScript(function (callback) {
Expand All @@ -108,10 +107,7 @@ async function test() {
}),
{ once: true }
);
document.addEventListener("readystatechange", () => {
if (document.readyState === "complete")
window.dispatchEvent(new Event("start-test"));
});
window.dispatchEvent(new Event("start-test"));
});

printTree(result.suite);
Expand Down

0 comments on commit e57bffb

Please sign in to comment.