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:
@@ -1,7 +1,12 @@
|
||||
import {createRequire} from 'node:module';
|
||||
// Native windows: an empty-tab transfer opens a window that acknowledges the saved tab, and the settings window's theme export rejects invalid JSON.
|
||||
// Start a debug app with the isolated identifier com.runestone.spelling-test, a workspace open, and remote debugging on port 9224:
|
||||
// set WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9224
|
||||
// pnpm tauri dev --config "{\"identifier\":\"com.runestone.spelling-test\"}"
|
||||
// Run `node tests/native/tabTransferAndThemeExport.native.mjs`. NATIVE_CDP_URL (or the older SPELLING_CDP_URL) overrides http://127.0.0.1:9224.
|
||||
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');
|
||||
import { playwright } from '../smoke/_harness/index.mjs';
|
||||
const {chromium}=playwright();
|
||||
const browser=await chromium.connectOverCDP(process.env.NATIVE_CDP_URL || 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.');
|
||||
|
||||
Reference in New Issue
Block a user