forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-prow-playwright-e2e.sh
More file actions
executable file
·69 lines (57 loc) · 2.19 KB
/
Copy pathtest-prow-playwright-e2e.sh
File metadata and controls
executable file
·69 lines (57 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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
pushd frontend
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