Skip to content

Commit b9c5aa9

Browse files
author
Pedro Abreu
committed
upgrade playwright to 1.55
Resolves: MTV-3470 Signed-off-by: Pedro Abreu <[email protected]>
1 parent f1ce102 commit b9c5aa9

File tree

5 files changed

+164
-28
lines changed

5 files changed

+164
-28
lines changed

testing/PlaywrightContainerFile

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1-
FROM mcr.microsoft.com/playwright:latest
1+
FROM mcr.microsoft.com/playwright:v1.55.0-noble
22

3-
WORKDIR /e2e
3+
ARG GIT_COMMIT=unknown
4+
ARG BUILD_DATE=unknown
5+
ARG VERSION=dev
6+
7+
LABEL org.opencontainers.image.created="${BUILD_DATE}" \
8+
org.opencontainers.image.source="https://github.com/kubev2v/forklift-console-plugin" \
9+
org.opencontainers.image.version="${VERSION}" \
10+
org.opencontainers.image.revision="${GIT_COMMIT}" \
11+
org.opencontainers.image.title="MTV UI Tests"
12+
13+
ENV LANG=en_US.UTF-8 \
14+
LANGUAGE=en_US:en \
15+
LC_ALL=en_US.UTF-8 \
16+
IMAGE_VERSION="${VERSION}" \
17+
IMAGE_GIT_COMMIT="${GIT_COMMIT}" \
18+
IMAGE_BUILD_DATE="${BUILD_DATE}"
19+
20+
RUN apt-get update && \
21+
apt-get install -y --no-install-recommends locales && \
22+
rm -rf /var/lib/apt/lists/* && \
23+
locale-gen en_US.UTF-8
24+
25+
WORKDIR /test-runner
26+
27+
COPY package.json yarn.lock ./
28+
RUN corepack enable && \
29+
yarn install --frozen-lockfile --ignore-scripts
430

531
COPY . .
632

7-
ENV BASE_ADDRESS="http://host.docker.internal:9000"
33+
RUN chmod +x run-tests.sh && \
34+
chown -R 1001:0 /test-runner && \
35+
chmod -R g+w /test-runner
36+
37+
USER 1001
838

9-
RUN yarn
10-
RUN npx playwright install
39+
CMD ["./run-tests.sh"]

testing/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "e2e-tests",
33
"version": "1.0.0",
44
"scripts": {
5-
65
"test:e2e": "npx playwright test",
76
"test:e2e:ui": "npx playwright test --ui",
87
"test:downstream": "npx playwright test --grep @downstream",
@@ -14,10 +13,12 @@
1413
"license": "ISC",
1514
"description": "",
1615
"devDependencies": {
17-
"playwright": "1.54.2",
18-
"@playwright/test": "1.54.2",
16+
"playwright": "1.55.0",
17+
"@playwright/test": "1.55.0",
1918
"@types/node": "^20.0.0",
2019
"typescript": "^5.8.2"
2120
},
22-
"dependencies": {}
21+
"dependencies": {
22+
"@kubev2v/types": "0.0.22"
23+
}
2324
}

testing/playwright.config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@ export default defineConfig({
66
globalSetup: './playwright/global.setup.ts',
77
globalTeardown: './playwright/global.teardown.ts',
88
testDir: './playwright/e2e',
9-
timeout: process.env.JENKINS ? 120_000 : 60_000,
9+
timeout: process.env.JENKINS ? 15 * 60_000 : 60_000,
1010
fullyParallel: true,
11+
workers: 3,
1112

1213
retries: process.env.GITHUB_ACTIONS ? 3 : 0,
1314

15+
reporter: [['list'], ['html', { open: 'never' }]],
16+
17+
use: {
18+
actionTimeout: 20_000,
19+
navigationTimeout: 20_000,
20+
},
21+
22+
expect: {
23+
timeout: 20_000,
24+
},
25+
1426
projects: [
1527
{
1628
name: 'chromium',
@@ -24,6 +36,7 @@ export default defineConfig({
2436
viewport: { width: 1920, height: 1080 },
2537
screenshot: 'only-on-failure',
2638
video: 'retain-on-failure',
39+
trace: 'retain-on-failure',
2740
// Use data-testid to match actual rendered HTML
2841
testIdAttribute: 'data-testid',
2942
ignoreHTTPSErrors: true,

testing/run-tests.sh

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# ==============================================================================
5+
# Script for running Playwright tests in a containerized environment.
6+
#
7+
# This script uses pre-copied test files from the local repository and
8+
# executes Playwright tests based on environment variables.
9+
#
10+
# Required Environment Variables:
11+
# - CLUSTER_NAME: Name of the OpenShift cluster to target.
12+
# - VSPHERE_PROVIDER: vSphere provider to use for testing.
13+
# - TEST_ARGS: (Optional) Arbitrary arguments for the playwright command.
14+
# - CLUSTER_PASSWORD: The password for the OCP cluster.
15+
# - PROVIDERS_JSON: The content of the .providers.json file.
16+
#
17+
# Mounted Volumes:
18+
# - /results: Directory to store test artifacts (reports, results).
19+
#
20+
# ==============================================================================
21+
22+
# --- Configuration and Defaults ---
23+
# Use /results if WORKSPACE is not set (for container environment)
24+
RESULTS_DIR="${WORKSPACE:-/results}"
25+
TEST_ARGS=${TEST_ARGS:-"--grep=@downstream"}
26+
27+
log() {
28+
echo "--- $1 ---"
29+
}
30+
31+
log "Container Image Information"
32+
echo " Version: ${IMAGE_VERSION:-unknown}"
33+
echo " Git Commit: ${IMAGE_GIT_COMMIT:-unknown}"
34+
echo " Build Date: ${IMAGE_BUILD_DATE:-unknown}"
35+
echo ""
36+
37+
cd /test-runner
38+
39+
log "Validating environment and setting up credentials..."
40+
41+
if [ -z "$CLUSTER_NAME" ]; then
42+
echo "ERROR: CLUSTER_NAME environment variable is not set."
43+
exit 1
44+
fi
45+
46+
if [ -z "$PROVIDERS_JSON" ]; then
47+
echo "ERROR: PROVIDERS_JSON environment variable is not set."
48+
exit 1
49+
fi
50+
51+
if [ -z "$CLUSTER_PASSWORD" ]; then
52+
echo "ERROR: CLUSTER_PASSWORD environment variable is not set."
53+
exit 1
54+
fi
55+
56+
log "Validation complete. Using pre-copied test files from /test-runner"
57+
58+
log "Creating .providers.json from environment variable..."
59+
echo "$PROVIDERS_JSON" > .providers.json
60+
61+
export BASE_ADDRESS="https://console-openshift-console.apps.${CLUSTER_NAME}.rhos-psi.cnv-qe.rhood.us"
62+
export CI=true
63+
export JENKINS=true
64+
export NODE_TLS_REJECT_UNAUTHORIZED=0
65+
export CLUSTER_USERNAME="kubeadmin"
66+
export CLUSTER_PASSWORD=${CLUSTER_PASSWORD}
67+
export VSPHERE_PROVIDER=${VSPHERE_PROVIDER}
68+
69+
log "Running Playwright tests..."
70+
echo " Cluster: ${CLUSTER_NAME}"
71+
echo " Base Address: ${BASE_ADDRESS}"
72+
echo " Playwright Args: ${TEST_ARGS}"
73+
74+
75+
set +e
76+
echo "Starting Playwright test execution..."
77+
yarn playwright test \
78+
${TEST_ARGS}
79+
TEST_EXIT_CODE=$?
80+
set -e
81+
82+
log "Tests finished with exit code: $TEST_EXIT_CODE"
83+
84+
mkdir -p "${RESULTS_DIR}"
85+
[ -d "playwright-report" ] && cp -r "playwright-report" "${RESULTS_DIR}/"
86+
[ -d "test-results" ] && cp -r "test-results" "${RESULTS_DIR}/"
87+
88+
exit $TEST_EXIT_CODE

testing/yarn.lock

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,50 @@
22
# yarn lockfile v1
33

44

5-
"@playwright/[email protected]":
6-
version "1.54.2"
7-
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.54.2.tgz#ff0d1e5d8e26f3258ae65364e2d4d10176926b07"
8-
integrity sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==
5+
"@kubev2v/[email protected]":
6+
version "0.0.22"
7+
resolved "https://registry.npmjs.org/@kubev2v/types/-/types-0.0.22.tgz"
8+
integrity sha512-1s2RhE9zPf2esJzcy0KCbcso4SJE2Mp9ObV3We0c8KCGvp8i42xCxBIV9vMDiM14ZRlCUMo7gGB9GdZvexDURg==
9+
10+
"@playwright/[email protected]":
11+
version "1.55.0"
12+
resolved "https://registry.npmjs.org/@playwright/test/-/test-1.55.0.tgz"
13+
integrity sha512-04IXzPwHrW69XusN/SIdDdKZBzMfOT9UNT/YiJit/xpy2VuAoB8NHc8Aplb96zsWDddLnbkPL3TsmrS04ZU2xQ==
914
dependencies:
10-
playwright "1.54.2"
15+
playwright "1.55.0"
1116

1217
"@types/node@^20.0.0":
1318
version "20.19.9"
14-
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.9.tgz#ca9a58193fec361cc6e859d88b52261853f1f0d3"
19+
resolved "https://registry.npmjs.org/@types/node/-/node-20.19.9.tgz"
1520
integrity sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw==
1621
dependencies:
1722
undici-types "~6.21.0"
1823

1924
2025
version "2.3.2"
21-
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
26+
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
2227
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
2328

24-
playwright-core@1.54.2:
25-
version "1.54.2"
26-
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.54.2.tgz#73cc5106f19ec6b9371908603d61a7f171ebd8f0"
27-
integrity sha512-n5r4HFbMmWsB4twG7tJLDN9gmBUeSPcsBZiWSE4DnYz9mJMAFqr2ID7+eGC9kpEnxExJ1epttwR59LEWCk8mtA==
29+
playwright-core@1.55.0:
30+
version "1.55.0"
31+
resolved "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz"
32+
integrity sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==
2833

29-
playwright@1.54.2:
30-
version "1.54.2"
31-
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.54.2.tgz#e2435abb2db3a96a276f8acc3ada1a85b587dff3"
32-
integrity sha512-Hu/BMoA1NAdRUuulyvQC0pEqZ4vQbGfn8f7wPXcnqQmM+zct9UliKxsIkLNmz/ku7LElUNqmaiv1TG/aL5ACsw==
34+
playwright@1.55.0:
35+
version "1.55.0"
36+
resolved "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz"
37+
integrity sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==
3338
dependencies:
34-
playwright-core "1.54.2"
39+
playwright-core "1.55.0"
3540
optionalDependencies:
3641
fsevents "2.3.2"
3742

3843
typescript@^5.8.2:
3944
version "5.9.2"
40-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.2.tgz#d93450cddec5154a2d5cabe3b8102b83316fb2a6"
45+
resolved "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz"
4146
integrity sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==
4247

4348
undici-types@~6.21.0:
4449
version "6.21.0"
45-
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
50+
resolved "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz"
4651
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==

0 commit comments

Comments
 (0)