Skip to content

Commit a7374bf

Browse files
authored
Merge branch 'main' into issue/919
2 parents d25b87d + 80de2e7 commit a7374bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3902
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: "E2E: Playwright Manual run"
2+
on:
3+
workflow_dispatch:
4+
sha:
5+
required: true
6+
type: string
7+
8+
permissions:
9+
contents: read
10+
checks: write
11+
statuses: write
12+
13+
jobs:
14+
build-and-test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # infered from @v4
19+
with:
20+
token: ${{ github.token }}
21+
ref: ${{ inputs.sha }}
22+
- name: Set up JDK
23+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # infered from @v4
24+
with:
25+
java-version: '21'
26+
distribution: 'zulu'
27+
cache: 'gradle'
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 18
33+
34+
- name: Install NPM dependencies
35+
working-directory: ./e2e-playwright
36+
run: npm install
37+
38+
- name: Cache Playwright browser binaries
39+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
40+
id: playwright-cache
41+
with:
42+
path: ~/.cache/ms-playwright
43+
key: ${{ runner.os }}-playwright-${{ hashFiles('./e2e-playwright/package-lock.json') }}
44+
45+
- name: Cache apt binaries
46+
uses: awalsh128/cache-apt-pkgs-action@5902b33ae29014e6ca012c5d8025d4346556bd40
47+
with:
48+
packages: fonts-freefont-ttf fonts-ipafont-gothic fonts-tlwg-loma-otf fonts-unifont fonts-wqy-zenhei glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good libaa1 libabsl20220623t64 libass9 libasyncns0 libavc1394-0 libavcodec60 libavfilter9 libavformat60 libavif16 libavtp0 libavutil58 libblas3 libbluray2 libbs2b0 libcaca0 libcairo-script-interpreter2 libcdparanoia0 libchromaprint1 libcjson1 libcodec2-1.2 libdav1d7 libdc1394-25 libdca0 libdecor-0-0 libdirectfb-1.7-7t64 libdv4t64 libdvdnav4 libdvdread8t64 libegl-mesa0 libegl1 libevent-2.1-7t64 libfaad2 libflac12t64 libflite1 libfluidsynth3 libfreeaptx0 libgav1-1 libgles2 libgme0 libgraphene-1.0-0 libgsm1 libgssdp-1.6-0 libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0 libgtk-4-1 libgtk-4-common libgupnp-1.6-0 libgupnp-igd-1.6-0 libharfbuzz-icu0 libhwy1t64 libhyphen0 libiec61883-0 libimath-3-1-29t64 libinstpatch-1.0-2 libjack-jackd2-0 libjxl0.7 liblapack3 liblc3-1 libldacbt-enc2 liblilv-0-0 liblrdf0 libltc11 libmanette-0.2-0 libmbedcrypto7t64 libmfx1 libmjpegutils-2.1-0t64 libmodplug1 libmp3lame0 libmpcdec6 libmpeg2encpp-2.1-0t64 libmpg123-0t64 libmplex2-2.1-0t64 libmysofa1 libneon27t64 libnice10 libopenal-data libopenal1 libopenexr-3-1-30 libopenh264-7 libopenmpt0t64 libopenni2-0 libopus0 liborc-0.4-0t64 libpipewire-0.3-0t64 libplacebo338 libpocketsphinx3 libpostproc57 libproxy1v5 libpulse0 libqrencode4 libraptor2-0 librav1e0 libraw1394-11 librist4 librsvg2-2 librubberband2 libsamplerate0 libsbc1 libsdl2-2.0-0 libsecret-1-0 libsecret-common libserd-0-0 libshine3 libshout3 libsndfile1 libsndio7.0 libsord-0-0 libsoundtouch1 libsoup-3.0-0 libsoup-3.0-common libsoxr0 libspa-0.2-modules libspandsp2t64 libspeex1 libsphinxbase3t64 libsratom-0-0 libsrt1.5-gnutls libsrtp2-1 libssh-gcrypt-4 libsvtav1enc1d1 libswresample4 libswscale7 libtag1v5 libtag1v5-vanilla libtheora0 libtwolame0 libudfread0 libunibreak5 libv4l-0t64 libv4lconvert0t64 libva-drm2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvorbisenc2 libvpl2 libvpx9 libwavpack1 libwebrtc-audio-processing1 libwildmidi2 libwoff1 libx264-164 libx265-199 libxcb-xkb1 libxkbcommon-x11-0 libxvidcore4 libyuv0 libzbar0t64 libzimg2 libzix-0-0 libzvbi-common libzvbi0t64 libzxing3 ocl-icd-libopencl1 session-migration timgm6mb-soundfont xfonts-cyrillic xfonts-encodings xfonts-scalable xfonts-utils
49+
50+
- name: Install Playwright browsers
51+
working-directory: ./e2e-playwright
52+
run: npx playwright install --with-deps
53+
54+
- name: Build with Gradle
55+
id: build_app
56+
run: |
57+
./gradlew build \
58+
-x :e2e-tests:check \
59+
-x :e2e-tests:build \
60+
-x test \
61+
-Pbuild-docker-images=true \
62+
-Pinclude-frontend=true \
63+
-Pversion=latest
64+
65+
- name: Run docker-compose
66+
run: docker compose -f ./documentation/compose/e2e-tests.yaml up -d
67+
68+
- name: Run tests with ENV=prod
69+
working-directory: ./e2e-playwright
70+
run: ENV=prod npm run test
71+
72+
- name: Upload report
73+
if: failure()
74+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # infered from @v4
75+
with:
76+
name: playwright-results
77+
path: ./e2e-playwright/test-results/
78+
retention-days: 7
79+
80+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ node_modules/
4949
out/
5050
node_modules/
5151
.gradle
52+
@rerun.txt
53+
test-results

e2e-playwright/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/playwright:v1.52.0-jammy
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
RUN npm install
7+
8+
COPY . .
9+
10+
RUN npx playwright install
11+
12+
CMD ["npm", "test"]

e2e-playwright/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 🧪 kafbat-e2e-playwright
2+
End-to-End UI test automation using **Playwright**, **Cucumber.js**, and **TypeScript**.
3+
---
4+
5+
## Prerequisites
6+
7+
- **Node.js** >= 18
8+
- **npm** or **yarn**
9+
- Install dependencies and Playwright browsers:
10+
11+
```bash
12+
Local run:
13+
Run kafbat (docker compose -f ./documentation/compose/e2e-tests.yaml up -d)
14+
npm install
15+
npx playwright install
16+
17+
🔹 Normal Test Run
18+
npm test:stage
19+
20+
🔹 Debug Mode (with Playwright Inspector)
21+
npm run debug
22+
23+
🔹 Rerun Failed Tests
24+
npm run test:failed
25+
26+
27+
Gihub action CI example
28+
name: CI
29+
30+
on:
31+
push:
32+
branches: [ main ]
33+
pull_request:
34+
35+
jobs:
36+
container-test-job:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout repo
41+
uses: actions/checkout@v3
42+
43+
- name: Set up Node.js
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: 18
47+
48+
- name: Install NPM dependencies
49+
run: npm install
50+
51+
- name: Install Playwright browsers
52+
run: npx playwright install
53+
54+
- name: 🚀 Run tests with ENV=prod
55+
run: ENV=prod HEAD=false BASEURL=http://localhost:8080 npm run test
56+

e2e-playwright/config/cucumber.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = {
2+
default: {
3+
timeout: 30000,
4+
tags: process.env.npm_config_TAGS || "",
5+
formatOptions: {
6+
snippetInterface: "async-await"
7+
},
8+
paths: [
9+
"src/features/"
10+
],
11+
dryRun: false,
12+
require: [
13+
"src/steps/*.ts",
14+
"src/hooks/hooks.ts",
15+
"src/support/customWorld.ts"
16+
],
17+
requireModule: [
18+
"ts-node/register"
19+
],
20+
format: [
21+
"html:test-results/cucumber-report.html",
22+
"json:test-results/cucumber-report.json",
23+
"rerun:@rerun.txt"
24+
],
25+
parallel: 1
26+
},
27+
rerun: {
28+
formatOptions: {
29+
snippetInterface: "async-await"
30+
},
31+
publishQuiet: true,
32+
dryRun: false,
33+
require: [
34+
"src/steps/*.ts",
35+
"src/hooks/hooks.ts",
36+
"src/support/customWorld.ts"
37+
],
38+
requireModule: [
39+
"ts-node/register"
40+
],
41+
format: [
42+
"html:test-results/cucumber-report.html",
43+
"json:test-results/cucumber-report.json",
44+
"rerun:@rerun.txt"
45+
],
46+
parallel: 1
47+
}
48+
}

0 commit comments

Comments
 (0)