Skip to content

Commit e4d76c1

Browse files
author
Pedro Abreu
committed
upgrade playwright to 1.55
- Update Playwright from 1.54.2 to 1.55.0 - Update playwright.config.ts with new timeout and reporter settings - Add run-tests.sh script for containerized test execution - Update PlaywrightContainerFile with improved setup - Add Dockerfile for local testing - Update GitHub workflow for Playwright tests - Update testing README with new instructions Resolves: MTV-3470 Signed-off-by: Pedro Abreu <[email protected]>
1 parent 25d78bb commit e4d76c1

File tree

8 files changed

+204
-26
lines changed

8 files changed

+204
-26
lines changed

.github/workflows/on-push-main-playwright.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ jobs:
2525
- name: Build and push Docker image
2626
uses: docker/build-push-action@v5
2727
with:
28-
context: .
28+
context: ./testing
2929
file: ./testing/PlaywrightContainerFile
3030
push: true
3131
tags: quay.io/kubev2v/forklift-ui-tests:latest
32+
build-args: |
33+
VERSION=${{ github.ref_name }}
34+
GIT_COMMIT=${{ github.sha }}
35+
BUILD_DATE=${{ github.event.head_commit.timestamp }}
3236
3337
- name: Logout from Quay.io
3438
run: docker logout quay.io

testing/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM mcr.microsoft.com/playwright:v1.54.2-noble
2+
3+
# Cache busting argument - pass different value each build
4+
ARG BUILD_DATE
5+
ENV BUILD_DATE=${BUILD_DATE}
6+
7+
ENV LANG en_US.UTF-8
8+
ENV LANGUAGE en_US:en
9+
ENV LC_ALL en_US.UTF-8
10+
11+
RUN apt-get update && \
12+
apt-get install -y --no-install-recommends git locales && \
13+
rm -rf /var/lib/apt/lists/* && \
14+
locale-gen en_US.UTF-8
15+
16+
WORKDIR /test-runner
17+
18+
COPY package.json yarn.lock ./
19+
RUN corepack enable && \
20+
yarn install --frozen-lockfile --ignore-scripts && \
21+
npx playwright install --with-deps
22+
23+
COPY run-tests.sh .
24+
RUN chmod +x run-tests.sh && \
25+
chmod -R 755 /test-runner
26+
27+
USER 1001
28+
29+
CMD ["./run-tests.sh"]

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/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,24 @@ From the `testing` directory, run:
103103
```bash
104104
yarn test:downstream:remote:docker
105105
```
106+
107+
## Updating the Container Image
108+
109+
To build and push the test container image manually:
110+
111+
```bash
112+
cd testing
113+
114+
podman build \
115+
--no-cache \
116+
--platform linux/amd64 \
117+
--build-arg VERSION=main \
118+
--build-arg GIT_COMMIT=$(git rev-parse HEAD) \
119+
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
120+
-f PlaywrightContainerFile \
121+
-t quay.io/kubev2v/forklift-ui-tests:latest \
122+
.
123+
124+
podman login quay.io
125+
podman quay.io/kubev2v/forklift-ui-tests:latest
126+
```

testing/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"license": "ISC",
1414
"description": "",
1515
"devDependencies": {
16-
"playwright": "1.54.2",
17-
"@playwright/test": "1.54.2",
16+
"playwright": "1.55.0",
17+
"@playwright/test": "1.55.0",
1818
"@types/node": "^20.0.0",
1919
"typescript": "^5.8.2"
2020
},

testing/playwright.config.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ export default defineConfig({
88
testDir: './playwright/e2e',
99
timeout: process.env.JENKINS ? 15 * 60_000 : 60_000,
1010
fullyParallel: true,
11-
workers: 3,
11+
workers: process.env.CI ? 1 : 3,
1212

1313
retries: process.env.GITHUB_ACTIONS ? 3 : 0,
1414

15+
reporter: [['list'], ['html', { open: 'never' }]],
16+
1517
use: {
16-
actionTimeout: 5_000,
17-
navigationTimeout: 10_000,
18+
actionTimeout: 20_000,
19+
navigationTimeout: 20_000,
20+
},
21+
22+
expect: {
23+
timeout: 20_000,
1824
},
1925

2026
projects: [
@@ -30,6 +36,7 @@ export default defineConfig({
3036
viewport: { width: 1920, height: 1080 },
3137
screenshot: 'only-on-failure',
3238
video: 'retain-on-failure',
39+
trace: 'retain-on-failure',
3340
// Use data-testid to match actual rendered HTML
3441
testIdAttribute: 'data-testid',
3542
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: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
"@kubev2v/[email protected]":
66
version "0.0.22"
7-
resolved "https://registry.yarnpkg.com/@kubev2v/types/-/types-0.0.22.tgz#582091a79cdb159be7789dcd62a2632542592c60"
7+
resolved "https://registry.npmjs.org/@kubev2v/types/-/types-0.0.22.tgz"
88
integrity sha512-1s2RhE9zPf2esJzcy0KCbcso4SJE2Mp9ObV3We0c8KCGvp8i42xCxBIV9vMDiM14ZRlCUMo7gGB9GdZvexDURg==
99

10-
"@playwright/test@1.54.2":
11-
version "1.54.2"
12-
resolved "https://registry.npmjs.org/@playwright/test/-/test-1.54.2.tgz"
13-
integrity sha512-A+znathYxPf+72riFd1r1ovOLqsIIB0jKIoPjyK2kqEIe30/6jF6BC7QNluHuwUmsD2tv1XZVugN8GqfTMOxsA==
10+
"@playwright/test@1.55.0":
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==
1414
dependencies:
15-
playwright "1.54.2"
15+
playwright "1.55.0"
1616

1717
"@types/node@^20.0.0":
1818
version "20.19.9"
@@ -26,17 +26,17 @@ [email protected]:
2626
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
2727
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
2828

29-
playwright-core@1.54.2:
30-
version "1.54.2"
31-
resolved "https://registry.npmjs.org/playwright-core/-/playwright-core-1.54.2.tgz"
32-
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==
3333

34-
playwright@1.54.2:
35-
version "1.54.2"
36-
resolved "https://registry.npmjs.org/playwright/-/playwright-1.54.2.tgz"
37-
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==
3838
dependencies:
39-
playwright-core "1.54.2"
39+
playwright-core "1.55.0"
4040
optionalDependencies:
4141
fsevents "2.3.2"
4242

0 commit comments

Comments
 (0)