Automation testing for UI using Playwright.
- Node.js 18+
- npm
Clone the repository:
git clone https://github.com/kube-HPC/ui-automation-testing.git
cd ui-automation-testingRun the setup script:
npm run setupThis command will:
- install all Node dependencies
- download the required Playwright browsers
- install a local pre-commit hook (best effort; setup continues if hook installation is not possible)
Environment values are split between a local, git-ignored .env file and the
shared config module in config/env.js.
Create your local .env from the template:
cp .env.example .envThe .env file holds machine-specific and secret values:
BASE_URL— the deployment root, for examplehttps://cicd.hkube.org/KEYCLOAK_USERNAMEKEYCLOAK_PASSWORDVITE_KEYCLOAK_ENABLE— optional override (Keycloak auth is enabled by default)PREFIX— optional override for the test-resource prefix (defaults topw-)
config/env.js is the single source of truth that derives the URLs used by the
tests from BASE_URL:
- dashboard:
${BASE_URL}hkube/dashboard/#/ - backend:
${BASE_URL}hkube/api-server/api/v1/
In CI, BASE_URL, KEYCLOAK_USERNAME, and KEYCLOAK_PASSWORD are provided via
GitHub repository Secrets (see .github/workflows/playwright.yml). Add them
under Settings → Secrets and variables → Actions.
npm testor
npx playwright testBefore opening a PR with new or changed tests, run:
npm run check:test-structureThis quality gate enforces:
- no empty files under
tests/ - camelCase names for folders under
tests/ - camelCase names for files under
tests/(based on file name before extension) - unique test titles across
tests/**/*.spec.ts - static test titles only (no dynamic/interpolated test title expressions)
There is no allowlist and no baseline exceptions. Any violation fails the check.
Then run the relevant Playwright tests for your change.
When VITE_KEYCLOAK_ENABLE=true, Playwright runs a dedicated setup project first:
tests/auth.setup.tslogs in once and saves the authenticated browser state toplaywright/.auth/user.json- all tests in the
chromeproject reuse that state viastorageState tests/flows/loginAndLogout/loginAndLogout.spec.tsruns separately inauth-flowto validate login/logout itself
Required environment variables for this flow:
KEYCLOAK_USERNAMEKEYCLOAK_PASSWORDBASE_URL
Keycloak auth is enabled by default; set VITE_KEYCLOAK_ENABLE=false in your
local .env to run against a non-auth deployment.
If you pull new changes from the repository, run:
npm run setupto make sure dependencies and browsers are installed.
tests/
playwright.config.ts
package.json
README.md