Extract PassDashboard Playwright e2e suite into standalone repo
Some checks failed
E2E Tests / test (push) Has been cancelled

Copies the Playwright end-to-end suite out of the PassDashboard app repo so
it can be run and deployed independently. Nothing was removed from the app
repo - this is a copy.

Carried over verbatim: tests/ (10 spec files, 4 helper modules, README) plus
playwright.config.ts and .env.test.example. The suite drives the deployed app
over HTTP and imports nothing from src/, which is what makes it standalone.

New for this repo:
- package.json with only the deps the suite actually uses (@playwright/test,
  allure-playwright, xlsx, typescript, @types/node) and the e2e scripts.
- tsconfig.json covering tests/ - the app repo's tsconfig.app.json only
  included src/, so these files were never typechecked before.
- .gitea/workflows/e2e-tests.yml for Gitea Actions. The app repo derived ENV
  from github.ref_name; that doesn't apply here since this repo has no
  per-environment branches, so the target is an explicit workflow_dispatch
  input and scheduled/push runs default to develop. Reports are uploaded as
  artifacts rather than deleted.
- .gitignore and README covering local setup and the required CI secrets.

The Jest unit tests under src/__tests__/ were deliberately left in the app
repo: they import application source directly (AuthContext, ProtectedRoute,
cryptoUtils, api) and cannot run without it.

Verified: npx tsc --noEmit is clean and playwright collects all 43 tests
across all 10 spec files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-03 15:50:50 +03:00
commit 7bf4343f88
23 changed files with 6568 additions and 0 deletions

66
playwright.config.ts Normal file
View File

@@ -0,0 +1,66 @@
import { defineConfig, devices } from '@playwright/test';
import { getEnvironmentConfig } from './tests/helpers/environment';
/**
* Playwright configuration for PassDashboard test automation
* @see https://playwright.dev/docs/test-configuration
*
* Environment (dev/staging/production) and credentials are resolved once,
* centrally, in tests/helpers/environment.ts - see that file and
* .env.test.example for how to switch environments locally or in CI.
*/
const env = getEnvironmentConfig();
console.log(`[playwright.config] Running against ${env.envName} (${env.baseURL})`);
export default defineConfig({
testDir: './tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: 2,
workers: 1,
reporter: [
['html'],
['allure-playwright', {
outputFolder: 'allure-results',
detail: true,
suiteTitle: true,
}],
],
use: {
baseURL: env.baseURL,
trace: 'off',
screenshot: 'off',
video: 'off',
actionTimeout: 30000,
navigationTimeout: 90000,
// Pin the browser clock to the platform's market timezone (UTC+3).
// The report date range is timezone-sensitive: picking 2026-07-31 on a
// UTC machine made the app request 2026-08-01 instead, which comes back
// 204 No Content, so no file ever downloads. CI runners are UTC while
// developers here run UTC+3, which is exactly why these download tests
// passed locally and failed only in CI. Pinning it makes both agree and
// matches how the product is actually used.
timezoneId: 'Asia/Riyadh',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
// Run terminals before management so removed cashier frees up a terminal
testMatch: [
'**/auth.spec.ts',
'**/dashboard.spec.ts',
'**/terminals.spec.ts',
'**/transactions.spec.ts',
'**/discounts.spec.ts',
'**/refunds.spec.ts',
'**/settlement.spec.ts',
'**/management.spec.ts',
'**/settings.spec.ts',
'**/roles.spec.ts',
],
},
],
});