Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Jul 11, 2024
1 parent 27d9634 commit 13c2f6c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ async function testServerResponse() {
}

async function testCommonJSOnPage() {
const browser = await puppeteer.launch({ headless: true });
const browser = await puppeteer.launch({
args: ["--enable-features=NetworkService"],
headless: false,
ignoreHTTPSErrors: true,
});
const page = await browser.newPage();

try {
Expand Down Expand Up @@ -100,19 +104,22 @@ async function testCommonJSOnPage() {
async function testUltraviolet() {
await page.goto("http://localhost:8080/?q");

// Wait for the service workers and other scripts to load
await page.waitForFunction(() => {
return window.goProx && window.goProx.ultraviolet;
});
// Wait for the service worker to be active
await page.waitForFunction(
() => navigator.serviceWorker.controller !== null
);

const testResults = await page.evaluate(async () => {
const results = {};

if (window.goProx) {
if (window.goProx && window.goProx.ultraviolet) {
try {
const uvUrl = await window.goProx.ultraviolet("example.com", false);
console.log("Generated Ultraviolet URL:", uvUrl);
results.ultraviolet = uvUrl ? uvUrl : "failure";
const generatedUrl = await window.goProx.ultraviolet(
"example.com",
false
);
console.log("Generated Ultraviolet URL:", generatedUrl);
results.ultraviolet = generatedUrl ? generatedUrl : "failure";
} catch (e) {
results.ultraviolet = "failure: " + e.message;
}
Expand Down

0 comments on commit 13c2f6c

Please sign in to comment.