BillTracker/e2e/constants.js

26 lines
1.2 KiB
JavaScript
Raw Normal View History

// Shared constants for the E2E harness — required by both the DB-prep script
// (plain node) and the Playwright config/specs. See docs/QA_PLAN.md §4.4.
const path = require('path');
// Known creds for the seeded scratch user (regular `user` role, no forced
// password change). Override via env if needed; defaults are fine locally.
const E2E_USER = process.env.E2E_USER || 'e2e_user';
const E2E_PASS = process.env.E2E_PASS || 'e2e_pass_1234';
// Saved logged-in browser state, produced by auth.setup.js and reused by
// authenticated specs. Lives outside git (see .gitignore).
const STORAGE_STATE = path.join(__dirname, '.auth', 'user.json');
// Throwaway SQLite DB for E2E. NEVER the real db/bills.db. Override with
// E2E_DB_PATH to relocate (e.g. an OS tmpdir on CI).
function scratchDbPath() {
return process.env.E2E_DB_PATH || path.join(__dirname, '..', 'db', 'e2e.db');
}
// Dedicated ports so E2E never collides with (or reuses) your real dev server
// on 5173/3000 — a second safety layer on top of the scratch DB.
const API_PORT = process.env.E2E_API_PORT || '3099';
const UI_PORT = process.env.E2E_UI_PORT || '5199';
module.exports = { E2E_USER, E2E_PASS, STORAGE_STATE, scratchDbPath, API_PORT, UI_PORT };