Skip to content

Commit cdd8c02

Browse files
committed
Added listener to backend-deployed event and reusable e2e tests
1 parent 77b9d68 commit cdd8c02

File tree

3 files changed

+66
-48
lines changed

3 files changed

+66
-48
lines changed

.github/workflows/backend-e2e.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Cypress E2E Tests
2+
3+
on:
4+
repository_dispatch:
5+
types: [backend-deployed]
6+
7+
jobs:
8+
e2e-tests:
9+
uses: ./.github/workflows/reusable-e2e.yml

.github/workflows/cypress-e2e.yml

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,4 @@ on:
1010

1111
jobs:
1212
e2e-tests:
13-
runs-on: ubuntu-latest
14-
15-
steps:
16-
- name: Checkout Frontend Repo
17-
uses: actions/checkout@v4
18-
19-
- name: Setup Node.js
20-
uses: actions/setup-node@v4
21-
with:
22-
node-version: 23
23-
cache: "npm"
24-
25-
- name: Install Frontend Dependencies
26-
run: npm install
27-
28-
- name: Checkout API Repo
29-
uses: actions/checkout@v4
30-
with:
31-
repository: marcomolina11/todos-mongo-api
32-
path: backend
33-
34-
- name: List Files in Backend Directory
35-
run: ls -la backend
36-
37-
- name: Start Backend with Docker Compose
38-
working-directory: backend
39-
run: docker compose up -d
40-
41-
- name: Wait for Backend to be Ready
42-
run: npx wait-on tcp:127.0.0.1:3000
43-
44-
- name: Start Frontend
45-
run: |
46-
nohup npm run start -- --host &
47-
48-
- name: Wait for Frontend to be Ready
49-
run: npx wait-on http://localhost:5173
50-
51-
- name: Run Cypress Tests
52-
run: npm run test:e2e:cicd
53-
env:
54-
API_URL: http://localhost:3000
55-
56-
- name: Stop Containers
57-
if: always()
58-
run: |
59-
cd backend
60-
docker compose down
13+
uses: ./.github/workflows/reusable-e2e.yml

.github/workflows/reusable-e2e.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Reusable E2E Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
e2e-tests:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Frontend Repo
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 23
18+
cache: "npm"
19+
20+
- name: Install Frontend Dependencies
21+
run: npm install
22+
23+
- name: Checkout API Repo
24+
uses: actions/checkout@v4
25+
with:
26+
repository: marcomolina11/todos-mongo-api
27+
path: backend
28+
29+
- name: List Files in Backend Directory
30+
run: ls -la backend
31+
32+
- name: Start Backend with Docker Compose
33+
working-directory: backend
34+
run: docker compose up -d
35+
36+
- name: Wait for Backend to be Ready
37+
run: npx wait-on tcp:127.0.0.1:3000
38+
39+
- name: Start Frontend
40+
run: |
41+
nohup npm run start -- --host &
42+
43+
- name: Wait for Frontend to be Ready
44+
run: npx wait-on http://localhost:5173
45+
46+
- name: Run Cypress Tests
47+
run: npm run test:e2e:cicd
48+
env:
49+
API_URL: http://localhost:3000
50+
51+
- name: Stop Containers
52+
if: always()
53+
run: |
54+
cd backend
55+
docker compose down
56+

0 commit comments

Comments
 (0)