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
+12 -6
View File
@@ -1,10 +1,16 @@
import { createRequire } from 'node:module';
// Native built-in browser: page rendering at device pixel ratio, the page context menu, editing commands, and session checks.
// Start a debug app with an isolated identifier (com.runestone.browser-test or com.runestone.spelling-test) and remote debugging on port 9224:
// set WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9224
// pnpm tauri dev --config "{\"identifier\":\"com.runestone.browser-test\"}"
// The browser runtime needs `npm ci --prefix browser-runtime`. The test loads https://example.com/.
// Run `node tests/native/browser.native.mjs`. NATIVE_CDP_URL (or the older BROWSER_NATIVE_CDP) overrides http://127.0.0.1:9224.
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');
import { outputDir, playwright } from '../smoke/_harness/index.mjs';
const { chromium } = playwright();
const browser = await chromium.connectOverCDP(process.env.NATIVE_CDP_URL || process.env.BROWSER_NATIVE_CDP || 'http://127.0.0.1:9224');
const output = await outputDir('native/browser');
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');
@@ -46,8 +52,8 @@ try {
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: [
await page.screenshot({ path: path.join(output, 'acceptance.png') });
await writeFile(path.join(output, '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));