Files
Stirling-PDF/frontend/editor/playwright.config.ts
T
0a50e765b7 Restructure/frontend editor (#6404)
## Move editor under `frontend/editor/`

Pure restructure: `frontend/` becomes the workspace, `frontend/editor/`
holds
  the PDF editor. 1775 file renames + 40 wiring edits. No logic changes.

  ### Why

`frontend/` is currently the editor — its `src/`, `public/`,
`src-tauri/`,
  config files all sit at the root. Promoting `frontend/` to a
workspace and putting the editor in a sibling folder leaves room for
future
apps to drop in alongside it, sharing one `package.json` /
`node_modules` /
  lint config / Storybook.

  ### What moves

  frontend/
  ├── editor/                ← NEW: everything editor-specific
  │   ├── src/               ← was frontend/src/
  │   ├── public/            ← was frontend/public/
  │   ├── src-tauri/         ← was frontend/src-tauri/
│ ├── index.html, vite.config.ts, vitest.config.ts, playwright.config.ts
  │   ├── tsconfig*.json, tailwind.config.js, postcss.config.js
  │   ├── scripts/
  │   ├── .env, .env.desktop, .env.saas
  │   └── DeveloperGuide.md
├── package.json, package-lock.json, node_modules/ ← workspace install
  ├── eslint.config.mjs, .prettierrc, .prettierignore ← shared tooling
  ├── .gitignore
  └── README.md

  ### Wiring edits (40 files)

  - `.taskfiles/frontend.yml`, `desktop.yml`, `e2e.yml`
  - `build.gradle`, `app/core/build.gradle`
- `eslint.config.mjs`, `frontend/package.json`, `.gitignore`,
`.prettierignore`
  - `docker/frontend/Dockerfile`
  - 8 `.github/workflows/*.yml`, plus `.github/dependabot.yml`,
    `.github/config/.files.yaml`, `.github/labeler-config-srvaroa.yml`
  - `scripts/translations/**`
- Docs: `AGENTS.md`, `CLAUDE.md`, `ADDING_TOOLS.md`,
`DeveloperGuide.md`,
`WINDOWS_SIGNING.md`, `devGuide/HowToAddNewLanguage.md`,
`frontend/README.md`,
    `frontend/editor/DeveloperGuide.md`

Plus 3 renamed + edited: `editor/vite.config.ts` (env path +
node_modules
  walk-up), `editor/scripts/setup-env.mts` (renamed from `.ts` for
`import.meta.url`), `editor/scripts/build-provisioner.mjs` (resolve
src-tauri
  relative to script).

  ### Verification

  | Check | Result |
  |---|---|
  | `task frontend:typecheck:all` (6 variants) | exit 0 |
  | `task frontend:lint` (eslint + dpdm) | exit 0 |
  | `task frontend:format:check` | exit 0 |
  | `task frontend:test` | 657 tests pass, 50 files |
| `task frontend:build:{core,proprietary,saas,desktop,prototypes}` | all
green |
| `task desktop:build` | full Tauri pipeline →
`Stirling-PDF_2.11.0_x64_en-US.msi` |
  | `playwright test --list --project=stubbed` | 172 tests discovered |

`task desktop:build` exercises the heaviest path — Rust + WiX + MSI
bundle
against the moved `editor/src-tauri/`. If anything in the restructure
was
  wrong it wouldn't have built.

  ### Test plan

  - [ ] `frontend-validation.yml` green
  - [ ] `e2e-stubbed.yml` green
  - [ ] `tauri-build.yml` green on at least one platform
  - [ ] `check_toml.yml` runs on a translation-touching PR

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-22 13:40:34 +01:00

111 lines
3.3 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
/**
* Stirling-PDF E2E Test Configuration
*
* The suite is split into two projects:
* - `stubbed` — backend-free specs that mock `/api/v1/*` via `page.route()`.
* Safe to run in CI without the Spring Boot server. Lives in
* `src/core/tests/stubbed/**`.
* - `live` — specs that require a real backend on `localhost:8080`
* (auth, admin mutation, real tool round-trips). Lives in
* `src/core/tests/live/**`.
*
* Run one:
* npx playwright test --project=stubbed
* npx playwright test --project=live
*
* @see https://playwright.dev/docs/test-configuration
*/
const chromiumViewport = {
...devices["Desktop Chrome"],
viewport: { width: 1920, height: 1080 },
};
export default defineConfig({
testDir: "./src/core/tests",
testMatch: "**/*.spec.ts",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : "50%",
reporter: [["html", { open: "never" }], ["list"]],
timeout: 60_000,
expect: { timeout: 10_000 },
use: {
baseURL: "http://localhost:5173",
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "on-first-retry",
actionTimeout: 10_000,
navigationTimeout: 30_000,
},
projects: [
// Stubbed — no backend required, chromium-only for CI speed
{
name: "stubbed",
testDir: "./src/core/tests/stubbed",
use: chromiumViewport,
},
// Live setup — runs once before the live suite to perform the real
// forced-password-change first-login flow against a freshly-booted
// backend. The live project depends on it.
{
name: "live-setup",
testDir: "./src/core/tests/live-setup",
testMatch: /.*\.setup\.ts$/,
use: chromiumViewport,
},
// Live backend — auth + admin-mutation + real-tool smoke
{
name: "live",
testDir: "./src/core/tests/live",
use: chromiumViewport,
dependencies: ["live-setup"],
},
// Enterprise — license-gated SSO/SAML/audit/teams against keycloak compose
// Uses port 8080 directly (the docker compose stack publishes the
// backend's built-in frontend there); the Vite dev server is bypassed
// because the OAuth/SAML callback URLs are registered against 8080.
{
name: "enterprise",
testDir: "./src/core/tests/enterprise",
use: {
...chromiumViewport,
baseURL: "http://localhost:8080",
},
},
// Cross-browser coverage for the stubbed suite (opt-in locally)
{
name: "stubbed-firefox",
testDir: "./src/core/tests/stubbed",
use: { ...devices["Desktop Firefox"] },
},
{
name: "stubbed-webkit",
testDir: "./src/core/tests/stubbed",
use: { ...devices["Desktop Safari"] },
},
],
webServer: {
// In CI, serve a pre-built `dist/` via `vite preview` so the heavy tool
// pages don't pay vite's on-demand transform cost on first hit (which
// blew the 30s navigationTimeout under --workers=3 — see
// all-tool-pages-load.spec.ts). Locally, keep `vite` dev for HMR.
command: process.env.CI
? "npx vite preview --port 5173 --strictPort"
: "npx vite",
url: "http://localhost:5173",
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});