Skip to content

Commit

Permalink
Try out using playwright for end to end tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Jan 14, 2025
1 parent 0d3f803 commit d42df8d
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 200 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
package_json_file: frontend/package.json
run_install: false
if: startsWith(matrix.noxenv, 'ui')
- name: Install playwright browsers
run: pnpm --dir frontend dlx playwright install --with-deps
if: matrix.noxenv == 'ui(tests)'

- name: Set up uv
uses: astral-sh/setup-uv@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _templates

/frontend/node_modules
/frontend/build
/frontend/test-results

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
6 changes: 6 additions & 0 deletions frontend/e2e/notFound.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { test, expect } from '@playwright/test';

test('shows 404 page for non-existent routes', async ({ page }) => {
await page.goto('/#/non-existent-route');
await expect(page.getByText('Page not found')).toBeVisible();
});
5 changes: 4 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"bundle-visualizer": "vite-bundle-visualizer",
"preview": "vite preview",
"lint": "eslint --max-warnings 0 src",
"test": "vitest run",
"test:unit": "vitest run",
"test:e2e": "playwright test",
"test": "vitest run; playwright test",
"watch-test": "vitest watch"
},
"dependencies": {
Expand All @@ -49,6 +51,7 @@
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@playwright/test": "^1.49.1",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.10.6",
"@types/react": "^19.0.7",
Expand Down
5 changes: 5 additions & 0 deletions frontend/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@playwright/test';

export default defineConfig({
testDir: 'e2e',
})
444 changes: 246 additions & 198 deletions frontend/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["src", "vite.config.ts"]
"include": [ "src", "e2e", "playwright.config.ts", "vite.config.ts" ]
}
1 change: 1 addition & 0 deletions frontend/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/e2e/**"],
environment: "jsdom",
},
});

0 comments on commit d42df8d

Please sign in to comment.