forked from akai/readest
28a7785e5d
* feat(e2e): add Playwright web e2e lane Adds a web-layer end-to-end suite that drives the Next.js web build (`pnpm dev-web`) in a real browser, complementing the existing WebdriverIO suite that drives the Tauri shell. - playwright.config.ts: single Chromium project, auto-starts dev-web - e2e/pages: BasePage/LibraryPage/ReaderPage page objects - e2e/fixtures/base.ts: suppresses demo-book auto-import for a deterministic empty library - e2e/tests: library shell + search, book import, reader open + pagination smoke specs - e2e/fixtures/books: synthetic sample book for import tests - scripts: test:e2e:web, test:e2e:web:ui, test:e2e:web:report Tests run unauthenticated against isolated browser contexts; authenticated/sync flows are out of scope until a test account is provisioned. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(e2e): cover reading and annotation flows Expands the Playwright web e2e lane beyond library/import smoke tests to exercise the major reading and annotation features against the real sample-alice.epub fixture (src/__tests__/fixtures/data/). Reading (reading.spec.ts): open + page turn, TOC chapter navigation, in-book search, font-size change via the settings dialog, bookmark toggle. Annotation (annotation.spec.ts): selection popup, create highlight, change highlight color, add a note, delete an annotation. - ReaderPage POM gains sidebar/TOC, search, settings, bookmark and annotation actions; text selection is driven inside the section iframe (synthetic drags do not produce a selection through nested paginated foliate iframes) - openBook fixture imports and opens a book so specs skip boilerplate - books.ts centralises fixture book paths - replaces the old reader.spec.ts smoke Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(e2e): add headed run script and always write HTML report - test:e2e:web:headed runs the suite in a visible browser, one test at a time, with traces captured - the HTML reporter now runs for local runs too, so every run writes playwright-report/ for test:e2e:web:report to open Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(e2e): fix headed-run flakes in reading and annotation specs The headed run (slower rendering) surfaced two races that the headless run happened to pass: - TOC navigation read reading progress before the section's async progress update landed — now polls with expect.poll. - visibleSectionFrame required a paragraph fully inside the viewport, which intermittently matched nothing — now accepts any paragraph intersecting the viewport and tolerates frames detaching mid-navigation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci: run the Playwright web e2e suite in test_web_app Adds `pnpm test:e2e:web` to the test_web_app job, after the unit/browser tests. The job already installs the Chromium browser, and `.env.web` is committed so the auto-started `pnpm dev-web` server has its config. On failure the HTML report is uploaded as an artifact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(e2e): exclude e2e specs from the vitest run vitest's default glob matches `*.spec.ts`, so it picked up the new Playwright `e2e/tests/*.spec.ts` files and crashed. Exclude `e2e/` from vitest — those specs run via `pnpm test:e2e:web`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci(e2e): run the web e2e suite against a production build `next dev` renders a full-screen error overlay when the app emits its `next-view-transitions` "Transition was aborted" unhandled rejection, and the overlay intercepts pointer events — making the suite flaky on CI. CI now builds the web app (`pnpm build-web`) and the Playwright webServer serves it via `pnpm start-web`; local runs still use `pnpm dev-web`. Verified: 14/14 pass against the production build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci(e2e): run the web e2e suite in the build_web_app job build_web_app already runs `pnpm build-web`, so the e2e suite belongs there — it reuses that build (the CI Playwright webServer serves it via `pnpm start-web`) instead of building a second time in test_web_app. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(e2e): run the web e2e suite with 4 workers Specs are isolated (a fresh browser context per test), so they are safe to parallelize. `test:e2e:web:headed` keeps --workers=1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
223 lines
6.5 KiB
YAML
223 lines
6.5 KiB
YAML
name: PR checks
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
jobs:
|
|
rust_lint:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTFLAGS: '-C target-cpu=skylake'
|
|
SCCACHE_GHA_ENABLED: 'true'
|
|
RUSTC_WRAPPER: sccache
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: 'true'
|
|
- name: setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.10
|
|
- name: Install minimal stable with clippy and rustfmt
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Cache apt packages
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: /var/cache/apt/archives
|
|
key: apt-rust-lint-${{ runner.os }}
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y pkg-config libfontconfig-dev libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libsoup-3.0-dev
|
|
- name: Format check
|
|
working-directory: apps/readest-app/src-tauri
|
|
run: cargo fmt --check
|
|
- name: Clippy Check
|
|
working-directory: apps/readest-app/src-tauri
|
|
run: cargo clippy -p Readest --no-deps -- -D warnings
|
|
|
|
build_web_app:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: cache Next.js build
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: apps/readest-app/.next/cache
|
|
key: nextjs-web-${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
nextjs-web-${{ github.sha }}-
|
|
nextjs-web-
|
|
|
|
- name: install Dependencies
|
|
working-directory: apps/readest-app
|
|
run: |
|
|
pnpm install && pnpm setup-vendors
|
|
|
|
- name: install LuaJIT (for koplugin lint)
|
|
run: sudo apt-get update && sudo apt-get install -y luajit
|
|
|
|
- name: run format check
|
|
run: |
|
|
pnpm format:check || (pnpm format && git diff && exit 1)
|
|
|
|
- name: run lint
|
|
working-directory: apps/readest-app
|
|
run: |
|
|
pnpm lint
|
|
|
|
- name: build the web app
|
|
working-directory: apps/readest-app
|
|
run: |
|
|
pnpm build-web && pnpm check:all
|
|
|
|
- name: install playwright browsers
|
|
working-directory: apps/readest-app
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
- name: run web e2e tests
|
|
id: web_e2e
|
|
working-directory: apps/readest-app
|
|
run: pnpm test:e2e:web
|
|
|
|
- name: upload e2e report
|
|
if: ${{ failure() && steps.web_e2e.outcome == 'failure' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: apps/readest-app/playwright-report/
|
|
retention-days: 7
|
|
|
|
test_web_app:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: cache Next.js build
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: apps/readest-app/.next/cache
|
|
key: nextjs-test-${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
nextjs-test-${{ github.sha }}-
|
|
nextjs-test-
|
|
|
|
- name: install Dependencies
|
|
working-directory: apps/readest-app
|
|
run: |
|
|
pnpm install && pnpm setup-vendors
|
|
|
|
- name: install LuaJIT + busted (for koplugin tests)
|
|
run: |
|
|
sudo apt-get update
|
|
# luajit — pnpm test:lua
|
|
# luarocks/libsqlite3-dev — required to build lsqlite3complete
|
|
sudo apt-get install -y luajit luarocks libsqlite3-dev
|
|
# Install busted + the SQLite binding the LibraryStore specs use,
|
|
# both pinned to Lua 5.1 (LuaJIT-compatible). System-wide install
|
|
# so `luarocks --lua-version=5.1 path` (sourced by
|
|
# scripts/test-koplugin.mjs) picks them up.
|
|
sudo luarocks --lua-version=5.1 install busted
|
|
sudo luarocks --lua-version=5.1 install lsqlite3complete
|
|
|
|
- name: install playwright browsers
|
|
working-directory: apps/readest-app
|
|
run: npx playwright install --with-deps chromium
|
|
|
|
- name: run web tests
|
|
working-directory: apps/readest-app
|
|
run: pnpm test:pr:web
|
|
|
|
- name: run koplugin tests
|
|
working-directory: apps/readest-app
|
|
run: pnpm test:lua
|
|
|
|
build_tauri_app:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
SCCACHE_GHA_ENABLED: 'true'
|
|
RUSTC_WRAPPER: sccache
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: setup node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: cache Next.js build
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: apps/readest-app/.next/cache
|
|
key: nextjs-tauri-${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
nextjs-tauri-${{ github.sha }}-
|
|
nextjs-tauri-
|
|
|
|
- name: install Dependencies
|
|
working-directory: apps/readest-app
|
|
run: |
|
|
pnpm install && pnpm setup-vendors
|
|
|
|
- name: setup sccache
|
|
uses: mozilla-actions/sccache-action@v0.0.10
|
|
|
|
- name: install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: tauri-cargo
|
|
cache-all-crates: 'true'
|
|
|
|
- name: Cache apt packages
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: /var/cache/apt/archives
|
|
key: apt-tauri-${{ runner.os }}
|
|
- name: install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y pkg-config libfontconfig-dev libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libsoup-3.0-dev xvfb
|
|
|
|
- name: run tauri tests
|
|
working-directory: apps/readest-app
|
|
run: xvfb-run pnpm test:pr:tauri
|