diff --git a/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf5.yaml b/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf5.yaml index ba662c3af..07ee24b87 100644 --- a/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf5.yaml +++ b/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf5.yaml @@ -5,7 +5,7 @@ metadata: name: ols-console-pre-commits spec: description: | - Runs OpenShift Lightspeed console e2e (Cypress) on a Konflux ephemeral OpenShift cluster (EaaS). + Runs OpenShift Lightspeed console e2e (Playwright) on a Konflux ephemeral OpenShift cluster (EaaS). Provisions the cluster, installs the operator bundle from the snapshot, runs console tests, collects artifacts, then deprovisions. params: @@ -172,9 +172,9 @@ spec: - name: credentials mountPath: /credentials env: - - name: CYPRESS_KUBECONFIG_PATH + - name: KUBECONFIG_PATH value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)" - - name: CYPRESS_LOGIN_IDP + - name: LOGIN_IDP value: "kube:admin" - name: LLM_TOKEN_PATH value: "/var/run/openai/token" @@ -182,14 +182,15 @@ spec: value: "$(params.commit)" - name: PASSWORD_PATH value: "/credentials/$(steps.get-kubeconfig.results.passwordPath)" - - name: CYPRESS_BASE_URL + - name: BASE_URL value: "$(steps.get-kubeconfig.results.consoleURL)" - name: BUNDLE_COMMIT_SHA value: "$(params.commit)" - - name: CYPRESS_BUNDLE_IMAGE + - name: BUNDLE_IMAGE value: "$(params.bundle-image)" - image: cypress/browsers:26.0.0 + image: mcr.microsoft.com/playwright:v1.60.0-noble script: | + #!/bin/bash set -euo pipefail apt update && apt install -y jq git curl cd /home @@ -198,7 +199,7 @@ spec: git remote add origin https://github.com/openshift/lightspeed-operator.git git fetch --depth=1 --filter=blob:none origin "${COMMIT_SHA}" git checkout "${COMMIT_SHA}" - git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-cypress-tests.sh" | bash -s -- "lightspeed-console-plugin-pf5" "latest-4.18" + git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-playwright-tests.sh" | bash -s -- "lightspeed-console-plugin-pf5" "latest-4.18" - name: gather-cluster-resources onError: continue ref: diff --git a/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf6.yaml b/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf6.yaml index 9d8a273a1..548536b20 100644 --- a/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf6.yaml +++ b/.tekton/integration-tests/pipelines/lightspeed-console-e2e-test-pipeline-pf6.yaml @@ -5,7 +5,7 @@ metadata: name: ols-console-pre-commits spec: description: | - Runs OpenShift Lightspeed console e2e (Cypress) on a Konflux ephemeral OpenShift cluster (EaaS). + Runs OpenShift Lightspeed console e2e (Playwright) on a Konflux ephemeral OpenShift cluster (EaaS). Provisions the cluster, installs the operator bundle from the snapshot, runs console tests, collects artifacts, then deprovisions. params: @@ -172,9 +172,9 @@ spec: - name: credentials mountPath: /credentials env: - - name: CYPRESS_KUBECONFIG_PATH + - name: KUBECONFIG_PATH value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)" - - name: CYPRESS_LOGIN_IDP + - name: LOGIN_IDP value: "kube:admin" - name: LLM_TOKEN_PATH value: "/var/run/openai/token" @@ -182,14 +182,15 @@ spec: value: "$(params.commit)" - name: PASSWORD_PATH value: "/credentials/$(steps.get-kubeconfig.results.passwordPath)" - - name: CYPRESS_BASE_URL + - name: BASE_URL value: "$(steps.get-kubeconfig.results.consoleURL)" - name: BUNDLE_COMMIT_SHA value: "$(params.commit)" - - name: CYPRESS_BUNDLE_IMAGE + - name: BUNDLE_IMAGE value: "$(params.bundle-image)" - image: cypress/browsers:26.0.0 + image: mcr.microsoft.com/playwright:v1.60.0-noble script: | + #!/bin/bash set -euo pipefail apt update && apt install -y jq git curl cd /home @@ -198,7 +199,7 @@ spec: git remote add origin https://github.com/openshift/lightspeed-operator.git git fetch --depth=1 --filter=blob:none origin "${COMMIT_SHA}" git checkout "${COMMIT_SHA}" - git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-cypress-tests.sh" | bash -s -- "lightspeed-console-plugin" "latest-4.19" + git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-playwright-tests.sh" | bash -s -- "lightspeed-console-plugin" "latest-4.19" - name: gather-cluster-resources onError: continue ref: diff --git a/.tekton/integration-tests/scripts/run-console-cypress-tests.sh b/.tekton/integration-tests/scripts/run-console-playwright-tests.sh similarity index 69% rename from .tekton/integration-tests/scripts/run-console-cypress-tests.sh rename to .tekton/integration-tests/scripts/run-console-playwright-tests.sh index 1037a4c22..8a1e22824 100755 --- a/.tekton/integration-tests/scripts/run-console-cypress-tests.sh +++ b/.tekton/integration-tests/scripts/run-console-playwright-tests.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# Konflux console Cypress: run from lightspeed-operator repo root at ${COMMIT_SHA} +# Konflux console Playwright: run from lightspeed-operator repo root at ${COMMIT_SHA} # (Tekton performs apt + git init/fetch/checkout before piping this script). # # Usage (from Tekton, cwd = /home/lightspeed-operator): -# git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-cypress-tests.sh" \ +# git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/run-console-playwright-tests.sh" \ # | bash -s -- "" "" # # Args: # $1 Name in related_images.json for the console plugin (e.g. lightspeed-console-plugin-pf5 or lightspeed-console-plugin) # $2 OpenShift client channel for install-oc-if-missing.sh (e.g. latest-4.18), aligned with the ephemeral cluster minor # -# Env: COMMIT_SHA, CYPRESS_BASE_URL, CYPRESS_CONSOLE_IMAGE, CYPRESS_KUBECONFIG_PATH, PASSWORD_PATH, etc. +# Env: COMMIT_SHA, BASE_URL, KUBECONFIG_PATH, PASSWORD_PATH, LOGIN_IDP, BUNDLE_IMAGE, etc. set -euo pipefail @@ -18,11 +18,16 @@ console_component="${1:?usage: $0 &2 + exit 1 +fi +LOGIN_PASSWORD="$(cat "${PASSWORD_PATH}")" +export LOGIN_PASSWORD +echo "(LOGIN_PASSWORD set from PASSWORD_PATH; not echoed)" echo "---------------------------------------------" git show "${COMMIT_SHA}:.tekton/integration-tests/scripts/install-oc-if-missing.sh" | bash -s -- "${ocp_channel}" @@ -41,7 +46,7 @@ echo "---------------------------------------------" operator-sdk version echo "---------------------------------------------" -# Valid XDG path for Cypress/Electron; must not reuse $PATH (breaks browser runtime). +# Valid XDG path for Playwright/Chromium; must not reuse $PATH (breaks browser runtime). XDG_RUNTIME_DIR="${HOME:-/root}/.cache/xdgr" mkdir -p "${XDG_RUNTIME_DIR}" export XDG_RUNTIME_DIR @@ -64,26 +69,26 @@ echo "---------------------------------------------" NODE_OPTIONS=--max-old-space-size=4096 npm ci --omit=optional --no-fund npx cypress install echo "---------------------------------------------" -export CYPRESS_LOGIN_PASSWORD="$(cat "${PASSWORD_PATH}")" -# Ephemeral clusters + console OAuth + plugin proxy are slow; before() often runs bundle then UI. -export CYPRESS_defaultCommandTimeout="${CYPRESS_defaultCommandTimeout:-120000}" -export CYPRESS_requestTimeout="${CYPRESS_requestTimeout:-120000}" -export CYPRESS_pageLoadTimeout="${CYPRESS_pageLoadTimeout:-180000}" -export CYPRESS_responseTimeout="${CYPRESS_responseTimeout:-180000}" -export CYPRESS_execTimeout="${CYPRESS_execTimeout:-600000}" -run_cypress() { - NO_COLOR=1 npx cypress run "$@" +# Install Playwright browsers (chromium only, with OS deps). +npx playwright install --with-deps chromium +echo "---------------------------------------------" + +# Enable Playwright CI mode (forbidOnly, etc.). +export CI=true + +run_playwright() { + npx playwright test "$@" } set +e -run_cypress +run_playwright err_status=$? if [[ "${err_status}" -ne 0 ]]; then echo "---------------------------------------------" - echo "Cypress exited ${err_status}; waiting 30s for console/plugin then retrying once..." + echo "Playwright exited ${err_status}; waiting 30s for console/plugin then retrying once..." sleep 30 - run_cypress + run_playwright err_status=$? fi echo -n "${err_status}" >/workspace/cypress-exit-code @@ -91,5 +96,5 @@ echo "---------------------------------------------" ls ./gui_test_screenshots mv ./gui_test_screenshots /workspace/artifacts/ set -e -echo "Cypress exit code: ${err_status}" +echo "Playwright exit code: ${err_status}" exit "${err_status}"