feat: Add comprehensive test suite with Playwright
Test Suite: - playwright.config.js: Config for dev environment (http://192.168.2.49:3098) - tests/dev-smoke-test.spec.js: 8 tests covering: * Login functionality * Dashboard loading * Navigation to Exercises/Clubs * Desktop-Sidebar visibility (≥1024px) * Bottom-Nav visibility (Mobile) * Session persistence after reload * Console error checking Gitea CI/CD: - .gitea/workflows/test.yml: Automated testing after deploy * Backend syntax check * Frontend build test * Playwright E2E tests * Screenshot upload on failure Test Coverage: - Auth flow (login, session persistence) - Responsive navigation (mobile + desktop) - Page navigation (dashboard, exercises, clubs) - Error detection (console errors) Next: Run tests locally, then implement Exercise CRUD
This commit is contained in:
1 parent
46a90ae910
commit
c44bbefc5e
3 files changed
+247
No files matched your search
@@ -0,0 +1,89 @@
|
||||
name: Test Suite
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
workflow_run:
|
||||
workflows: ["Deploy Development", "Deploy Production"]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
lint-backend:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check backend syntax
|
||||
run: |
|
||||
EVENT_NAME="${{ github.event_name }}"
|
||||
REF_NAME="${{ github.ref_name }}"
|
||||
RUN_WORKFLOW="${{ github.event.workflow_run.name }}"
|
||||
APP_DIR="/home/lars/docker/shinkan"
|
||||
|
||||
if [ "$EVENT_NAME" = "workflow_run" ]; then
|
||||
if [ "$RUN_WORKFLOW" = "Deploy Development" ]; then
|
||||
APP_DIR="/home/lars/docker/shinkan-dev"
|
||||
fi
|
||||
elif [ "$REF_NAME" = "develop" ]; then
|
||||
APP_DIR="/home/lars/docker/shinkan-dev"
|
||||
fi
|
||||
|
||||
python3 -m py_compile "$APP_DIR/backend/main.py"
|
||||
echo "✓ Backend syntax OK"
|
||||
|
||||
build-frontend:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build frontend
|
||||
run: |
|
||||
EVENT_NAME="${{ github.event_name }}"
|
||||
REF_NAME="${{ github.ref_name }}"
|
||||
RUN_WORKFLOW="${{ github.event.workflow_run.name }}"
|
||||
APP_DIR="/home/lars/docker/shinkan"
|
||||
|
||||
if [ "$EVENT_NAME" = "workflow_run" ]; then
|
||||
if [ "$RUN_WORKFLOW" = "Deploy Development" ]; then
|
||||
APP_DIR="/home/lars/docker/shinkan-dev"
|
||||
fi
|
||||
elif [ "$REF_NAME" = "develop" ]; then
|
||||
APP_DIR="/home/lars/docker/shinkan-dev"
|
||||
fi
|
||||
|
||||
cd "$APP_DIR/frontend"
|
||||
npm install
|
||||
npm run build
|
||||
echo "✓ Frontend build OK"
|
||||
|
||||
playwright-tests:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint-backend, build-frontend]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install Playwright
|
||||
run: |
|
||||
npm install -D @playwright/test
|
||||
npx playwright install chromium
|
||||
|
||||
- name: Run Playwright tests
|
||||
env:
|
||||
TEST_EMAIL: lars@stommer.com
|
||||
TEST_PASSWORD: 12345678
|
||||
run: |
|
||||
npx playwright test
|
||||
echo "✓ Playwright tests passed"
|
||||
|
||||
- name: Upload test screenshots
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-screenshots
|
||||
path: screenshots/
|
||||
retention-days: 7
|
||||
Reference in new issue
Block a user