Move the smoke tests onto the shared harness

Each smoke test now uses tests/smoke/_harness/ for Playwright, the Tauri
IPC mock, the in-memory workspace, and output folders, instead of its
own copy. The tests keep their interactions and assertions. Mock
handlers that the app never calls are gone.

- Split the four mixed regression scripts into 18 feature tests.
- Update tests that broke when the app changed on purpose. Each update
  cites the app source that shows the new behavior.
- Mark two real app defects with @known-issue: the settings window
  controls are 1px shorter than the main window controls, and plugin
  tabs cannot be reordered by dragging without a workspace.
- Merge three palette unit tests into one table-driven test.
- The native tests load Playwright through the harness and read
  NATIVE_CDP_URL, with their old variable names as fallbacks.
- A failed smoke test saves a screenshot and prints the console errors.
- The runner runs failed tests once more, alone, and reports a test
  that then passes as flaky.

Result: 89 passed, 1 flaky, 2 known issues, 0 failed. Before, 45 of 78
passed.
This commit is contained in:
Knotty Wyvern
2026-10-27 20:58:55 -07:00
parent c66ea1ce83
commit 69f90df571
109 changed files with 5920 additions and 7915 deletions
+20 -4
View File
@@ -24,12 +24,21 @@ export function launchBrowser(options = {}) {
return playwright().chromium.launch({ headless: true, ...(executablePath ? { executablePath } : {}), ...options });
}
/** Open a page that collects uncaught page errors in `page.errors`. */
export async function openPage(target, { viewport = { width: 1440, height: 1000 }, timeout = 10000, ...options } = {}) {
const page = await target.newPage({ viewport, ...options });
/**
* Open a page that collects uncaught page errors in `page.errors`, and console errors and warnings in `page.console`.
* `target` is a browser or a browser context. A context page keeps the context viewport unless `viewport` is given.
*/
export async function openPage(target, { viewport, timeout = 10000, ...options } = {}) {
const isContext = typeof target.browser === "function";
const page = isContext ? await target.newPage() : await target.newPage({ viewport: viewport ?? { width: 1440, height: 1000 }, ...options });
if (isContext && viewport) await page.setViewportSize(viewport);
page.setDefaultTimeout(timeout);
page.errors = [];
page.console = [];
page.on("pageerror", error => page.errors.push(error.message));
page.on("console", message => {
if (["error", "warning"].includes(message.type())) page.console.push(`${message.type()}: ${message.text()}`);
});
return page;
}
@@ -170,17 +179,24 @@ function installMock(options, commands) {
/**
* Run one smoke test: start the browser, run `body`, fail on page errors, and close the browser.
* `body({ browser, page })` returns nothing. Set `allowPageErrors` for tests that expect page errors.
* On failure, the test saves `failure.png` in its output folder and prints the console errors and warnings.
*/
export async function runSmoke(name, body, { viewport, timeout, allowPageErrors = false } = {}) {
const browser = await launchBrowser();
let page;
try {
const page = await openPage(browser, { viewport, timeout });
page = await openPage(browser, { viewport, timeout });
await body({ browser, page });
if (!allowPageErrors && page.errors.length) throw new Error(`Page errors:\n${page.errors.join("\n")}`);
console.log(`PASS ${name}`);
} catch (error) {
console.error(`FAIL ${name}`);
console.error(error);
if (page) {
if (page.console.length) console.error(`Console:\n${page.console.join("\n")}`);
const file = path.join(await outputDir(name), "failure.png");
if (await page.screenshot({ path: file }).then(() => true, () => false)) console.error(`Screenshot: ${file}`);
}
process.exitCode = 1;
} finally {
await browser.close();