diff --git a/playwright.config.ts b/playwright.config.ts
index d9ef4f1e..001081a5 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -11,6 +11,7 @@ const config: PlaywrightTestConfig = {
reporter: 'list',
use: {
baseURL: 'http://demo.localhost:5173',
+ // baseURL: 'https://dev-demo.oneskyit.com',
trace: 'on-first-retry'
}
};
diff --git a/src/index.test.ts b/src/index.test.ts
deleted file mode 100644
index 701fbe0a..00000000
--- a/src/index.test.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { describe, it, expect } from 'vitest';
-
-describe('sum test', () => {
- it('adds 1 + 2 to equal 3', () => {
- expect(1 + 2).toBe(3);
- });
-});
diff --git a/src/routes/idaa/jitsi_reports/+page.svelte b/src/routes/idaa/jitsi_reports/+page.svelte
index 0e124a45..4b7aa6d9 100644
--- a/src/routes/idaa/jitsi_reports/+page.svelte
+++ b/src/routes/idaa/jitsi_reports/+page.svelte
@@ -47,7 +47,7 @@
diff --git a/tests/example.test.ts b/tests/example.test.ts
index 73f417d7..74be168a 100644
--- a/tests/example.test.ts
+++ b/tests/example.test.ts
@@ -2,6 +2,7 @@ import { test, expect } from '@playwright/test';
test('homepage has title and link', async ({ page }) => {
await page.goto('http://scott.localhost:5173/');
+ // await page.goto('https://dev-demo.oneskyit.com/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/SvelteKit/);
@@ -9,6 +10,7 @@ test('homepage has title and link', async ({ page }) => {
test('get started link', async ({ page }) => {
await page.goto('http://scott.localhost:5173/');
+ // await page.goto('https://dev-demo.oneskyit.com/');
// Click the get started link.
await page.getByRole('link', { name: 'Docs' }).click();
diff --git a/tests/private_network_cdp.test.ts b/tests/private_network_cdp.test.ts
new file mode 100644
index 00000000..25a75058
--- /dev/null
+++ b/tests/private_network_cdp.test.ts
@@ -0,0 +1,62 @@
+import { test, expect } from '@playwright/test';
+
+// This test attaches to the Chrome DevTools Protocol to capture low-level
+// network events (including those from service workers). Run this with the
+// real Chrome binary (channel: 'chrome') to reproduce the exact browser
+// behavior that shows the PNA prompt.
+
+test('CDP: detect private/local network requests and PNA preflights', async ({ page }) => {
+ const privateRequests: Array = [];
+
+ function isPrivateHostname(hostname: string) {
+ if (!hostname) return false;
+ if (hostname === 'localhost' || hostname.endsWith('.localhost')) return true;
+ if (/^(127)\.|^(10)\.|^(192\.168)\.|^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(hostname)) return true;
+ return false;
+ }
+
+ // Create a CDP session for the page to listen to Network events
+ const client = await page.context().newCDPSession(page);
+ await client.send('Network.enable');
+
+ client.on('Network.requestWillBeSent', (params) => {
+ try {
+ const url = params.request.url;
+ const hostname = new URL(url).hostname;
+ const headers = params.request.headers || {};
+ const pna = headers['access-control-request-private-network'] === 'true' || headers['Access-Control-Request-Private-Network'] === 'true';
+
+ if (isPrivateHostname(hostname) || pna) {
+ privateRequests.push({
+ url,
+ method: params.request.method,
+ initiator: params.initiator?.type,
+ pnaPreflight: pna,
+ headers
+ });
+ }
+ } catch (e) {}
+ });
+
+ // Also capture console messages to surface the same errors you see in Chrome.
+ const consoleMessages: string[] = [];
+ page.on('console', (msg) => {
+ consoleMessages.push(`${msg.type()}: ${msg.text()}`);
+ });
+
+ // Navigate to the site that triggers the behavior in your environment.
+ await page.goto('http://demo.localhost:5173/');
+ await page.waitForLoadState('networkidle');
+
+ if (privateRequests.length > 0) {
+ console.error('CDP detected private/local requests or PNA preflights:');
+ for (const r of privateRequests) console.error(JSON.stringify(r, null, 2));
+ }
+
+ if (consoleMessages.length) {
+ console.log('Captured console messages:');
+ consoleMessages.forEach((m) => console.log(m));
+ }
+
+ expect(privateRequests.length, 'No private/local network requests or PNA preflights should be made').toBe(0);
+});
diff --git a/tests/private_network_detection.test.ts b/tests/private_network_detection.test.ts
new file mode 100644
index 00000000..6a623dbd
--- /dev/null
+++ b/tests/private_network_detection.test.ts
@@ -0,0 +1,62 @@
+import { test, expect } from '@playwright/test';
+
+// Detect requests to private/local address space or PNA preflight headers.
+test('detect private/local network requests and PNA preflights', async ({ page }) => {
+ const privateRequests: Array = [];
+
+ function isPrivateHostname(hostname: string) {
+ if (!hostname) return false;
+ // hostnames that resolve to local addresses or explicitly localhost
+ if (hostname === 'localhost' || hostname.endsWith('.localhost')) return true;
+ // IPv4 private ranges
+ if (/^(127)\.|^(10)\.|^(192\.168)\.|^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(hostname)) return true;
+ return false;
+ }
+
+ page.on('request', (request) => {
+ try {
+ const url = new URL(request.url());
+ const headers = request.headers();
+ const hostname = url.hostname;
+
+ const pnaHeader = (headers['access-control-request-private-network'] || headers['Access-Control-Request-Private-Network']);
+
+ if (isPrivateHostname(hostname) || pnaHeader === 'true') {
+ privateRequests.push({
+ url: request.url(),
+ method: request.method(),
+ resourceType: request.resourceType(),
+ pnaPreflight: pnaHeader === 'true',
+ headers
+ });
+ }
+ } catch (e) {
+ // ignore parse errors
+ }
+ });
+
+ page.on('requestfailed', (r) => {
+ // capture failed requests that might be private and blocked
+ try {
+ const url = new URL(r.url());
+ if (isPrivateHostname(url.hostname)) {
+ privateRequests.push({ url: r.url(), method: r.method(), failure: r.failure() });
+ }
+ } catch (e) {}
+ });
+
+ // Navigate to the dev site used in other tests.
+ await page.goto('http://demo.localhost:5173/');
+
+ // Wait for network to settle.
+ await page.waitForLoadState('networkidle');
+
+ if (privateRequests.length > 0) {
+ console.error('Detected private/local requests or PNA preflights:');
+ for (const r of privateRequests) {
+ console.error(JSON.stringify(r, null, 2));
+ }
+ }
+
+ expect(privateRequests.length, 'No private/local network requests or PNA preflights should be made').toBe(0);
+});