diff --git a/frontend/integration-tests/test-playwright-e2e.sh b/frontend/integration-tests/test-playwright.sh similarity index 95% rename from frontend/integration-tests/test-playwright-e2e.sh rename to frontend/integration-tests/test-playwright.sh index fde349302ba..e236c289e0f 100755 --- a/frontend/integration-tests/test-playwright-e2e.sh +++ b/frontend/integration-tests/test-playwright.sh @@ -5,10 +5,10 @@ # Playwright's --project flag (project names match the `packages` array in playwright.config.ts). # # Usage (from repo frontend/): -# ./integration-tests/test-playwright-e2e.sh [playwright test args...] -# ./integration-tests/test-playwright-e2e.sh --project=helm -# ./integration-tests/test-playwright-e2e.sh --project=smoke -# ./integration-tests/test-playwright-e2e.sh -c [--] [playwright test args...] +# ./integration-tests/test-playwright.sh [playwright test args...] +# ./integration-tests/test-playwright.sh --project=helm +# ./integration-tests/test-playwright.sh --project=smoke +# ./integration-tests/test-playwright.sh -c [--] [playwright test args...] # # -c Run contrib/create-user.sh before tests. # diff --git a/test-prow-e2e-cypress.sh b/test-prow-e2e-cypress.sh new file mode 100755 index 00000000000..76a3238402d --- /dev/null +++ b/test-prow-e2e-cypress.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -exuo pipefail + +INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer} + +# don't log kubeadmin-password +set +x +export BRIDGE_KUBEADMIN_PASSWORD="$(cat "${KUBEADMIN_PASSWORD_FILE:-${INSTALLER_DIR}/auth/kubeadmin-password}")" +set -x +export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jsonpath='{.status.consoleURL}')" + +./contrib/create-user.sh + +pushd frontend + +if [ ! -d node_modules ]; then + yarn install +fi + +SCENARIO="${1:-e2e}" + +if [ "$SCENARIO" == "nightly-cypress" ]; then + PACKAGE="" + if [ $# -gt 1 ]; then + PACKAGE="-p $2" + fi + ./integration-tests/test-cypress.sh -n true $PACKAGE +elif [ "$SCENARIO" == "e2e" ] || [ "$SCENARIO" == "release" ]; then + ./integration-tests/test-cypress.sh -h true +elif [ "$SCENARIO" == "olmFull" ]; then + ./integration-tests/test-cypress.sh -p olm -h true +elif [ "$SCENARIO" == "dev-console" ]; then + ./integration-tests/test-cypress.sh -p dev-console -h true +elif [ "$SCENARIO" == "pipelines" ]; then + ./integration-tests/test-cypress.sh -p pipelines -h true +# Disabled: knative-ci.feature failing in CI (OCPBUGS-82512) +# elif [ "$SCENARIO" == "knative" ]; then +# ./integration-tests/test-cypress.sh -p knative -h true +fi + +env NO_SANDBOX=true yarn test-puppeteer-csp + +popd diff --git a/test-prow-e2e-techpreview.sh b/test-prow-e2e-techpreview.sh index ab2412a123c..d24d78804fe 100755 --- a/test-prow-e2e-techpreview.sh +++ b/test-prow-e2e-techpreview.sh @@ -1,3 +1,52 @@ #!/usr/bin/env bash +# +# Prow / CI entrypoint for Playwright E2E tech-preview tests against a live OpenShift cluster. +# Runs OLM tests that require Tech Preview to be enabled, including: +# - Operator catalog items display test (OLMv1 path active on Tech Preview clusters) +# - Operator lifecycle metadata test (requires OLMLifecycleAndCompatibility feature gate) +# +# Run from the openshift/console repository root. +# +# Environment (typical Prow / installer): +# ARTIFACT_DIR, INSTALLER_DIR, KUBEADMIN_PASSWORD_FILE same as test-prow-e2e.sh +# set -exuo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "${REPO_ROOT}" + +ARTIFACT_DIR=${ARTIFACT_DIR:-/tmp/artifacts} +INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer} + +# Validate ARTIFACT_DIR is set and is an absolute path +if [ -z "$ARTIFACT_DIR" ]; then + echo "Error: ARTIFACT_DIR is not set" >&2 + exit 1 +fi +case "$ARTIFACT_DIR" in + /) echo "Error: ARTIFACT_DIR must not be '/'" >&2; exit 1 ;; + /*) ;; # absolute path, OK + *) echo "Error: ARTIFACT_DIR must be an absolute path, got: $ARTIFACT_DIR" >&2; exit 1 ;; +esac + +export ARTIFACT_DIR INSTALLER_DIR +mkdir -p "${ARTIFACT_DIR}" + +# don't log kubeadmin-password +set +x +export BRIDGE_KUBEADMIN_PASSWORD="$(cat "${KUBEADMIN_PASSWORD_FILE:-${INSTALLER_DIR}/auth/kubeadmin-password}")" +set -x +export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jsonpath='{.status.consoleURL}')" + +./contrib/create-user.sh + +pushd frontend + +if [ ! -d node_modules ]; then + yarn install +fi + +./integration-tests/test-playwright.sh -- e2e/tests/olm/operator-lifecycle-metadata.spec.ts e2e/tests/dev-console/catalog.spec.ts "$@" + +popd diff --git a/test-prow-e2e.sh b/test-prow-e2e.sh index 76a3238402d..f15e4335061 100755 --- a/test-prow-e2e.sh +++ b/test-prow-e2e.sh @@ -1,9 +1,40 @@ #!/usr/bin/env bash +# +# Prow / CI entrypoint for Playwright E2E against a live OpenShift cluster console. +# +# Usage: +# ./test-prow-e2e.sh [e2e|release|smoke] [arguments passed to: playwright test ...] +# +# Scenarios (first argument; default: e2e): +# e2e, release — full Playwright suite (default project / config) +# smoke — Playwright smoke project (--project=smoke) +# +# Environment (typical Prow / installer): +# ARTIFACT_DIR, INSTALLER_DIR, KUBEADMIN_PASSWORD_FILE +# set -exuo pipefail +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "${REPO_ROOT}" + +ARTIFACT_DIR=${ARTIFACT_DIR:-/tmp/artifacts} INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer} +# Validate ARTIFACT_DIR is set and is an absolute path +if [ -z "$ARTIFACT_DIR" ]; then + echo "Error: ARTIFACT_DIR is not set" >&2 + exit 1 +fi +case "$ARTIFACT_DIR" in + /) echo "Error: ARTIFACT_DIR must not be '/'" >&2; exit 1 ;; + /*) ;; # absolute path, OK + *) echo "Error: ARTIFACT_DIR must be an absolute path, got: $ARTIFACT_DIR" >&2; exit 1 ;; +esac + +export ARTIFACT_DIR INSTALLER_DIR +mkdir -p "${ARTIFACT_DIR}" + # don't log kubeadmin-password set +x export BRIDGE_KUBEADMIN_PASSWORD="$(cat "${KUBEADMIN_PASSWORD_FILE:-${INSTALLER_DIR}/auth/kubeadmin-password}")" @@ -12,6 +43,9 @@ export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jso ./contrib/create-user.sh +export WORKERS="${WORKERS:-2}" +export GLOBAL_TIMEOUT_MS="${GLOBAL_TIMEOUT_MS:-6600000}" + pushd frontend if [ ! -d node_modules ]; then @@ -19,24 +53,18 @@ if [ ! -d node_modules ]; then fi SCENARIO="${1:-e2e}" +if [ $# -gt 0 ]; then + shift +fi -if [ "$SCENARIO" == "nightly-cypress" ]; then - PACKAGE="" - if [ $# -gt 1 ]; then - PACKAGE="-p $2" - fi - ./integration-tests/test-cypress.sh -n true $PACKAGE -elif [ "$SCENARIO" == "e2e" ] || [ "$SCENARIO" == "release" ]; then - ./integration-tests/test-cypress.sh -h true -elif [ "$SCENARIO" == "olmFull" ]; then - ./integration-tests/test-cypress.sh -p olm -h true -elif [ "$SCENARIO" == "dev-console" ]; then - ./integration-tests/test-cypress.sh -p dev-console -h true -elif [ "$SCENARIO" == "pipelines" ]; then - ./integration-tests/test-cypress.sh -p pipelines -h true -# Disabled: knative-ci.feature failing in CI (OCPBUGS-82512) -# elif [ "$SCENARIO" == "knative" ]; then -# ./integration-tests/test-cypress.sh -p knative -h true +if [ "$SCENARIO" == "e2e" ] || [ "$SCENARIO" == "release" ]; then + ./integration-tests/test-playwright.sh "$@" +elif [ "$SCENARIO" == "smoke" ]; then + # End of script flags before Playwright's --project (test-playwright.sh only parses -c). + ./integration-tests/test-playwright.sh -- --project=smoke "$@" +else + echo "error: unknown scenario '$SCENARIO' (use: e2e, release, or smoke)" >&2 + exit 1 fi env NO_SANDBOX=true yarn test-puppeteer-csp diff --git a/test-prow-playwright-e2e-techpreview.sh b/test-prow-playwright-e2e-techpreview.sh deleted file mode 100755 index 4be9dcd0ca4..00000000000 --- a/test-prow-playwright-e2e-techpreview.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# -# Prow / CI entrypoint for Playwright E2E tech-preview tests against a live OpenShift cluster. -# Runs OLM tests that require Tech Preview to be enabled, including: -# - Operator catalog items display test (OLMv1 path active on Tech Preview clusters) -# - Operator lifecycle metadata test (requires OLMLifecycleAndCompatibility feature gate) -# -# Run from the openshift/console repository root. -# -# Environment (typical Prow / installer): -# ARTIFACT_DIR, INSTALLER_DIR, KUBEADMIN_PASSWORD_FILE same as test-prow-e2e.sh -# - -set -exuo pipefail - -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "${REPO_ROOT}" - -ARTIFACT_DIR=${ARTIFACT_DIR:-/tmp/artifacts} -INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer} - -# Validate ARTIFACT_DIR is set and is an absolute path -if [ -z "$ARTIFACT_DIR" ]; then - echo "Error: ARTIFACT_DIR is not set" >&2 - exit 1 -fi -case "$ARTIFACT_DIR" in - /) echo "Error: ARTIFACT_DIR must not be '/'" >&2; exit 1 ;; - /*) ;; # absolute path, OK - *) echo "Error: ARTIFACT_DIR must be an absolute path, got: $ARTIFACT_DIR" >&2; exit 1 ;; -esac - -export ARTIFACT_DIR INSTALLER_DIR -mkdir -p "${ARTIFACT_DIR}" - -# don't log kubeadmin-password -set +x -export BRIDGE_KUBEADMIN_PASSWORD="$(cat "${KUBEADMIN_PASSWORD_FILE:-${INSTALLER_DIR}/auth/kubeadmin-password}")" -set -x -export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jsonpath='{.status.consoleURL}')" - -./contrib/create-user.sh - -pushd frontend - -if [ ! -d node_modules ]; then - yarn install -fi - -./integration-tests/test-playwright-e2e.sh -- e2e/tests/olm/operator-lifecycle-metadata.spec.ts e2e/tests/dev-console/catalog.spec.ts "$@" - -popd diff --git a/test-prow-playwright-e2e.sh b/test-prow-playwright-e2e.sh deleted file mode 100755 index b78ec6e0d96..00000000000 --- a/test-prow-playwright-e2e.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env bash -# -# Prow / CI entrypoint for Playwright E2E against a live OpenShift cluster console. -# Mirrors test-prow-e2e.sh: kubeadmin password, BRIDGE_BASE_ADDRESS from the cluster, -# contrib/create-user.sh, then tests under frontend/, and the same CSP check as Cypress Prow. -# -# Run from the openshift/console repository root (same as test-prow-e2e.sh). -# -# Usage: -# ./test-prow-playwright-e2e.sh [e2e|release|smoke] [arguments passed to: playwright test ...] -# -# Scenarios (first argument; default: e2e): -# e2e, release — full Playwright suite (default project / config) -# smoke — Playwright smoke project (--project=smoke) -# -# Environment (typical Prow / installer): -# ARTIFACT_DIR, INSTALLER_DIR, KUBEADMIN_PASSWORD_FILE same as test-prow-e2e.sh -# - -set -exuo pipefail - -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "${REPO_ROOT}" - -ARTIFACT_DIR=${ARTIFACT_DIR:-/tmp/artifacts} -INSTALLER_DIR=${INSTALLER_DIR:=${ARTIFACT_DIR}/installer} - -# Validate ARTIFACT_DIR is set and is an absolute path -if [ -z "$ARTIFACT_DIR" ]; then - echo "Error: ARTIFACT_DIR is not set" >&2 - exit 1 -fi -case "$ARTIFACT_DIR" in - /) echo "Error: ARTIFACT_DIR must not be '/'" >&2; exit 1 ;; - /*) ;; # absolute path, OK - *) echo "Error: ARTIFACT_DIR must be an absolute path, got: $ARTIFACT_DIR" >&2; exit 1 ;; -esac - -export ARTIFACT_DIR INSTALLER_DIR -mkdir -p "${ARTIFACT_DIR}" - -# don't log kubeadmin-password -set +x -export BRIDGE_KUBEADMIN_PASSWORD="$(cat "${KUBEADMIN_PASSWORD_FILE:-${INSTALLER_DIR}/auth/kubeadmin-password}")" -set -x -export BRIDGE_BASE_ADDRESS="$(oc get consoles.config.openshift.io cluster -o jsonpath='{.status.consoleURL}')" - -./contrib/create-user.sh - -export WORKERS="${WORKERS:-2}" -export GLOBAL_TIMEOUT_MS="${GLOBAL_TIMEOUT_MS:-6600000}" - -pushd frontend - -if [ ! -d node_modules ]; then - yarn install -fi - -SCENARIO="${1:-e2e}" -if [ $# -gt 0 ]; then - shift -fi - -if [ "$SCENARIO" == "e2e" ] || [ "$SCENARIO" == "release" ]; then - ./integration-tests/test-playwright-e2e.sh "$@" -elif [ "$SCENARIO" == "smoke" ]; then - # End of script flags before Playwright's --project (test-playwright-e2e.sh only parses -c). - ./integration-tests/test-playwright-e2e.sh -- --project=smoke "$@" -else - echo "error: unknown scenario '$SCENARIO' (use: e2e, release, or smoke)" >&2 - exit 1 -fi - -env NO_SANDBOX=true yarn test-puppeteer-csp - -popd