Skip to content

Commit 6035c22

Browse files
authored
Merge pull request #100 from claffin/ui-tests
feat: add comprehensive UI testing infrastructure
2 parents fdc7292 + 0dc8b92 commit 6035c22

File tree

19 files changed

+7028
-6691
lines changed

19 files changed

+7028
-6691
lines changed

.github/workflows/main.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- 'docs/**'
1010

1111
jobs:
12-
test:
13-
name: 🧪 Test Suite
12+
backend-test:
13+
name: 🐍 Backend Test Suite
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: 📥 Checkout code
@@ -36,10 +36,69 @@ jobs:
3636
uses: codecov/test-results-action@v1
3737
with:
3838
token: ${{ secrets.CODECOV_TOKEN }}
39+
flags: backend
40+
41+
frontend-test:
42+
name: 🎨 Frontend Test Suite
43+
runs-on: ubuntu-latest
44+
defaults:
45+
run:
46+
working-directory: ./cloudproxy-ui
47+
steps:
48+
- name: 📥 Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: 🟢 Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: '20'
55+
cache: 'npm'
56+
cache-dependency-path: cloudproxy-ui/package-lock.json
57+
58+
- name: 📦 Cache Cypress binary
59+
uses: actions/cache@v3
60+
with:
61+
path: ~/.cache/Cypress
62+
key: cypress-${{ runner.os }}-${{ hashFiles('cloudproxy-ui/package-lock.json') }}
63+
64+
- name: 📦 Install dependencies
65+
run: npm ci
66+
67+
- name: 🔍 Run linting
68+
run: npm run lint
69+
continue-on-error: true
70+
71+
- name: 🧪 Run unit tests with coverage
72+
run: npm run test:coverage
73+
74+
- name: 🏗️ Build production bundle
75+
run: npm run build
76+
77+
- name: 🌐 Start dev server for E2E tests
78+
run: |
79+
npm run serve &
80+
npx wait-on http://localhost:8080 --timeout 30000
81+
82+
- name: 🎭 Run E2E tests
83+
run: npm run test:e2e
84+
85+
- name: 📸 Upload E2E test artifacts
86+
if: failure()
87+
uses: actions/upload-artifact@v3
88+
with:
89+
name: cypress-screenshots
90+
path: cloudproxy-ui/cypress/screenshots
91+
92+
- name: 📊 Upload coverage to Codecov
93+
uses: codecov/codecov-action@v3
94+
with:
95+
token: ${{ secrets.CODECOV_TOKEN }}
96+
directory: ./cloudproxy-ui/coverage
97+
flags: frontend
3998

4099
prepare-release:
41100
name: 🏷️ Prepare Release
42-
needs: test
101+
needs: [backend-test, frontend-test]
43102
runs-on: ubuntu-latest
44103
outputs:
45104
new_version: ${{ steps.set_outputs.outputs.new_version }}

.github/workflows/python-app-testing.yml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ on:
2121

2222
jobs:
2323

24-
build:
25-
name: Testing
24+
backend-test:
25+
name: 🐍 Backend Testing
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v2
@@ -54,3 +54,52 @@ jobs:
5454
uses: codecov/codecov-action@v1
5555
with:
5656
token: ${{ secrets.CODECOV_TOKEN }}
57+
flags: backend
58+
name: backend-coverage
59+
60+
frontend-test:
61+
name: 🎨 Frontend Testing
62+
runs-on: ubuntu-latest
63+
defaults:
64+
run:
65+
working-directory: ./cloudproxy-ui
66+
steps:
67+
- name: 📥 Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: 🟢 Setup Node.js
71+
uses: actions/setup-node@v4
72+
with:
73+
node-version: '20'
74+
cache: 'npm'
75+
cache-dependency-path: cloudproxy-ui/package-lock.json
76+
77+
- name: 📦 Install dependencies
78+
run: npm ci
79+
80+
- name: 🔍 Run linting
81+
run: npm run lint
82+
continue-on-error: true # Don't fail on lint warnings
83+
84+
- name: 🧪 Run unit tests with coverage
85+
run: npm run test:coverage
86+
87+
- name: 🏗️ Build production bundle
88+
run: npm run build
89+
90+
- name: 📊 Upload coverage to Codecov
91+
uses: codecov/codecov-action@v3
92+
with:
93+
token: ${{ secrets.CODECOV_TOKEN }}
94+
directory: ./cloudproxy-ui/coverage
95+
flags: frontend
96+
name: frontend-coverage
97+
fail_ci_if_error: false
98+
99+
testing:
100+
name: Testing
101+
needs: [backend-test, frontend-test]
102+
runs-on: ubuntu-latest
103+
steps:
104+
- name: ✅ All tests passed
105+
run: echo "All tests completed successfully"

.gitignore

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ dmypy.json
132132
.DS_Store
133133
node_modules
134134
/dist
135-
135+
cloudproxy-ui/dist
136+
cloudproxy-ui/node_modules
136137

137138
# local env files
138139
.env.local
@@ -154,3 +155,22 @@ pnpm-debug.log*
154155
*.sw?
155156
.cursor-project-context
156157
CLAUDE.md
158+
159+
# Testing artifacts
160+
cloudproxy-ui/coverage
161+
cloudproxy-ui/.nyc_output
162+
cloudproxy-ui/cypress/screenshots
163+
cloudproxy-ui/cypress/videos
164+
cloudproxy-ui/cypress/downloads
165+
cloudproxy-ui/test-results
166+
167+
# Package manager
168+
yarn.lock
169+
cloudproxy-ui/yarn.lock
170+
cloudproxy-ui/package-lock.json.bak
171+
172+
# Build artifacts
173+
*.log
174+
.cache
175+
.temp
176+
.tmp

cloudproxy-ui/cypress.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { defineConfig } = require('cypress');
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
baseUrl: 'http://localhost:8080',
6+
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
7+
supportFile: 'cypress/support/e2e.js',
8+
video: false,
9+
screenshotOnRunFailure: true,
10+
viewportWidth: 1280,
11+
viewportHeight: 720,
12+
defaultCommandTimeout: 10000,
13+
requestTimeout: 10000,
14+
responseTimeout: 10000,
15+
setupNodeEvents(on, config) {
16+
// implement node event listeners here
17+
},
18+
},
19+
component: {
20+
devServer: {
21+
framework: 'vue',
22+
bundler: 'webpack',
23+
},
24+
specPattern: 'src/**/*.cy.{js,jsx,ts,tsx}',
25+
},
26+
});

0 commit comments

Comments
 (0)