1
0

Add more integration tests
All checks were successful
Build and test project / build-and-test (push) Successful in 1m46s

This commit is contained in:
2026-03-17 18:38:54 +01:00
parent 26c2d21fb3
commit dbd2f391bd
9 changed files with 850 additions and 268 deletions

View File

@@ -1,17 +1,41 @@
#!/bin/bash
set -euo pipefail
# E2E integration test: runs the full manual-mode patching flow in a browser
# and verifies SHA1 checksums of the patched binaries.
# E2E integration test: runs the full UI flows in a browser
# and verifies correct behavior for NickelMenu and custom patches.
#
# Usage: ./run-e2e.sh
# Usage: ./run-e2e.sh [--headed] [-- <extra playwright args>]
#
# Options:
# --headed Run with a visible browser window
#
# Prerequisites:
# - kobopatch.wasm built (run kobopatch-wasm/build.sh first)
# - Firmware zip cached at kobopatch-wasm/testdata/ (downloaded automatically)
# - NickelMenu assets in web/public/nickelmenu/ (set up automatically)
cd "$(dirname "$0")"
PLAYWRIGHT_ARGS=("--reporter=list")
while [[ $# -gt 0 ]]; do
case "$1" in
--headed)
PLAYWRIGHT_ARGS+=("--headed")
shift
;;
--)
shift
PLAYWRIGHT_ARGS+=("$@")
break
;;
*)
PLAYWRIGHT_ARGS+=("$1")
shift
;;
esac
done
FIRMWARE_VERSION="4.45.23646"
FIRMWARE_URL="https://ereaderfiles.kobo.com/firmwares/kobo13/Mar2026/kobo-update-${FIRMWARE_VERSION}.zip"
FIRMWARE_DIR="../../kobopatch-wasm/testdata"
@@ -23,6 +47,13 @@ if [ ! -f "../../web/public/wasm/kobopatch.wasm" ]; then
exit 1
fi
# Set up NickelMenu assets if not present.
NM_DIR="../../web/public/nickelmenu"
if [ ! -f "$NM_DIR/NickelMenu.zip" ] || [ ! -f "$NM_DIR/kobo-config.zip" ]; then
echo "Setting up NickelMenu assets..."
../../nickelmenu/setup.sh
fi
# Download firmware if not cached.
if [ ! -f "$FIRMWARE_FILE" ]; then
echo "Downloading firmware ${FIRMWARE_VERSION} (~150MB)..."
@@ -43,7 +74,7 @@ fi
npm install --silent
npx playwright install chromium --with-deps 2>/dev/null || npx playwright install chromium
# Run the test.
echo "Running E2E integration test..."
# Run the tests.
echo "Running E2E integration tests..."
FIRMWARE_ZIP="$(cd ../.. && pwd)/kobopatch-wasm/testdata/kobo-update-${FIRMWARE_VERSION}.zip" \
npx playwright test --reporter=list
npx playwright test "${PLAYWRIGHT_ARGS[@]}"