fix: add preview.allowedHosts and preview.host to vite.config.ts Vite preview server blocks requests from non-localhost hosts by default. In the E2E Docker Compose stack, Playwright accesses the frontend via http://frontend (container hostname). Without allowedHosts, Vite returns "Blocked request. This host is not allowed." and the SPA never mounts, causing all 59 E2E tests to fail with blank pages and missing elements. - Add preview.host: true (bind to 0.0.0.0) - Add preview.allowedHosts: ['frontend', 'localhost'] test: update payment-redirect E2E tests to match current UI The payment page was redesigned to a two-step confirmation flow: "Jag har betalat" → confirmation → "Ja, jag har betalat". The E2E tests still referenced the old single-step "Genomför testbetalning" button and a removed .payment__note CSS class. - Update 'payment button marks order as paid' to click through both steps - Rename 'shows mock payment note' to 'shows Swish payment instructions' and assert on actual UI elements (Swish label + payment button) Result: E2E suite now passes 59/59 tests in the Docker Compose CI stack.
44 lines
978 B
TypeScript
44 lines
978 B
TypeScript
/// <reference types="vitest/config" />
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
proxy: {
|
|
'/api': 'http://backend:8080',
|
|
},
|
|
},
|
|
preview: {
|
|
port: 80,
|
|
host: true,
|
|
allowedHosts: ['frontend', 'localhost'],
|
|
proxy: {
|
|
'/api': 'http://backend:8080',
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
setupFiles: ['src/__tests__/setup.ts'],
|
|
exclude: ['e2e/**', 'node_modules/**'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html', 'lcov', 'json'],
|
|
reportsDirectory: './coverage',
|
|
thresholds: {
|
|
lines: 70,
|
|
branches: 60,
|
|
functions: 70,
|
|
statements: 70,
|
|
},
|
|
exclude: ['src/__tests__/**', 'e2e/**'],
|
|
},
|
|
},
|
|
})
|