This directory contains the Playwright-based UI End-to-End (E2E) automation suite for the OpenShift GitOps Operator. It validates core frontend workflows, console integration, Red Hat Single Sign-On (RHSSO) loops, and multi-version Argo CD compatibility across OpenShift clusters.
Before running the suite locally, ensure your machine has the following tools installed:
- Node.js (v18 or higher)
- OpenShift CLI (oc): Must be configured in your system PATH.
- Browser Binaries: Playwright requires its own specific browser engines to run tests reproducibly. These are installed automatically when you run the
npx playwright installsetup command.
Navigate to this directory and install the Node modules along with the required Playwright browser binaries:
cd test/ui-e2e
npm install
npx playwright install chromium
The test suite requires cluster administrative credentials to discover routes and handle authentication loops. You can configure these either via a local .env file or by exporting them directly into your terminal/CI environment pipeline.
Generate a local .env file in the root of this directory using the following block:
cat <<EOF > .env
export CLUSTER_USER="kubeadmin"
export CLUSTER_PASSWORD="<your_cluster_password>"
export OC_API_URL="<your_cluster_server_url>"
export IDP="kube:admin" # (Optional) Defaults to kube:admin
EOF
Security Warning: The
.envfile is explicitly ignored by Git. Please don't commit credentials to the repository.
All executions are driven via the ./run-ui-tests.sh wrapper script. This wrapper automatically syncs your local oc CLI context to match your .env configuration, performs route discovery for the Console/Argo CD components, and initializes the Playwright runner.
| Target | Command |
|---|---|
| Run All Tests (Headless/CI Mode) | ./run-ui-tests.sh --project=chromium |
| Run All Tests (Headed + Visual Tracing) | ./run-ui-tests.sh --project=chromium --headed --trace on |
| Run a Specific Spec File | ./run-ui-tests.sh tests/create-application.spec.ts --project=chromium --headed --trace on |
| Flag | Purpose |
|---|---|
--headed |
Launches the visible Chromium browser UI. Excellent for local debugging. |
--trace on |
Records a granular execution trace (DOM snapshots, network calls, actions) for visual triage. |
--reporter=list |
Switches stdout to a clean line-by-line format, ideal for monitoring real-time execution steps. |
If a test fails during execution, Playwright records a full interactive timeline (DOM snapshots, network calls, console logs).
When a test fails, the terminal output will provide an exact command to view the trace. Copy and paste that specific command:
# Example:
npx playwright show-trace test-results/create-application-chromium/trace.zip
├── .auth/
│ └── setup.ts # Orchestrates global OCP authentication & saves storageState.json
├── src/
│ └── pages/ # Page Object Models (POM) isolating UI selectors from spec logic
│ └── ApplicationsPage.ts
├── tests/ # Test specs organized by feature epic
│ ├── login.spec.ts
│ └── create-application.spec.ts
├── .env # Local runtime environment overrides (Git ignored)
└── run-ui-tests.sh # Context-aware orchestrator & URL discovery engine
- Global Authentication Reusability: The .auth/setup.ts module runs first to execute the login sequence against the OpenShift cluster identity provider. It drops an authenticated session state cookie into storageState.json, allowing subsequent test specs to skip login actions entirely and save execution time.
- Isolated SSO Specs: Explicit UI authentication testing (such as login.spec.ts) bypasses global storage state configurations and clears active browser contexts intentionally to validate raw login screens and provider selections.
- Cross-Version UI Abstraction: Selectors inside the Page Object Models are written to withstand UI layout drift between consecutive OpenShift versions by prioritizing user-facing roles and text-based assertions over brittle CSS class trees.
- Cause: The wrapper script handles cross-cluster contexts dynamically. If your terminal environment variables don't match your local ~/.kube/config cache, your terminal may fall back to cached sessions.
- Resolution: Ensure you either run
source .envinside your terminal window to reset active shell contexts, or verify that the variables declared within your .env file match your active target system configuration.