Skip to content

Commit 20b251b

Browse files
author
Pedro Abreu
committed
add additional Playwright upgrade files
- Add GitHub workflow for Playwright tests - Add Dockerfile for testing - Update README with Playwright information Resolves: MTV-3470 Signed-off-by: Pedro Abreu <[email protected]>
1 parent b9c5aa9 commit 20b251b

File tree

3 files changed

+58
-4
lines changed

3 files changed

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This is the most common method for running the e2e tests during development.
3939
```bash
4040
yarn test:e2e
4141
```
42-
This command runs all tests in a headless browser. To run them in headed mode, use `yarn test:e2e -- --headed`.
42+
This command runs all tests in a headless browser. To run them in headed mode, use `yarn test:e2e --headed`.
4343

4444
### Running Specific Test Suites
4545

@@ -50,7 +50,7 @@ If you want to run only a subset of the tests, you can use the following command
5050
```bash
5151
yarn test:upstream
5252
```
53-
To run them in headed mode, use `yarn test:upstream -- --headed`.
53+
To run them in headed mode, use `yarn test:upstream --headed`.
5454

5555
- **Downstream Tests Only:**
5656
Before running these, you'll need to create a `.providers.json` file in the `testing` directory to specify your provider's credentials.
@@ -68,7 +68,7 @@ If you want to run only a subset of the tests, you can use the following command
6868
```bash
6969
yarn test:downstream
7070
```
71-
To run them in headed mode, use `yarn test:downstream -- --headed`.
71+
To run them in headed mode, use `yarn test:downstream --headed`.
7272

7373

7474

@@ -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+
```

0 commit comments

Comments
 (0)