GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CarmenSoftware-organization/carmen-frontend-e2e

BranchesTags
Open more actions menu

Latest commit

 

History

930 Commits
930 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.cursor
.cursor
 
 
.gemini
.gemini
 
 
.github
.github
 
 
.kiro
.kiro
 
 
.trail
.trail
 
 
certs
certs
 
 
docs
docs
 
 
sample_seed_data
sample_seed_data
 
 
scripts
scripts
 
 
tests
tests
 
 
unit
unit
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
.ignore
.ignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
GEMINI.md
GEMINI.md
 
 
README.md
README.md
 
 
bun.lock
bun.lock
 
 
bunfig.toml
bunfig.toml
 
 
e2e_test.md
e2e_test.md
 
 
lefthook.yml
lefthook.yml
 
 
opencode.json
opencode.json
 
 
package.json
package.json
 
 
playwright.baseline.config.ts
playwright.baseline.config.ts
 
 
playwright.config.ts
playwright.config.ts
 
 
tsconfig.json
tsconfig.json
 
 
vitest.config.ts
vitest.config.ts
 
 

Repository files navigation

carmen-frontend-e2e

Playwright end-to-end test suite for the carmen-frontend Vite SPA.

The frontend lives in a sibling directory (../carmen-frontend). This repo contains only tests, page objects, fixtures, and a CSV-to-Google-Sheets reporter — no application code.

Quickstart

bun install
bun run install-browsers    # one-time: installs Chromium
bun run test                # runs the full suite (boots the frontend via Playwright webServer)

bun run test will spawn bun dev in ../carmen-frontend (Vite dev server, serves on :3000). To test against an already running frontend (e.g. staging) set:

export E2E_NO_WEBSERVER=1
export E2E_BASE_URL=https://your-host.example.com
bun run test

See .env.example for all environment variables.

Running subsets

bun run test:login              # 001-login.spec.ts only (TC-LOGIN-010001..010030)
bun run test:chromium           # everything except login (auto-runs the setup project first)
bun run test:ui                 # Playwright UI mode
bun run test:headed             # headed browser
bun run test:debug              # step-through debugger
bunx playwright test currency   # single spec (substring match against filename)
bunx playwright test -g "TC-LOGIN-010001"  # single test by title
bun run report                  # open last HTML report

Scripts reference

Command Description
bun run test / e2e / test:dev / e2e:dev playwright test — full suite (boots the frontend via webServer)
bun run test:ui / e2e:ui Playwright UI mode
bun run test:headed / e2e:headed Headed browser
bun run test:debug / e2e:debug Step-through debugger
bun run test:login / e2e:login Only the login project (001-login.spec.ts)
bun run test:chromium / e2e:chromium Only the chromium project (runs setup first)
bun run data:reset --yes --bu <code|all> Rebuild the standard dataset on one TEST BU or all three (TEST_BUS). Run --bu all before the first doc-flow run; the cost cases read live state, so re-runs need no reset. See scripts/data-reset/README.md
bun run test:uat / e2e:uat Run against .env.uat via scripts/run-env.ts
bun run test:prod / e2e:prod Run against .env.prod via scripts/run-env.ts
bun run test:period-close Opt-in period-close phases (9xx-period-close-*.spec.ts) on a TEST BU — needs E2E_PERIOD_BU + E2E_DB_URL (run order: scripts/data-reset/README.md)
bun run test:unit Vitest unit tests (unit/)
bun run test:unit:coverage Vitest with coverage
bun run report / e2e:report Open the last HTML report
bun run codegen Playwright codegen against http://localhost:3000
bun run install-browsers playwright install --with-deps
bun run e2e:sync Upsert tests/results/*.json into Google Sheets
bun run e2e:sync:reset Same, with --reset
bun run docs:user-stories Regenerate docs/user-stories/*.md from spec annotations
bun run audit:tc-ids (:strict) TC ID format + prefix/section catalog audit
bun run audit:tc-ids:legacy Audit in --legacy-mode
bun run audit:tc-ids:lenient Audit with --lenient-docs
bun run audit:coverage (:check) Generate / verify COVERAGE.md
bun run audit:spec-health (:check) Generate / verify SPEC-HEALTH.md
bun run migrate:tc-propose / tc-apply / tc-sheet TC ID migration: propose map → apply → sync sheet
bun run wiki:seed / wiki:coverage / wiki:sitemap Wiki screenshot manifest, coverage, sitemap
bun run wiki:probe / wiki:capture Playwright wiki-probe / wiki-screenshots projects
bun run seed:master Excel → REST master-data seeder (scripts/seed-master)
bun run create:sitemap:screen Crawl the app per test user → runs/screens/<datetime>/
bun run movement:setup-workflows (restore) (legacy, CARMEN-AVG/FIFO) Give the movement accounts' workflows products / put them back
bun run movement:setup-fifo-roles (restore) (legacy) Roles + locations for the FIFO SR-issue variant / put them back
bun run movement:cleanup (--apply) (legacy) List / clear documents the movement suite left behind

Use bun run test, not bare bun test — the latter invokes Bun's built-in test runner instead of the test script.

Environment variables

Variable Required Description Default / Example
E2E_BASE_URL No URL of the frontend under test http://localhost:3000
E2E_FRONTEND_DIR No Frontend checkout for the webServer (relative to repo root) ../carmen-frontend
E2E_NO_WEBSERVER No 1 = don't spawn the frontend; test an already running instance 0
CI No Set by CI: forbidOnly + 2 retries —
GOOGLE_SHEETS_SA_KEY_PATH For e2e:sync Absolute path to service-account JSON key /abs/path/sa.json
GOOGLE_SHEETS_SPREADSHEET_ID For e2e:sync Target sheet ID —
SYNC_RESET No 1 = same as e2e:sync --reset —
SEED_BU_CODE For seed:master Business unit to seed BLAVG
SEED_EMAIL / SEED_PASSWORD For seed:master Seeder credentials [email protected] / 12345678
SEED_BACKEND_URL No Backend URL; falls back to frontend config.json http://localhost:4000
SEED_X_APP_ID No App ID header; falls back to frontend config.json —
SEED_CONFIG_PATH No Frontend config.json to read fallbacks from ../carmen-frontend/dist/config.json
VITE_DEV_PROXY_TARGET No Only if the SPA's BACKEND_URL is blanked — Vite /api proxy target http://localhost:4000
WIKI_CAPTURE_EMAIL / WIKI_CAPTURE_PASSWORD No Shoot every wiki screen as one user (matrix ignored) [email protected] / 12345678
WIKI_CAPTURE_DETAIL_ONLY No Capture only dynamic (:id) routes —
WIKI_CAPTURE_WIKI_ONLY No Capture only shots that feed a wiki page —
WIKI_ASSETS_DIR No Wiki screenshot output dir ../carmen-wiki/assets/screenshots/inventory
WIKI_SITEMAP_PATH No Wiki sitemap output ../carmen-wiki/sitemap.html
WIKI_SPECS_DIR No Wiki specs dir for wiki:coverage ../carmen-wiki/.specs
E2E_PERIOD_CLOSE No 1 = register the opt-in period-close project (depends on setup, gmail TEST_USERS) —
E2E_DB_URL For period-close Postgres URL (read-only role is enough) — .env.local only. The tenant schema is resolved from CARMEN_SYSTEM.tb_business_unit.db_schema, not from the BU code —
E2E_API_URL / E2E_X_APP_ID No Backend for the period-close / doc-flow API checks; falls back to the frontend's /config.json —
E2E_MOVEMENT_DATE No Legacy — read only by activePeriodDate in tests/helpers/movement/doc-flow.ts, which nothing calls any more (doc-flow specs use tests/helpers/doc-flow/data.ts; period-close ignores it) today if in the BU's current period, else its 15th
E2E_SRI_BU / E2E_SRI_PHASE No SR → Issue flow: FIFO variant; AVG phase pre / post / all AVG / all
E2E_PERIOD_BU For period-close TEST BU code (tests/test-users.ts TEST_BUS) the period-close run targets; reset it first with data:reset --with-history. Start / Close run only when the BU is a TEST BU and its active period is the scenario period; a run before the 3rd of the month (Bangkok) is refused —
E2E_EVIDENCE_DIR No Period-close evidence folder runs/period-close/<BU>/<period>

Named targets: .env.<name> is loaded by scripts/run-env.ts and overrides .env / .env.local.

Per-module shell scripts

./tests/scripts/run-module.sh currency
./tests/scripts/run-module.sh department --headed
./tests/scripts/run-module.sh currency --debug
./tests/scripts/run-all.sh                 # sequential, summary at the end
./tests/scripts/run-all.sh --workers=100%  # single parallel batch

Any playwright test flag (--headed, --ui, -g <pattern>, --debug, …) passes through.

Project structure

.
├── playwright.config.ts          # 5 projects (setup, login, chromium, wiki-screenshots, wiki-probe) + opt-in period-close (depends on `setup`); webServer; JSON reporter
├── tests/
│   ├── auth.setup.ts             # setup project — pre-authenticates every role once per run
│   ├── movement.setup.ts         # legacy — @carmen.com movement login, unused by period-close (not registered)
│   ├── 312/404/502/603/702-*-lifecycle.spec.ts, 721-sr-issue.spec.ts  # doc flows on the TEST BUs (main suite)
│   ├── 9xx-period-close-*.spec.ts# period-close phases on a TEST BU (opt-in, partly irreversible)
│   ├── *.spec.ts                 # 45 specs: 001-login, 010-department, …, 1001-campaign
│   ├── pages/                    # page objects (locator factories)
│   ├── fixtures/
│   │   ├── auth.fixture.ts       # createAuthTest(email) — boots context from .auth/<email>.json
│   │   └── auth.paths.ts         # authFile(email) — single-source path helper
│   ├── helpers/                  # shared helpers (security-cases, CRUD helpers)
│   ├── reporters/tc-json-reporter.ts
│   ├── results/*.json            # per-spec result JSONs (checked in as seeds; updated each run)
│   ├── scripts/                  # shell runners (run-module.sh, run-all.sh)
│   ├── test-users.ts             # role-based test accounts
│   └── movement-users.ts         # legacy movement accounts (CARMEN-AVG / CARMEN-FIFO) — its accounts are used at runtime only by tests/helpers/movement/api.ts (legacy scripts/movement/*); period-close and the doc-flow specs do not use them (period-close loads the file via movement.fixture.ts but overrides the accounts)
├── .auth/                        # runtime — gitignored; storageState files written by setup
└── scripts/                      # run-env, sync-test-results, audits, seed-master, capture-screens

Test accounts

Defined in tests/test-users.ts. Nine roles: Requestor, HOD, Purchase, FC, GM, Owner, StoreManager, Budget, TT. Most share password 12345678; TT uses Qaz123!@#. The setup project pre-authenticates every role once per bun run test invocation and persists cookies to .auth/<email>.json; subsequent specs reuse that storageState instead of logging in per test.

Test IDs

Every test title starts with a TC-<PREFIX>-XXYYYY ID (2-digit section + 4-digit sequence — e.g. TC-LOGIN-010001, TC-DP-010003). Strict regex: ^TC-[A-Z]{2,5}-\d{6}$. The JSON reporter (tests/reporters/tc-json-reporter.ts) parses these IDs and writes one JSON per spec into tests/results/. Preserve the pattern when adding new tests — otherwise they won't appear in the reports. Run bun audit:tc-ids to verify TC ID format and prefix-catalog registration before opening a PR.

Google Sheets sync (optional)

bun e2e:sync reads tests/results/*.json and upserts Status + Test Date into a Google Sheet. To enable:

  1. Google Cloud Console → create project → enable Google Sheets API
  2. IAM → Service Accounts → create one → download JSON key
  3. Share the target spreadsheet with the service-account email as Editor
  4. Set in .env.local (do NOT commit):
    GOOGLE_SHEETS_SA_KEY_PATH=/absolute/path/to/service-account.json
    GOOGLE_SHEETS_SPREADSHEET_ID=<sheet id from URL>
    
  5. bun e2e:sync

The shell runners (tests/scripts/run-module.sh and run-all.sh) call bun e2e:sync automatically after each run, wrapped in || true so missing credentials don't fail tests.

Tab mapping is hard-coded in SYNC_TARGETS inside scripts/sync-test-results.ts — add an entry there for any new results file.

Notes for contributors

  • Rate limiting: the backend returns HTTP 429 after 3 wrong-password attempts on the same email. Always use LoginPage.loginWithRetry rather than raw login when tests may produce failed auth.
  • workers: 1 in the config is intentional — backend state is shared across role-based accounts and tests cannot safely interleave.
  • Test titles are in Thai to match the product UX.

See docs/CONTRIBUTING.md for setup, test-writing rules and the PR checklist, e2e_test.md for the Thai run guide, and CLAUDE.md for the architecture deep-dive used by AI coding agents.

Default target: the React SPA

By default the suite drives the React SPA (../carmen-frontend, Vite, :3000). The SPA reads its backend from public/config.json, so no dev proxy is required; set VITE_DEV_PROXY_TARGET=<backend-url> only if you blank out BACKEND_URL in that file to route /api through Vite's proxy instead.

002-spa-smoke.spec.ts (TC-SPA-01xxxx) is a cross-section smoke moved here from the SPA repo — it asserts SPA-specific behavior (auth-guard redirect, real dashboard instead of the migration placeholder).

About

No description, website, or topics provided.

Resources

Readme

Contributing

Contributing
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.