Skip to content

Commit 2de795e

Browse files
authored
Merge pull request #121 from cobainayush-dotcom/main
Improving test coverage
2 parents c344361 + 96c5709 commit 2de795e

32 files changed

+7353
-5109
lines changed
Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
1-
name: Backend Tests
2-
3-
on:
4-
pull_request:
5-
paths:
6-
- 'backend/**'
7-
8-
- '.github/workflows/backend-tests.yml'
9-
push:
10-
branches:
11-
- main
12-
- develop
13-
paths:
14-
- 'backend/**'
15-
16-
- name: Upload test results
17-
if: always()
18-
uses: actions/upload-artifact@v4
19-
with:
20-
name: test-results-${{ matrix.node-version }}
21-
path: backend/coverage/
22-
if-no-files-found: ignore
23-
24-
- name: Validate deployment compose config and build
25-
if: matrix.node-version == '20.x'
26-
run: |
27-
docker compose -f deployment/docker-compose.yml config
28-
docker compose -f deployment/docker-compose.yml build frontend backend
1+
name: Backend Tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'backend/**'
7+
- '.github/workflows/backend-tests.yml'
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
paths:
13+
- 'backend/**'
14+
- '.github/workflows/backend-tests.yml'
15+
16+
jobs:
17+
backend-tests:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
node-version: ['20.x']
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: npm
31+
cache-dependency-path: backend/package-lock.json
32+
33+
- name: Install dependencies
34+
working-directory: ./backend
35+
run: npm ci
36+
37+
- name: Run backend tests with coverage
38+
working-directory: ./backend
39+
run: npm run test:coverage
40+
41+
- name: Upload backend coverage artifact
42+
if: always()
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: backend-coverage-${{ matrix.node-version }}
46+
path: backend/coverage/
47+
if-no-files-found: error

.github/workflows/e2e-tests.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ jobs:
5757
npm run build
5858
npm start &
5959
echo "Backend started"
60-
sleep 5
60+
for i in {1..20}; do
61+
if curl -sf http://localhost:3001/health > /dev/null; then
62+
echo "Backend healthy"
63+
break
64+
fi
65+
sleep 2
66+
done
6167
working-directory: ./backend
6268

6369
- name: Run Playwright tests
@@ -67,10 +73,18 @@ jobs:
6773
run: npx playwright test
6874
working-directory: ./frontend
6975

70-
- name: Upload artifact on failure
76+
- name: Upload Playwright report
7177
uses: actions/upload-artifact@v4
7278
if: always()
7379
with:
7480
name: playwright-report
7581
path: frontend/playwright-report/
7682
retention-days: 30
83+
84+
- name: Upload Playwright test results
85+
uses: actions/upload-artifact@v4
86+
if: always()
87+
with:
88+
name: playwright-test-results
89+
path: frontend/test-results/
90+
retention-days: 30
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Frontend Tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'frontend/**'
7+
- '.github/workflows/frontend-tests.yml'
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
paths:
13+
- 'frontend/**'
14+
- '.github/workflows/frontend-tests.yml'
15+
16+
jobs:
17+
frontend-tests:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
cache: npm
28+
cache-dependency-path: frontend/package-lock.json
29+
30+
- name: Install dependencies
31+
working-directory: ./frontend
32+
run: npm ci
33+
34+
- name: Run frontend unit tests with coverage
35+
working-directory: ./frontend
36+
run: npm run test:coverage
37+
38+
- name: Upload frontend coverage artifact
39+
if: always()
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: frontend-coverage
43+
path: frontend/coverage/
44+
if-no-files-found: error

backend/data/portfolio.db-shm

0 Bytes
Binary file not shown.

backend/data/portfolio.db-wal

12.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)