Move the tests from scripts/ to tests/ by feature

Unit tests go to tests/unit/<area>/, browser smoke tests to
tests/smoke/<area>/, and tests against a running desktop app to
tests/native/. Files named after dates, work passes, or Kanban cards get
feature names, for example editorOctober12 -> editor/footnotes.

scripts/ keeps the build, release, and package tools. Plugin repositories
import scripts/packagePlugin.mjs, and the Terminal smoke test imports
scripts/pluginMocks.mjs, which now re-exports the harness copy.

The unit tests get their own type check (tests/tsconfig.json) with Node
types. pnpm check runs it after the app check. Add @types/node and fix
the three test mocks that it reported.
This commit is contained in:
Knotty Wyvern
2026-10-27 19:47:39 -07:00
parent 90d1940c73
commit e433bed28e
154 changed files with 269 additions and 227 deletions
+58
View File
@@ -0,0 +1,58 @@
import { createRequire } from 'node:module';
import path from 'node:path';
import assert from 'node:assert/strict';
import { writeFile } from 'node:fs/promises';
const require = createRequire(path.resolve('browser-runtime/package.json'));
const { chromium } = require('playwright');
const browser = await chromium.connectOverCDP(process.env.BROWSER_NATIVE_CDP || 'http://127.0.0.1:9224');
const page = browser.contexts()[0].pages()[0];
const raw = (command, args = {}) => page.evaluate(({ command, args }) => window.__TAURI_INTERNALS__.invoke(command, args), { command, args });
const profile = await raw('plugins_snapshot');
assert.ok(/[\\/]com\.runestone\.(?:browser|spelling)-test[\\/]plugins$/.test(profile.root), 'Native acceptance requires an isolated test profile.');
const session = await raw('browser_connect');
const request = (command, args = {}) => raw('browser_request', { command, args, session });
const initialTabs = (await request('state')).tabs.map(tab => tab.id);
let tabId;
try {
await page.keyboard.press('Control+t');
await page.getByRole('button', { name: 'Open browser', exact: true }).click();
const surface = page.getByRole('application', { name: 'Web page', exact: true }).last();
await page.locator('.browser[data-browser-state="ready"]').last().waitFor();
tabId = await page.locator('.browser[data-browser-state="ready"]').last().getAttribute('data-browser-tab');
const address = page.getByRole('textbox', { name: 'Address or search', exact: true }).last();
await address.fill('https://example.com/'); await address.press('Enter');
for (let attempt = 0; attempt < 60; attempt++) {
const snapshot = await request('agentSnapshot', { tabId });
if (snapshot.text.includes('documentation examples')) break;
if (attempt === 59) throw Error(`Public test page did not load: ${snapshot.text}`);
await page.waitForTimeout(250);
}
await page.waitForFunction(() => [...document.querySelectorAll('.surface img')].some(image => image.complete && image.naturalWidth > 0));
const dimensions = await surface.locator('img').evaluate(image => ({ width: image.naturalWidth, height: image.naturalHeight,
css: image.getBoundingClientRect().width, scale: devicePixelRatio, source: image.src.slice(0, 30) }));
assert.ok(dimensions.width >= dimensions.css * dimensions.scale - 2, JSON.stringify(dimensions));
const bounds = await surface.boundingBox();
await page.mouse.click(bounds.x + 20, bounds.y + 20, { button: 'right' });
const menu = page.getByRole('menu', { name: 'Browser page actions', exact: true });
await menu.waitFor();
assert.equal(await menu.getByRole('menuitem', { name: 'Reload', exact: true }).count(), 1);
await page.keyboard.press('Escape'); await menu.waitFor({ state: 'detached' });
await request('edit', { tabId, action: 'selectAll' });
await page.waitForTimeout(100);
await request('edit', { tabId, action: 'copy' });
await page.waitForTimeout(100);
await address.focus(); await page.keyboard.press('Control+a'); await page.keyboard.press('Control+v');
assert.match(await address.inputValue(), /documentation examples/);
await address.fill('https://example.com/');
await assert.rejects(raw('browser_request', { command: 'edit', args: { tabId, action: 'copy' }, session: 'invalid-session' }), /session/i);
await assert.rejects(request('contextAction', { tabId, token: 'stale-menu', action: 'saveImage' }), /no longer available/);
await page.screenshot({ path: 'output/browser-native-acceptance.png' });
await writeFile('output/browser-native-acceptance.json', JSON.stringify({ dimensions, passed: [
'Native Tauri-to-Electron page rendering and high-DPI frame delivery', 'Native page context event opens the shared host menu',
'Native editing commands copy real webpage text', 'Session and stale-menu checks reject invalid requests',
] }, null, 2));
console.log('PASS native browser transport, rendering, context menu, editing and session protection');
} finally {
if (tabId && !initialTabs.includes(tabId)) { await page.keyboard.press('Escape'); await page.keyboard.press('Control+w'); }
await browser.close();
}
+71
View File
@@ -0,0 +1,71 @@
// Use only an isolated com.runestone.spelling-test debug window.
import { createRequire } from 'node:module';
import { mkdir, writeFile } from 'node:fs/promises';
import assert from 'node:assert/strict';
const { chromium } = createRequire(import.meta.url)(process.env.PLAYWRIGHT_MODULE || 'playwright');
const browser = await chromium.connectOverCDP(process.env.SPELLING_CDP_URL || 'http://127.0.0.1:9237');
const page = browser.contexts()[0].pages()[0];
page.setDefaultTimeout(15000);
const captures = [];
try {
await page.waitForFunction(() => !!window.__TAURI_INTERNALS__);
await page.getByRole('button', { name: 'Settings (Ctrl+,)', exact: true }).waitFor();
const identity = await page.evaluate(async () => (await import('/node_modules/@tauri-apps/api/path.js')).appDataDir());
assert.match(identity, /[\\/]com\.runestone\.spelling-test[\\/]?$/);
await page.evaluate(async () => {
const { listen } = await import('/node_modules/@tauri-apps/api/event.js');
window.nativeMenuPayload = null;
await listen('spelling-menu', ({ payload }) => window.nativeMenuPayload = payload);
await (await import('/node_modules/@tauri-apps/api/core.js')).invoke('spelling_menu_install');
});
await mkdir('output/todo-menus', { recursive: true });
const menu = page.getByRole('menu', { name: 'Spelling actions', exact: true });
for (const mode of ['dark', 'light']) {
await page.evaluate(async mode => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); saveAppearance({ theme: 'default', mode }); }, mode);
for (const kind of ['input', 'textarea', 'dialog']) {
await page.evaluate(kind => {
document.getElementById('native-menu-field')?.remove(); document.getElementById('native-menu-dialog')?.remove();
const field = document.createElement(kind === 'input' ? 'input' : 'textarea');
field.id = 'native-menu-field'; field.spellcheck = true; field.value = 'I recieved a letter.';
field.style.cssText = 'position:fixed;left:100px;top:100px;width:500px;height:100px;font:16px/24px Arial;padding:10px;z-index:100';
if (kind === 'dialog') { const dialog = document.createElement('dialog'); dialog.id = 'native-menu-dialog'; dialog.append(field); document.body.append(dialog); dialog.showModal(); }
else document.body.append(field);
field.focus();
}, kind);
const field = page.locator('#native-menu-field');
await field.press('End');
await field.pressSequentially(' TEST');
await field.click({ button: 'right', position: { x: 300, y: kind === 'input' ? 50 : 22 } });
await menu.waitFor();
const payload = await page.evaluate(() => window.nativeMenuPayload);
captures.push({ mode, kind, value: await field.inputValue(), payload });
await writeFile('output/todo-menus/native-filtered-items.json', JSON.stringify(captures, null, 2));
const flatten = items => items.flatMap(item => [item, ...flatten(item.children)]);
const entries = flatten(payload.items);
assert.ok(entries.every(item => item.kind === 3 || !['share', 'writingDirection', 'voiceTyping', 'other'].includes(item.name)));
assert.ok(entries.some(item => item.name === 'undo' && item.enabled), mode + ' ' + kind + ' keeps native Undo enabled');
assert.ok(entries.some(item => item.name === 'emoji'));
assert.ok(entries.some(item => item.name === 'copy'));
assert.equal(await menu.getByRole('menuitem', { name: /More tools|Writing direction|Voice typing|Share/ }).count(), 0);
assert.equal(await menu.evaluate(node => getComputedStyle(node).borderColor), 'rgba(0, 0, 0, 0)');
if (kind === 'textarea') await page.screenshot({ path: `output/todo-menus/native-${mode}.png` });
await menu.getByRole('menuitem', { name: 'Undo Ctrl+Z', exact: true }).click();
await page.waitForFunction(() => document.getElementById('native-menu-field').value === 'I recieved a letter.').catch(async error => { console.error('Undo result', await field.inputValue()); throw error; });
await field.click({ button: 'right', position: { x: 48, y: kind === 'input' ? 50 : 22 } });
await menu.getByRole('menuitem', { name: 'received', exact: true }).click();
assert.equal(await field.inputValue(), 'I received a letter.');
await field.press('Control+z');
assert.equal(await field.inputValue(), 'I recieved a letter.');
await field.click({ button: 'right', position: { x: 48, y: kind === 'input' ? 50 : 22 } });
await menu.waitFor();
await page.keyboard.press('Escape');
assert.equal(await field.evaluate(node => document.activeElement === node), true);
}
}
await writeFile('output/todo-menus/native-filtered-items.json', JSON.stringify(captures, null, 2));
console.log('PASS: real WebView2 menus omit unsupported commands, retain editing and spelling, execute native Undo, correct spelling with undo, and restore focus in fields and dialogs in both themes.');
} finally {
await page.evaluate(() => { document.getElementById('native-menu-field')?.remove(); document.getElementById('native-menu-dialog')?.remove(); }).catch(() => {});
await browser.close();
}
+96
View File
@@ -0,0 +1,96 @@
// Use a debug app with TAURI_CONFIG identifier com.runestone.spelling-test,
// a hidden window, and a separate WEBVIEW2_USER_DATA_FOLDER outside Vite's watch paths.
// Set WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9224 before launch.
// The normal app identifier is rejected before this test writes any workspace files.
import { createRequire } from "node:module";
import { mkdir, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import assert from "node:assert/strict";
const require = createRequire(import.meta.url);
const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright");
const browser = await chromium.connectOverCDP(process.env.SPELLING_CDP_URL || "http://127.0.0.1:9224");
const page = browser.contexts()[0].pages()[0];
page.setDefaultTimeout(15000);
try {
await page.goto(process.env.SPELLING_APP_URL || "http://localhost:1420");
const data = await page.evaluate(async () => {
const { appDataDir } = await import("/node_modules/@tauri-apps/api/path.js");
return appDataDir();
});
assert.match(data, /[\\/]com\.runestone\.spelling-test[\\/]?$/, "Use the isolated spelling-test app identifier");
const workspace = resolve(process.env.SPELLING_WORKSPACE || ".audit/spelling-workspace");
await mkdir(workspace, { recursive: true });
await writeFile(resolve(workspace, "Spelling.md"), "# Spelling\n\nI recieved a letter.\n");
await page.evaluate(async path => {
const { invoke } = await import("/node_modules/@tauri-apps/api/core.js");
await invoke("workspace_open", { path });
}, workspace);
await page.reload();
await page.locator('[data-tree-rel="Spelling.md"]').click();
const editor = page.locator(".cm-content");
await editor.waitFor();
const line = page.getByText("I recieved a letter.", { exact: true });
const rect = await line.boundingBox();
await line.click();
const before = await editor.innerText();
await page.keyboard.press("End");
await page.keyboard.type(" TEST");
const typed = await editor.innerText();
assert.notEqual(typed, before);
await page.mouse.click(rect.x + 42, rect.y + rect.height / 2, { button: "right" });
const menu = page.getByRole("menu", { name: "Spelling actions", exact: true });
await menu.waitFor();
await mkdir(".audit", { recursive: true });
await page.screenshot({ path: ".audit/spelling-native.png" });
const undo = menu.getByRole("menuitem", { name: "Undo Ctrl+Z", exact: true });
assert.equal(await undo.isEnabled(), true, "The native Undo command is enabled after typing");
await undo.click();
await page.waitForFunction(previous => document.querySelector(".cm-content")?.innerText !== previous, typed);
const remaining = (await editor.innerText()).match(/^I recieved a letter\.(.*)$/m)?.[1];
assert.ok(remaining !== undefined && remaining.length < " TEST".length && " TEST".startsWith(remaining), "Native Undo reduces the appended text and preserves the original paragraph");
// WebView2 and CodeMirror can group typing differently. Restore the fixture through editor history.
for (let attempt = 0; attempt < 8 && await editor.innerText() !== before; attempt++) {
await page.keyboard.press("Control+z");
await page.evaluate(() => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))));
}
assert.equal(await editor.innerText(), before, "Bounded keyboard Undo restores the exact original editor text");
console.log("PASS: real WebView2 Undo reduces the typed text, and bounded editor Undo restores the fixture.");
await page.mouse.click(rect.x + 42, rect.y + rect.height / 2, { button: "right" });
await menu.waitFor();
const suggestion = menu.getByRole("menuitem", { name: "received", exact: true });
if (await suggestion.count()) {
await suggestion.click();
await page.waitForFunction(() => document.querySelector(".cm-content")?.innerText.includes("I received a letter."));
await page.keyboard.press("Control+z");
await page.waitForFunction(() => document.querySelector(".cm-content")?.innerText.includes("I recieved a letter."));
console.log("PASS: native spelling correction and editor undo.");
} else {
await page.keyboard.press("Escape");
assert.notEqual(process.env.REQUIRE_NATIVE_SUGGESTIONS, "1", "The test WebView2 profile supplied no spelling suggestions");
console.log("SKIP: native spelling correction. This WebView2 profile supplied no suggestions. Desktop acceptance is still required.");
}
for (const kind of ["input", "textarea", "dialog"]) {
await page.evaluate(kind => {
const field = document.createElement(kind === "input" ? "input" : "textarea");
field.id = "native-spelling-field"; field.spellcheck = true;
field.value = "I recieved a letter.";
field.style.cssText = "position:fixed;left:250px;top:200px;width:500px;height:100px;font:16px/24px Arial;padding:10px;z-index:100";
if (kind === "dialog") { const dialog = document.createElement("dialog"); dialog.id = "native-spelling-dialog"; dialog.append(field); document.body.append(dialog); dialog.showModal(); }
else document.body.append(field);
field.focus();
}, kind);
const field = page.locator("#native-spelling-field"), box = await field.boundingBox();
await page.mouse.click(box.x + 48, box.y + (kind === "input" ? box.height / 2 : 22), { button: "right" });
await menu.getByRole("menuitem", { name: "received", exact: true }).click();
assert.equal(await field.inputValue(), "I received a letter.", kind + " corrects the clicked word");
await page.keyboard.press("Control+z");
assert.equal(await field.inputValue(), "I recieved a letter.", kind + " retains undo");
await page.evaluate(() => { document.getElementById("native-spelling-field")?.remove(); document.getElementById("native-spelling-dialog")?.remove(); });
}
console.log("PASS: native spelling corrections and undo in inputs, card textareas, and top-layer dialogs.");
} finally {
await page.keyboard.press("Escape").catch(() => {});
await browser.close();
}
@@ -0,0 +1,44 @@
import {createRequire} from 'node:module';
import assert from 'node:assert/strict';
const {chromium}=createRequire(import.meta.url)(process.env.PLAYWRIGHT_MODULE || 'playwright');
const browser=await chromium.connectOverCDP(process.env.SPELLING_CDP_URL || 'http://127.0.0.1:9224');
const context=browser.contexts()[0];
const page=context.pages().find(page => new URL(page.url()).pathname === '/' && !new URL(page.url()).search);
assert.ok(page, 'The isolated main window must be open.');
let transferred, settings;
try {
const identity=await page.evaluate(async()=> (await import('/node_modules/@tauri-apps/api/path.js')).appDataDir());
assert.match(identity, /[\\/]com\.runestone\.spelling-test[\\/]?$/);
const pending=context.waitForEvent('page');
const token=await page.evaluate(async()=>{
const {invoke}=await import('/node_modules/@tauri-apps/api/core.js');
const root=await invoke('workspace_last_path');
const token=crypto.randomUUID(), id=crypto.randomUUID();
localStorage.setItem('runestone.tab-transfer.'+token,JSON.stringify({root,created:Date.now(),reading:false,buffer:{id,relPath:'empty:'+id,name:'New tab',kind:'empty',imageUrl:null,contents:'',saved:'',chrome:'Writing',chromeOverride:null}}));
await invoke('workspace_open_window',{path:root,transfer:token});
return token;
});
transferred=await pending;
await transferred.locator('.empty').waitFor();
assert.ok(transferred.url().includes('?tabTransfer='+token));
assert.ok(!transferred.url().includes('index.html'));
assert.equal(await transferred.getByText('404',{exact:true}).count(),0);
await page.waitForFunction(token=>localStorage.getItem('runestone.tab-transfer.'+token+'.accepted') === 'true',token);
console.log('PASS: native empty-tab transfer loads the splash screen and acknowledges its saved tab state.');
await transferred.evaluate(async()=> (await import('/node_modules/@tauri-apps/api/window.js')).getCurrentWindow().close()); transferred=undefined;
settings=context.pages().find(page => page.url().includes('settingsWindow=true'));
const next=settings ? Promise.resolve(settings) : context.waitForEvent('page');
await page.evaluate(async()=> (await import('/node_modules/@tauri-apps/api/core.js')).invoke('settings_open_window'));
settings=await next;
await settings.waitForURL(/settingsWindow=true/);
await settings.waitForLoadState('domcontentloaded');
const error=await settings.evaluate(async()=>{
try { await (await import('/node_modules/@tauri-apps/api/core.js')).invoke('theme_export',{contents:'{',defaultName:'test.json'}); }
catch(error) { return String(error); }
});
assert.equal(error,'The theme contains invalid JSON.');
console.log('PASS: the native settings window can call theme export; invalid JSON stops before the save dialog.');
} finally {
for(const target of [transferred,settings]) if(target&&!target.isClosed()) await target.evaluate(async()=> (await import('/node_modules/@tauri-apps/api/window.js')).getCurrentWindow().close()).catch(()=>{});
await browser.close();
}
+100
View File
@@ -0,0 +1,100 @@
import { createRequire } from 'node:module';
import assert from 'node:assert/strict';
import { mkdir, writeFile } from 'node:fs/promises';
import { resolve, join } from 'node:path';
import { tmpdir } from 'node:os';
const { chromium } = createRequire(import.meta.url)(process.env.PLAYWRIGHT_MODULE || 'playwright');
const browser = await chromium.connectOverCDP(process.env.NAVIGATION_NATIVE_CDP || 'http://127.0.0.1:9236');
const context = browser.contexts()[0];
const page = context.pages().find(page => new URL(page.url()).pathname === '/' && !new URL(page.url()).search);
assert.ok(page, 'The isolated main window must be open.');
page.setDefaultTimeout(20000);
const output = resolve('output/host-navigation-pass3-native');
const workspace = join(tmpdir(), 'runestone-pass3-native-workspace');
const results = {};
let detached;
try {
const identity = await page.evaluate(async () => (await import('/node_modules/@tauri-apps/api/path.js')).appDataDir());
assert.match(identity, /[\\/]com\.runestone\.pass3-test[\\/]?$/);
results.identity = identity;
await mkdir(output, { recursive: true });
await mkdir(join(workspace, 'folder', 'nested'), { recursive: true });
await mkdir(join(workspace, 'other'), { recursive: true });
await writeFile(join(workspace, 'folder', 'nested', 'note.md'), '# Native note\n\nText for transfer.\n');
await writeFile(join(workspace, 'other', 'keep.md'), '# Keep');
await page.evaluate(async path => {
await (await import('/node_modules/@tauri-apps/api/core.js')).invoke('workspace_open', { path });
localStorage.setItem('runestone.workbenchLayout', JSON.stringify({ leftOpen: true, rightOpen: true, leftWidth: 260, rightWidth: 240, leftView: 'files' }));
}, workspace);
await page.reload();
const row = path => page.locator(`[data-tree-rel="${path}"]`);
await row('folder').click(); await row('folder/nested').click(); await row('other').click();
await row('folder/nested/note.md').click({ button: 'right' });
await page.getByRole('menuitem', { name: 'Rename', exact: true }).click();
await page.locator('.tree input').fill('renamed.md'); await page.locator('.tree input').press('Enter');
await row('folder/nested/renamed.md').waitFor();
await row('folder/nested/renamed.md').focus(); await page.keyboard.press('Control+z');
await row('folder/nested/note.md').waitFor();
for (const path of ['folder', 'folder/nested', 'other']) assert.equal(await row(path).getAttribute('aria-expanded'), 'true');
results.renameUndoPreservesExpandedFolders = true;
await row('folder/nested/note.md').click();
await page.getByRole('tab', { name: /note.md/ }).waitFor();
await page.getByText('Text for transfer.', { exact: true }).waitFor();
const savedLayout = await page.evaluate(() => localStorage.getItem('runestone.workbenchLayout'));
const pending = context.waitForEvent('page');
await page.getByRole('tab', { name: /note.md/ }).click({ button: 'right' });
await page.getByRole('menuitem', { name: 'Open in new window', exact: true }).click();
detached = await pending;
await detached.getByRole('tab', { name: /note.md/ }).waitFor();
await detached.evaluate(async () => (await import('/node_modules/@tauri-apps/api/window.js')).getCurrentWindow().minimize());
await detached.getByText('Text for transfer.', { exact: true }).waitFor();
assert.ok(detached.url().includes('tabTransfer='));
assert.equal(await detached.locator('.shell.left-open,.shell.right-open').count(), 0);
await page.getByRole('tab', { name: /note.md/ }).waitFor({ state: 'detached' });
const sourceClosed = await page.getByRole('tab', { name: /note.md/ }).count() === 0;
await detached.getByRole('button', { name: 'Show outline', exact: true }).click();
assert.equal(await page.evaluate(() => localStorage.getItem('runestone.workbenchLayout')), savedLayout);
await detached.getByRole('button', { name: 'Hide outline', exact: true }).click();
results.nativeTransfer = { sourceClosed, columnsHidden: true, savedLayoutPreserved: true };
for (const mode of ['light', 'dark']) {
await detached.evaluate(async mode => { const { saveAppearance } = await import('/src/lib/theme/appearance.ts'); saveAppearance({ theme: 'default', mode }); }, mode);
await detached.screenshot({ path: join(output, `detached-${mode}.png`) });
}
results.imageJsonIpc = await page.evaluate(async () => {
const { invoke } = await import('/node_modules/@tauri-apps/api/core.js');
const bytes = 50 * 1024 * 1024;
const pixel = Uint8Array.from(atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jM1sAAAAASUVORK5CYII='), char => char.charCodeAt(0));
const blob = new Blob([pixel, new Uint8Array(bytes - pixel.length)], { type: 'image/png' });
const data = await new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(blob); });
const contents = JSON.stringify({ schema: 1, data });
const start = performance.now();
await invoke('workspace_write', { rel: '.runestone/pm/images/native-50mib.json', contents });
const written = performance.now();
const read = await invoke('workspace_read', { rel: '.runestone/pm/images/native-50mib.json' });
return { bytes, jsonLength: contents.length, matches: read === contents, writeMs: Math.round(written - start), readMs: Math.round(performance.now() - written) };
});
assert.equal(results.imageJsonIpc.matches, true);
await page.goto('http://127.0.0.1:5186/?settingsWindow=true');
await page.getByRole('button', { name: 'Appearance', exact: true }).click();
const pixel = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jM1sAAAAASUVORK5CYII=', 'base64');
const largeImage = Buffer.concat([pixel, Buffer.alloc(1_900_000 - pixel.length)]);
await page.getByLabel('Background image file', { exact: true }).setInputFiles({ name: 'native-large.png', mimeType: 'image/png', buffer: largeImage });
await page.waitForFunction(() => !!JSON.parse(localStorage.getItem('runestone.appearance'))?.newTabBackground?.imageId);
await page.goto('http://127.0.0.1:5186/');
await page.locator('.empty').waitFor();
await page.waitForFunction(() => getComputedStyle(document.querySelector('.empty')).backgroundImage.includes('blob:'));
await page.reload(); await page.locator('.empty').waitFor();
await page.waitForFunction(() => getComputedStyle(document.querySelector('.empty')).backgroundImage.includes('blob:'));
results.largeBackground = { bytes: largeImage.length, renderedAfterReload: true };
await page.screenshot({ path: join(output, 'large-background.png') });
await writeFile(join(output, 'results.json'), JSON.stringify(results, null, 2));
console.log(JSON.stringify(results));
} catch (error) {
await writeFile(join(output, 'partial-results.json'), JSON.stringify(results, null, 2));
console.error({ error: String(error), main: await page.locator('body').innerText().catch(() => ''), detached: detached && !detached.isClosed() ? await detached.locator('body').innerText().catch(() => '') : null });
throw error;
} finally {
if (detached && !detached.isClosed()) await detached.evaluate(async () => (await import('/node_modules/@tauri-apps/api/window.js')).getCurrentWindow().destroy()).catch(() => {});
await browser.close();
}