Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Test Suite

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linting
run: npm run lint

- name: Run type checking
run: npm run type-check

- name: Run unit tests
run: npm run test:ci

- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella

e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npm run test:e2e:install

- name: Run E2E tests
run: npm run test:e2e
env:
CI: true

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: test-results/
retention-days: 30

visual-tests:
name: Visual Regression Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npm run test:e2e:install

- name: Run visual tests
run: npx playwright test --grep "Visual Regression Tests"
env:
CI: true

- name: Upload visual test results
uses: actions/upload-artifact@v3
if: always()
with:
name: visual-test-results
path: test-results/
retention-days: 30

test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [unit-tests, e2e-tests, visual-tests]
if: always()

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Generate test summary
run: |
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "### Unit Tests: ${{ needs.unit-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "### E2E Tests: ${{ needs.e2e-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "### Visual Tests: ${{ needs.visual-tests.result }}" >> $GITHUB_STEP_SUMMARY

if [ "${{ needs.unit-tests.result }}" == "success" ]; then
echo "✅ Unit tests passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Unit tests failed" >> $GITHUB_STEP_SUMMARY
fi

if [ "${{ needs.e2e-tests.result }}" == "success" ]; then
echo "✅ E2E tests passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ E2E tests failed" >> $GITHUB_STEP_SUMMARY
fi

if [ "${{ needs.visual-tests.result }}" == "success" ]; then
echo "✅ Visual tests passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Visual tests failed" >> $GITHUB_STEP_SUMMARY
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ dist-ssr
**/.env

ai-crew/
coverage/
17 changes: 17 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ alias c := clean
alias v := upgrade_version
alias rc := remove_colima

alias t := test

kill_tauri_runs:
echo "Killing tauri runs"
ps aux | grep "npm run tauri" | grep -v grep | awk '{print $2}' | xargs -r kill -9
Expand All @@ -32,6 +34,9 @@ clean:
echo "Cleaning up..."
rm -rf dist
rm -rf node_modules
rm -rf coverage
rm -rf test-results
rm -rf playwright-report
cd src-tauri && cargo clean && cd ..

tauri_dev:
Expand All @@ -40,6 +45,12 @@ tauri_dev:
tauri_build:
SENTRY_DSN="$SENTRY_DSN" npm run tauri build

test:
#!/usr/bin/env bash
echo "🚀 Running all tests (unit + E2E)..."
npm run test


install:
#!/usr/bin/env bash
echo "🚀 Setting up development environment..."
Expand All @@ -58,6 +69,10 @@ install:
rustup component add rustfmt
rustup component add clippy

# Install Playwright browsers for E2E testing
echo "🌐 Installing Playwright browsers..."
npm run test:e2e:install

# Setup environment variables for Nookat
echo "Setting up environment variables for Nookat..."

Expand All @@ -74,6 +89,8 @@ install:
echo "📝 Please edit .env file and add your Aptabase app key:"
echo "✅ Development environment setup complete!"
echo "💡 Run 'just p' to run pre-commit checks"
echo "🧪 Run 'just t' to run unit tests"
echo "🌐 Run 'just te' to run E2E tests"

pre_commit:
#!/usr/bin/env bash
Expand Down
22 changes: 17 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ repos:
rev: v9.9.1
hooks:
- id: eslint
name: check for eslint errors
files: \.(js|ts|tsx)$
types: [file]
additional_dependencies:
Expand All @@ -34,14 +35,15 @@ repos:
rev: v4.0.0-alpha.8
hooks:
- id: prettier
name: check for prettier errors
files: \.(js|ts|tsx|json|css|md)$
types: [file]

# TypeScript type checking
- repo: local
hooks:
- id: typescript-check
name: TypeScript Check
name: check for typescript errors
entry: npx tsc --noEmit
language: system
files: \.(ts|tsx)$
Expand All @@ -51,17 +53,27 @@ repos:
- repo: local
hooks:
- id: npm-run-lint
name: Npm Run Lint
name: check for eslint errors
entry: npm run lint -- --max-warnings=0
language: system
files: \.(ts|tsx)$
pass_filenames: false

# Frontend unit tests (Jest) - run only tests related to changed files
- repo: local
hooks:
- id: jest-unit-related
name: check for jest errors
entry: bash -c 'npm run test'
language: system
files: \.(ts|tsx)$
pass_filenames: true

# Cargo fmt for Rust
- repo: local
hooks:
- id: cargo-fmt
name: Cargo Fmt
name: check for cargo fmt errors
entry: bash -c 'cd src-tauri && cargo fmt -- --quiet'
language: system
files: \.(rs|toml)$
Expand All @@ -71,7 +83,7 @@ repos:
- repo: local
hooks:
- id: cargo-check
name: Cargo Check
name: check for cargo check errors
entry: bash -c 'cd src-tauri && cargo check'
language: system
files: \.(rs|toml)$
Expand All @@ -81,7 +93,7 @@ repos:
- repo: local
hooks:
- id: cargo-test
name: Cargo Test
name: check for cargo test errors
entry: bash -c 'cd src-tauri && cargo test'
language: system
files: \.(rs|toml)$
Expand Down
Loading
Loading