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

View File

@@ -0,0 +1,92 @@
name: E2E Tests
# This repo holds ONLY the automated test suite - it has no application code
# and nothing to build or deploy. So unlike the app repo (where the workflow
# derived ENV from github.ref_name), the environment under test is an explicit
# input here: this repo's `main` branch tests whichever deployment you point
# it at, not "the deployment matching this branch".
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to test'
required: true
default: 'develop'
type: choice
options:
- develop
- staging
- main
schedule:
# Nightly regression run against develop (02:00 UTC = 05:00 UTC+3).
- cron: '0 2 * * *'
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
- name: Determine environment
id: env
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
ENV="${{ github.event.inputs.environment }}"
else
# Scheduled runs and pushes/PRs to this repo's main always
# exercise develop - the test suite's own default target.
ENV="develop"
fi
echo "ENVIRONMENT=$ENV" >> $GITHUB_OUTPUT
echo "Testing on: $ENV"
# Credential selection per environment (dev/staging/production) is
# resolved centrally in tests/helpers/environment.ts, not here - all
# secrets are just passed through and the code picks the right pair
# based on ENV. This also means ENV=main correctly maps to production
# credentials/URL.
- run: npx playwright test --project=chromium --workers=1
env:
ENV: ${{ steps.env.outputs.ENVIRONMENT }}
DEV_URL: ${{ secrets.DEV_URL }}
DEV_USERNAME: ${{ secrets.DEV_USERNAME }}
DEV_PASSWORD: ${{ secrets.DEV_PASSWORD }}
TEST_USERNAME: ${{ secrets.TEST_USERNAME }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
STAGING_TEST_USERNAME: ${{ secrets.STAGING_TEST_USERNAME }}
STAGING_TEST_PASSWORD: ${{ secrets.STAGING_TEST_PASSWORD }}
PROD_TEST_USERNAME: ${{ secrets.PROD_TEST_USERNAME }}
PROD_TEST_PASSWORD: ${{ secrets.PROD_TEST_PASSWORD }}
# Reports are the whole point of a dedicated test repo, so keep them
# as artifacts instead of deleting them the way the app repo did.
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report-${{ steps.env.outputs.ENVIRONMENT }}
path: playwright-report/
retention-days: 14
- name: Upload Allure results
if: always()
uses: actions/upload-artifact@v3
with:
name: allure-results-${{ steps.env.outputs.ENVIRONMENT }}
path: allure-results/
retention-days: 14