]> Nutra Git (v1) - gamesguru/website-template-svkit-v2-legacy.git/commitdiff
feat: add playwright e2e tests
authorShane Jaroch <chown_tee@proton.me>
Sat, 10 Jan 2026 21:42:03 +0000 (16:42 -0500)
committerShane Jaroch <chown_tee@proton.me>
Sat, 10 Jan 2026 21:42:03 +0000 (16:42 -0500)
package.json
playwright.config.js [new file with mode: 0644]
tests/test.js [new file with mode: 0644]

index 20f858f1bdda0cf4f225a5ddb53214b9cae9d3dc..37d45adfce475bf826dabe1db989735898c815d8 100644 (file)
                "build": "vite build",
                "preview": "vite preview",
                "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
-               "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
+               "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
+               "test": "playwright test"
        },
        "devDependencies": {
+               "@playwright/test": "^1.28.1",
                "@sveltejs/adapter-auto": "^3.0.0",
                "@sveltejs/kit": "npm:@tg-svelte/kit@^2.49.4",
                "@sveltejs/vite-plugin-svelte": "^3.0.0",
diff --git a/playwright.config.js b/playwright.config.js
new file mode 100644 (file)
index 0000000..12665c2
--- /dev/null
@@ -0,0 +1,10 @@
+import { defineConfig } from '@playwright/test';
+
+export default defineConfig({
+       webServer: {
+               command: 'npm run build && npm run preview',
+               port: 4173
+       },
+       testDir: 'tests',
+       testMatch: /(.+\.)?(test|spec)\.[jt]s/
+});
diff --git a/tests/test.js b/tests/test.js
new file mode 100644 (file)
index 0000000..9985ce1
--- /dev/null
@@ -0,0 +1,6 @@
+import { expect, test } from '@playwright/test';
+
+test('home page has expected h1', async ({ page }) => {
+       await page.goto('/');
+       await expect(page.locator('h1')).toBeVisible();
+});