Skip to content

Commit 8613da6

Browse files
Typescript playwright start (#1078)
Co-authored-by: German Osin <[email protected]>
1 parent 772d137 commit 8613da6

37 files changed

+3799
-0
lines changed

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: cross-env ENV=prod HEAD=false BASEURL=http://localhost:8080 npm run test
56+

e2e-playwright/config/cucumber.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
publishQuiet: true,
12+
dryRun: false,
13+
require: [
14+
"src/steps/*.ts",
15+
"src/hooks/hooks.ts",
16+
"src/support/customWorld.ts"
17+
],
18+
requireModule: [
19+
"ts-node/register"
20+
],
21+
format: [
22+
"progress-bar",
23+
"html:test-results/cucumber-report.html",
24+
"json:test-results/cucumber-report.json",
25+
"rerun:@rerun.txt"
26+
],
27+
parallel: 1
28+
},
29+
rerun: {
30+
formatOptions: {
31+
snippetInterface: "async-await"
32+
},
33+
publishQuiet: true,
34+
dryRun: false,
35+
require: [
36+
"src/steps/*.ts",
37+
"src/hooks/hooks.ts",
38+
"src/support/customWorld.ts"
39+
],
40+
requireModule: [
41+
"ts-node/register"
42+
],
43+
format: [
44+
"progress-bar",
45+
"html:test-results/cucumber-report.html",
46+
"json:test-results/cucumber-report.json",
47+
"rerun:@rerun.txt"
48+
],
49+
parallel: 1
50+
}
51+
}

0 commit comments

Comments
 (0)