From 202b827d8b7b3f1b8c07d229b33a5ee01081027a Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Wed, 25 Mar 2026 19:28:55 +0100 Subject: [PATCH] Remove e2e folder --- .github/workflows/build.yml | 2 +- .gitignore | 10 ++--- README.md | 32 +++++++-------- test.sh | 2 +- tests/build.spec.js | 53 +++++++++++++++++++++++++ tests/{e2e => }/global-setup.js | 0 tests/{e2e => }/helpers/assets.js | 0 tests/{e2e => }/helpers/mock-device.js | 0 tests/{e2e => }/helpers/paths.js | 4 +- tests/{e2e => }/helpers/tar.js | 0 tests/{e2e => }/integration.spec.js | 54 -------------------------- tests/{e2e => }/package-lock.json | 0 tests/{e2e => }/package.json | 0 tests/{e2e => }/playwright.config.js | 2 +- tests/{e2e => }/run-e2e.sh | 2 +- tests/{e2e => }/run-screenshots.sh | 2 +- tests/{e2e => }/screenshots.config.js | 0 tests/{e2e => }/screenshots.mjs | 0 18 files changed, 81 insertions(+), 82 deletions(-) create mode 100644 tests/build.spec.js rename tests/{e2e => }/global-setup.js (100%) rename tests/{e2e => }/helpers/assets.js (100%) rename tests/{e2e => }/helpers/mock-device.js (100%) rename tests/{e2e => }/helpers/paths.js (85%) rename tests/{e2e => }/helpers/tar.js (100%) rename tests/{e2e => }/integration.spec.js (95%) rename tests/{e2e => }/package-lock.json (100%) rename tests/{e2e => }/package.json (100%) rename tests/{e2e => }/playwright.config.js (82%) rename tests/{e2e => }/run-e2e.sh (98%) rename tests/{e2e => }/run-screenshots.sh (88%) rename tests/{e2e => }/screenshots.config.js (100%) rename tests/{e2e => }/screenshots.mjs (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8debb6d..8acf968 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,5 +92,5 @@ jobs: - name: Full integration test (Playwright) if: steps.check-e2e.outputs.run == 'true' && env.GITEA_ACTIONS != 'true' run: | - cd tests/e2e + cd tests ./run-e2e.sh diff --git a/.gitignore b/.gitignore index 449034a..eeae3c5 100644 --- a/.gitignore +++ b/.gitignore @@ -33,11 +33,11 @@ electron/release/ tests/cached_assets/ # E2E tests -tests/e2e/node_modules/ -tests/e2e/test-results/ -tests/e2e/playwright-report/ -tests/e2e/screenshots/ -tests/e2e/test_firmware.zip +tests/node_modules/ +tests/test-results/ +tests/playwright-report/ +tests/screenshots/ +tests/test_firmware.zip # NickelMenu build artifacts nickelmenu/kobo-config/ diff --git a/README.md b/README.md index 3108a54..97fafc1 100644 --- a/README.md +++ b/README.md @@ -114,19 +114,19 @@ kobopatch-wasm/ tests/ cached_assets/ # Downloaded test assets (gitignored) - e2e/ - helpers/ # Shared test utilities - assets.js # Asset availability checks, firmware symlink helpers - mock-device.js # Mock File System Access API (simulated Kobo device) - paths.js # Test asset paths, expected checksums - tar.js # Tar archive parser for output verification - integration.spec.js # Playwright E2E tests - playwright.config.js # Parallel by default; serial when --headed or --slow - global-setup.js # Creates firmware symlink once before all tests - run-e2e.sh - screenshots.mjs # Captures screenshots of every wizard step - screenshots.config.js # Mobile + desktop project config for screenshots - run-screenshots.sh # Runs screenshot capture + helpers/ # Shared test utilities + assets.js # Asset availability checks, firmware symlink helpers + mock-device.js # Mock File System Access API (simulated Kobo device) + paths.js # Test asset paths, expected checksums + tar.js # Tar archive parser for output verification + build.spec.js # Build output verification tests + integration.spec.js # Playwright E2E tests + playwright.config.js # Parallel by default; serial when --headed or --slow + global-setup.js # Creates firmware symlink once before all tests + run-e2e.sh + screenshots.mjs # Captures screenshots of every wizard step + screenshots.config.js # Mobile + desktop project config for screenshots + run-screenshots.sh # Runs screenshot capture # Root scripts test.sh # Runs all tests (WASM + E2E) @@ -262,7 +262,7 @@ The simulated device tests mock the File System Access API with an in-memory fil Custom patches tests use firmware 4.45.23646 (~150 MB, cached in `tests/cached_assets/`), enable a single patch, and verify SHA1 checksums of all 4 patched binaries. This specific combination is used because the author has tested it on an actual device. KOReader tests use a real KOReader zip (~39 MB, also cached) to verify the full installation flow. ```bash -cd tests/e2e +cd tests ./run-e2e.sh ``` @@ -291,11 +291,11 @@ Extra Playwright arguments can be passed after `--`: Capture screenshots of every wizard step for visual review (mobile + desktop): ```bash -cd tests/e2e +cd tests ./run-screenshots.sh ``` -Output is saved to `tests/e2e/screenshots/mobile/` and `tests/e2e/screenshots/desktop/` (gitignored). The script uses a separate Playwright config (`screenshots.config.js`) with two projects: mobile (393×852, 3× DPI) and desktop (1280×900, 3× DPI). Screenshots cover the full wizard flow including device connection, mode selection, NickelMenu configuration, custom patches, error states, dialogs, and the feedback widget. +Output is saved to `tests/screenshots/mobile/` and `tests/screenshots/desktop/` (gitignored). The script uses a separate Playwright config (`screenshots.config.js`) with two projects: mobile (393×852, 3× DPI) and desktop (1280×900, 3× DPI). Screenshots cover the full wizard flow including device connection, mode selection, NickelMenu configuration, custom patches, error states, dialogs, and the feedback widget. ### WASM integration test diff --git a/test.sh b/test.sh index d6ccb0a..5247d46 100755 --- a/test.sh +++ b/test.sh @@ -88,7 +88,7 @@ fi echo "" echo "=== Running E2E tests (Playwright) ===" -cd "$SCRIPT_DIR/tests/e2e" +cd "$SCRIPT_DIR/tests" if [ ! -d "node_modules" ]; then npm install npx playwright install --with-deps diff --git a/tests/build.spec.js b/tests/build.spec.js new file mode 100644 index 0000000..0e946eb --- /dev/null +++ b/tests/build.spec.js @@ -0,0 +1,53 @@ +// @ts-check +const { test, expect } = require('@playwright/test'); +const fs = require('fs'); +const path = require('path'); + +const distDir = path.join(__dirname, '..', 'web', 'dist'); + +test.describe('Build output', () => { + test('CSS cache-bust hash is present on style.css link', async () => { + const html = fs.readFileSync(path.join(distDir, 'index.html'), 'utf-8'); + expect(html).toMatch(/css\/style\.css\?h=[0-9a-f]{8}/); + }); + + test('JS cache-bust hash is present on bundle.js script', async () => { + const html = fs.readFileSync(path.join(distDir, 'index.html'), 'utf-8'); + expect(html).toMatch(/bundle\.js\?h=[0-9a-f]{8}/); + }); + + test('critical CSS is inlined with :root tokens', async () => { + const html = fs.readFileSync(path.join(distDir, 'index.html'), 'utf-8'); + // :root block should be inside an inline