When i run npm test after timeout i get these results:
Running 0 tests using 0 workers[Webserver]... some unused css selectors messages[WebServer]Error: Timed out waiting 60000ms from config.webServer.
I did research on google. But materials are very limited and could not resolve my problem.npm test:unit works.
I am out of ideas what can i do. Below is information about the files.
playwright.config.js
/ @type {import('@playwright/test').PlaywrightTestConfig} */const config = { webServer: { command: 'npm run build && npm run preview', port: 4173 }, testDir: 'uat', timeout: 6000};export default config;
svelte.config.js
import adapter from '@sveltejs/adapter-node';import { vitePreprocess } from '@sveltejs/kit/vite';/ @type {import('@sveltejs/kit').Config} /const config = { onwarn: (warning, handler) => { if (warning.code.startsWith('a11y-')) { return; } handler(warning); }, preprocess: [vitePreprocess()], kit: { adapter: adapter() }};export default config;
vite.config.js
import { sveltekit } from '@sveltejs/kit/vite'import { socketPlugin } from './server/socket_plugin.js'const config = { server: { port: 3000 }, preview: { port: 3000 }, plugins: [ sveltekit(), socketPlugin ], test: { include: ['src/**/.{test,spec}.{js,ts}'] }}export default config;
package.json
"scripts": {"dev": "vite dev","build": "vite build","preview": "vite preview","test": "playwright test","test:unit": "vitest"}
directory
...uat test.js
test.js
import { expect, test } from '@playwright/test';test('index page has expected h1', async ({ page }) => { await page.goto('/'); expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');});