#!/usr/bin/env node
/**
* Real-browser pass over the event AFTER the load simulation has filled it.
*
* `event-sim.mjs` drives the HTTP API directly — deliberately, because 150 real
* browsers would bottleneck the test box rather than the server. That leaves two
* things unmeasured, and both are guest-visible:
*
* 1. The SvelteKit frontend container, which the API driver never touches.
* 2. Whether the frontend ESCAPES the XSS caption the API stored verbatim. The
* backend stores captions raw by design (`upload.rs` length-checks only), so
* the entire defence is the renderer. The abuse suite proved the payload is
* in the database; only a browser can prove it is inert.
*
* Runs three real engines against the loaded gallery and reports load timings,
* console errors, and the XSS verdict.
*
* node e2e/loadtest/browser-check.mjs
*/
import { chromium, firefox, webkit, devices } from '@playwright/test';
import { writeFile, mkdir } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
const __dirname = dirname(fileURLToPath(import.meta.url));
const BASE = process.env.SIM_BASE ?? 'http://localhost:3102';
const API = `${BASE}/api/v1`;
const OUT = join(__dirname, 'results', 'browser');
const XSS_CAPTION = '
';
const XSS_MARKERS = ['