Files
collective-lists/apps/web/playwright.config.ts
Oier Bravo Urtasun cda7321d37 test(fase-9): WebKit project + swipe-toggle gesture specs
Closes 9.4 (swipe-delete E2E in WebKit — repurposed to the current
swipe-to-check / swipe-to-uncheck gesture, since Fase 5.10 replaced
swipe-to-delete with a double-tap delete flow).

- playwright.config.ts gains a second project named "webkit"
  (devices['iPhone 13']) gated behind RUN_WEBKIT=1 so the suite stays
  green on hosts that do not have the GTK/WebKit system libs
  (libicu74, libxml2, libmanette-0.2-0, libwoff1) installed — those
  need `sudo pnpm exec playwright install-deps`. The chromium project
  ignores `*.webkit.test.ts` so the same file never runs in both.
- Justfile adds `just playwright-install` (chromium + webkit) and
  `just test-webkit` for the on-demand run.
- New tests/e2e/swipe-toggle.webkit.test.ts contains SW-01 + SW-02:
  swipe right on an unchecked row marks it checked; swipe left on a
  checked row marks it unchecked. The handlers in lists/[id]/+page.svelte
  use unified pointer events, so the helper dispatches
  PointerEvent('pointer{down,move,up}') with pointerType:'touch'
  directly — works regardless of the project's hasTouch setting.
- lists/[id]/+page.svelte exposes data-checked and data-name on each
  item-row to give the specs a robust locator without depending on
  text/heading hierarchy.

Note: cannot validate the WebKit runs end-to-end in this sandbox
(missing libicu74/libwoff1 require sudo apt install). The spec is
ready to run under any CI image that has Playwright's standard
linux deps installed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 01:37:42 +02:00

67 lines
2.2 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
testDir: './tests/e2e',
globalSetup: './tests/fixtures/global-setup.ts',
fullyParallel: false, // sequential: sessions depend on shared Docker DB state
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: [['html', { open: 'never' }], ['list']],
use: {
// Playwright always talks to Vite over the loopback. The LAN IP
// variant in `.env` (PUBLIC_APP_URL) is for on-device phone previews
// and introduces extra routing latency that produces intermittent
// races in the OAuth → optimistic-write path; e2e needs to stay
// deterministic regardless of what the dev env has in PUBLIC_APP_URL.
baseURL: 'http://localhost:5173',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
// Load anon storage state by default; individual tests override as needed
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
// Skip WebKit-only specs (touch-gesture tests) — Chromium's
// touch emulation does not fire the touch* sequence the
// swipe handlers expect.
testIgnore: /.*\.webkit\.test\.ts/
},
// Fase 9.4: WebKit (Mobile Safari) project for touch-gesture
// tests. The previous swipe-to-delete tests were left .skip in
// mobile.test.ts because Chromium's touch emulation broke the
// gesture; that file was removed in Fase 5.10 when swipe was
// repurposed as a check-toggle. The replacement webkit specs
// live in `*.webkit.test.ts` and only run here.
//
// The WebKit binary needs system libs (libicu74, libwoff1,
// libmanette-0.2-0, libxml2 — install via
// `sudo pnpm exec playwright install-deps`). Hosts that don't
// have them can run the rest of the suite by leaving the env
// var unset; gated to keep `just test-all` green elsewhere.
...(process.env.RUN_WEBKIT === '1'
? [
{
name: 'webkit',
use: { ...devices['iPhone 13'] },
testMatch: /.*\.webkit\.test\.ts/
}
]
: [])
],
webServer: {
command: 'pnpm dev',
url: 'http://localhost:5173',
reuseExistingServer: true,
timeout: 120_000
}
});