Skip to content

Commit 396f498

Browse files
authored
feat(ci): Add GitHub Actions workflow for frontend tests (#140)
* feat(ci): Add GitHub Actions workflow for frontend tests * feat(frontend/tests): move browser test configuration to vitest.config.ts * chore(readme): add frontend tests badge to README
1 parent ffb00cf commit 396f498

4 files changed

Lines changed: 62 additions & 10 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Frontend Tests
2+
3+
on:
4+
push:
5+
paths:
6+
- "frontend/**"
7+
pull_request:
8+
paths:
9+
- "frontend/**"
10+
11+
jobs:
12+
frontend-tests:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Check for Frontend Changes
20+
id: filter
21+
uses: dorny/paths-filter@v3
22+
with:
23+
filters: |
24+
frontend:
25+
- "frontend/**"
26+
27+
- name: Setup Node
28+
if: steps.filter.outputs.frontend == 'true'
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 24
32+
cache: npm
33+
cache-dependency-path: frontend/package-lock.json
34+
35+
- name: Install Frontend Dependencies
36+
if: steps.filter.outputs.frontend == 'true'
37+
working-directory: ./frontend
38+
run: npm ci
39+
40+
- name: Install Playwright Chromium
41+
if: steps.filter.outputs.frontend == 'true'
42+
working-directory: ./frontend
43+
run: npx playwright install --with-deps chromium
44+
45+
- name: Run Frontend Tests
46+
if: steps.filter.outputs.frontend == 'true'
47+
working-directory: ./frontend
48+
run: npm test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Linting](https://github.com/Darosss/StreamManager/actions/workflows/linting.yaml/badge.svg)](https://github.com/Darosss/StreamManager/actions/workflows/linting.yaml)
2-
32
[![Backend Tests](https://github.com/Darosss/StreamManager/actions/workflows/backend-tests.yaml/badge.svg)](https://github.com/Darosss/StreamManager/actions/workflows/backend-tests.yaml)
3+
[![Frontend Tests](https://github.com/Darosss/StreamManager/actions/workflows/frontend-tests.yaml/badge.svg)](https://github.com/Darosss/StreamManager/actions/workflows/frontend-tests.yaml)
44

55
# Stream Manager
66

frontend/vite.config.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import svgrPlugin from "vite-plugin-svgr";
55
import eslint from "@nabla/vite-plugin-eslint";
66
import path from "path";
77
import { visualizer } from "rollup-plugin-visualizer";
8-
import { playwright } from "@vitest/browser-playwright";
98

109
export default defineConfig({
1110
css: {
@@ -26,13 +25,6 @@ export default defineConfig({
2625
eslint(),
2726
visualizer({ filename: "dist/stats.html", template: "treemap" }),
2827
],
29-
test: {
30-
browser: {
31-
enabled: true,
32-
provider: playwright(),
33-
instances: [{ browser: "chromium" }],
34-
environment: "jsdom",
35-
},
36-
},
28+
3729
envDir: "../",
3830
});

frontend/vitest.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { playwright } from "@vitest/browser-playwright";
2+
import { defineConfig } from "vitest/config";
3+
4+
export default defineConfig({
5+
test: {
6+
browser: {
7+
enabled: true,
8+
provider: playwright(),
9+
instances: [{ browser: "chromium" }],
10+
},
11+
},
12+
});

0 commit comments

Comments
 (0)