Skip to content

Commit 6feefa7

Browse files
authored
Merge pull request #82 from AET-DevOps25/81-setup-e2e-tests
81 setup e2e tests
2 parents 315a4aa + c34aafc commit 6feefa7

Some content is hidden

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

44 files changed

+7186
-1134
lines changed

.github/workflows/ci-main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI – Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_call:
7+
8+
permissions: write-all
9+
10+
jobs:
11+
e2e-tests:
12+
uses: ./.github/workflows/e2e-tests.yml
13+
backend-tests:
14+
uses: ./.github/workflows/backend-tests.yml
15+
build-publish-images:
16+
needs:
17+
- e2e-tests
18+
- backend-tests
19+
uses: ./.github/workflows/docker.yml
20+
# TODO: add deployment as step
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI – Pull Request
2+
3+
on:
4+
pull_request:
5+
workflow_call:
6+
7+
permissions: write-all
8+
9+
jobs:
10+
e2e-tests:
11+
uses: ./.github/workflows/e2e-tests.yml
12+
backend-tests:
13+
uses: ./.github/workflows/backend-tests.yml
14+
build-publish-images:
15+
needs:
16+
- e2e-tests
17+
- backend-tests
18+
uses: ./.github/workflows/docker.yml

.github/workflows/docker.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
name: CI – Build & Publish
22

33
on:
4-
push:
5-
branches: [main]
6-
pull_request:
74
workflow_call:
85

96
permissions: write-all
107

118
jobs:
12-
backend-tests:
13-
uses: ./.github/workflows/backend-tests.yml
149
publish-docker-images:
15-
needs: backend-tests
1610
runs-on: ubuntu-latest
1711
steps:
1812
- name: Checkout code

.github/workflows/e2e-tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: E2E (UI) Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
run-e2e-tests:
8+
timeout-minutes: 60
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
name: Checkout
13+
14+
- uses: actions/setup-node@v4
15+
name: Setup Node
16+
with:
17+
node-version: lts/*
18+
19+
- uses: docker/setup-compose-action@v1
20+
name: Setup Docker
21+
22+
- name: Setup .env
23+
run: |
24+
cp docker/backend_config_files/.env.template docker/backend_config_files/.env
25+
26+
- name: Generate JWT Key
27+
run: |
28+
./docker/backend_config_files/jwk-key-generator.sh
29+
30+
- name: Start Docker Containers
31+
run: |
32+
docker compose up --build -d
33+
34+
- name: Install dependencies
35+
working-directory: ./client
36+
run: npm install -g pnpm && pnpm install
37+
38+
- name: Install Playwright Browsers
39+
working-directory: ./client
40+
run: pnpm exec playwright install --with-deps
41+
42+
- name: Run Playwright tests
43+
working-directory: ./client
44+
run: pnpm exec playwright test
45+
46+
- uses: actions/upload-artifact@v4
47+
if: ${{ !cancelled() }}
48+
with:
49+
name: playwright-report
50+
path: ./client/playwright-report/
51+
retention-days: 30

client/.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ dist-ssr
2121
*.ntvs*
2222
*.njsproj
2323
*.sln
24-
*.sw?
24+
*.sw?
25+
26+
# Playwright
27+
/test-results/
28+
/playwright-report/
29+
/blob-report/
30+
/playwright/.cache/

client/README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,39 @@ docker build -t mentor-pulse-client-image .
1515
To run the container:
1616

1717
```
18-
docker run -d --name mentor-pulse-client-container -p 80:80 mentor-pulse-client-image
18+
docker run -d --name mentor-pulse-client-container -p 3000:3000 mentor-pulse-client-image
1919
```
2020

2121
Or use the docker compose file in the root directory to build the entire application including server services.
22+
23+
## Testing (E2E/UI tests)
24+
25+
The client is tested using E2E/UI tests. We use playwright as the framework for testing.
26+
27+
### Execute tests
28+
29+
1. Start Services: Start docker with `docker compose up --build`.
30+
2. Configure Node: Execute `nvm use` to use the correct node version.
31+
3. Run Tests: `pnpm exec playwright test`
32+
4. Show Report: `pnpm exec playwright show-report`
33+
34+
## Execute tests with UI
35+
36+
Alternatively, you can also execute the tests using a UI.
37+
38+
1. Modify Configuration:
39+
40+
- Comment out `teardown: 'teardown'` in the project `setup` in the [playwright config](playwright.config.ts).
41+
- Comment out `dependencies: ['setup']` in the projcet `chromium`
42+
43+
2. Run Playwright UI: Execute the following command:
44+
45+
```
46+
pnpm exec playwright test --ui
47+
```
48+
49+
3. Run Projects
50+
51+
- Firstly, execute the `setup` project.
52+
- Then execute the tests you want to run.
53+
- Finally, execute the `teardown` project.

0 commit comments

Comments
 (0)