Modified test script and minor commenting changes. Testing still not accurate due to Axios bug though.

This commit is contained in:
00Fjongl 2024-07-10 20:27:23 -05:00
parent 13c2f6c6e7
commit 9e01004564
3 changed files with 17 additions and 10 deletions

19
test.js
View file

@ -104,17 +104,24 @@ async function testCommonJSOnPage() {
async function testUltraviolet() {
await page.goto("http://localhost:8080/?q");
// Wait for the service worker to be active
await page.waitForFunction(
() => navigator.serviceWorker.controller !== null
);
const testResults = await page.evaluate(async () => {
const results = {};
await new Promise((resolve) => {
const waitForDocument = () => document.readyState === "complete"
? resolve()
: window.addEventListener("load", resolve);
// Wait until a service worker is registered before continuing.
// Also make sure the document is loaded.
const waitForWorker = async () => setTimeout(async () => (await navigator.serviceWorker.getRegistrations()).length >= 1 ? waitForDocument() : waitForWorker(), 1000);
waitForWorker();
});
if (window.goProx && window.goProx.ultraviolet) {
try {
const generatedUrl = await window.goProx.ultraviolet(
const generatedUrl = window.goProx.ultraviolet(
"example.com",
false
);