Skip to content

Commit 4c30e4b

Browse files
committed
frontend tests use e2e reusable workflow
1 parent 2887e99 commit 4c30e4b

File tree

2 files changed

+6
-125
lines changed

2 files changed

+6
-125
lines changed
Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: 'Frontend tests'
22

3-
#on: [push]
3+
on:
4+
push:
5+
46
jobs:
57
unit-tests:
68
runs-on: ubuntu-24.04
@@ -22,68 +24,7 @@ jobs:
2224
- name: Run unit tests
2325
run: npm test
2426

25-
get-e2e-files:
26-
runs-on: ubuntu-24.04
27-
outputs:
28-
file_list: ${{ steps.generate-file-list.outputs.file_list }}
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v4
32-
33-
- name: Generate file list
34-
id: generate-file-list
35-
run: |
36-
FILES=$(ls frontend/cypress/e2e | jq -R . | jq -s . | jq -c)
37-
echo $FILES
38-
echo "file_list=$FILES" >> $GITHUB_OUTPUT
39-
4027
e2e:
41-
needs: get-e2e-files
42-
runs-on: ubuntu-24.04
43-
strategy:
44-
fail-fast: false
45-
matrix:
46-
file: ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
47-
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v4
50-
51-
- name: Set up JDK ${{vars.JAVA_VERSION}}
52-
uses: actions/setup-java@v4
53-
with:
54-
java-version: ${{vars.JAVA_VERSION}}
55-
distribution: 'temurin'
56-
57-
- name: run keycloak docker
58-
run: |
59-
docker run -d \
60-
--name my_keycloak \
61-
-e KC_BOOTSTRAP_ADMIN_USERNAME=admin26 \
62-
-e KC_BOOTSTRAP_ADMIN_PASSWORD=keycloak26 \
63-
-v ./docker/config/realm-export-pitc.json:/opt/keycloak/data/import/realm-pitc.json \
64-
-p 8544:8080 \
65-
quay.io/keycloak/keycloak:26.0.1 \
66-
start-dev --import-realm
67-
68-
- name: start backend
69-
run: cd ./backend && mvn spring-boot:run -Dspring-boot.run.profiles=integration-test &
70-
71-
- name: Cypress run e2e tests
72-
uses: cypress-io/github-action@v6
73-
with:
74-
working-directory: frontend
75-
start: npm start
76-
wait-on: 'http://pitc.okr.localhost:8080/config, http://pitc.okr.localhost:4200, http://localhost:8544'
77-
wait-on-timeout: 120
78-
browser: chrome
79-
headed: false
80-
spec: cypress/e2e/${{ matrix.file }}
81-
82-
- uses: actions/upload-artifact@v4
83-
if: always()
84-
with:
85-
name: cypress-screenshots for ${{ matrix.file }}
86-
path: frontend/cypress/screenshots
87-
88-
- name: remove docker containers
89-
run: docker ps -aq | xargs -r docker rm -f
28+
uses: ./.github/workflows/reusable__e2e-testing.yml
29+
with:
30+
COMMIT_HASH: ${{ github.ref}}

.github/workflows/reusable__e2e-testing.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -48,69 +48,9 @@ jobs:
4848
fi
4949
echo "file_list=$FILES" >> $GITHUB_OUTPUT
5050
51-
# # Job to run tests in parallel based on the discovered files
52-
# e2e-docker:
53-
# needs: get-e2e-files
54-
# if: needs.get-e2e-files.outputs.file_list != '[]' && inputs.DOCKER_IMAGE_TAG != ''
55-
# runs-on: ubuntu-latest # Or ubuntu-24.04
56-
# strategy:
57-
# fail-fast: false # Continue running other tests even if one fails
58-
# matrix:
59-
# file: ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
60-
# env:
61-
# IMAGE_FILE_NAME: okr-docker-image.tar
62-
#
63-
# steps:
64-
# - run: echo "${{ github.run_id }}"
65-
# - name: Checkout Target Repo Code (for Cypress config/plugins)
66-
# uses: actions/checkout@v4
67-
#
68-
# - name: Download Docker image artifact
69-
# uses: actions/download-artifact@v4
70-
# with:
71-
# name: okr-image
72-
# path: ${{ runner.temp }}
73-
#
74-
# - name: Load image into Docker
75-
# run: docker load --input ${{ runner.temp }}/okr-docker-image.tar
76-
#
77-
# # --- E2E Test Execution Steps (Adjust as needed) ---
78-
# - name: Set up Docker Compose / Start Services (if needed)
79-
# run: cd docker && docker compose up -d keycloak-pitc
80-
#
81-
# - name: Run Application Container
82-
# run: |
83-
# docker run --network=host \
84-
# -e SPRING_PROFILES_ACTIVE=integration-test \
85-
# ${{inputs.DOCKER_IMAGE_TAG }} &
86-
#
87-
# - name: Set up node for Cypress
88-
# uses: actions/setup-node@v4
89-
# with:
90-
# node-version: ${{vars.NODE_VERSION}}
91-
#
92-
# - name: Cypress run e2e tests
93-
# uses: cypress-io/github-action@v6
94-
# with:
95-
# build: npm i -D cypress
96-
# working-directory: frontend
97-
# install: false
98-
# wait-on: 'http://pitc.okr.localhost:8080/config, http://localhost:8544'
99-
# wait-on-timeout: 120
100-
# browser: chrome
101-
# headed: false
102-
# config: baseUrl=http://pitc.okr.localhost:8080
103-
# spec: cypress/e2e/${{ matrix.file }}
104-
#
105-
# - uses: actions/upload-artifact@v4
106-
# if: always()
107-
# with:
108-
# name: cypress-screenshots for ${{ matrix.file }}
109-
# path: frontend/cypress/screenshots
11051
11152
e2e:
11253
needs: get-e2e-files
113-
# if: needs.get-e2e-files.outputs.file_list != '[]' && inputs.COMMIT_HASH != ''
11454
runs-on: ubuntu-latest # Or ubuntu-24.04
11555
strategy:
11656
fail-fast: false # Continue running other tests even if one fails

0 commit comments

Comments
 (0)