diff --git a/Website/.env.development b/Website/.env.development index da987ec9d..a1ea5e64d 100644 --- a/Website/.env.development +++ b/Website/.env.development @@ -1,3 +1,4 @@ +PUBLIC_ENABLE_MSW=true PUBLIC_DAWNSHARD_URL=http://localhost:3001/ PUBLIC_DAWNSHARD_API_URL=http://localhost:3001/api/ # use Vite proxy DAWNSHARD_API_URL_SSR=http://localhost:5000 diff --git a/Website/package.json b/Website/package.json index 5b2fc4916..c8c049084 100644 --- a/Website/package.json +++ b/Website/package.json @@ -8,6 +8,7 @@ "dev:test": "vite dev --mode test", "api": "dotnet run --project ../DragaliaAPI/DragaliaAPI", "build": "vite build", + "build:dev": "vite build --mode development", "preview": "vite preview", "test": "playwright test", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", diff --git a/Website/playwright.config.ts b/Website/playwright.config.ts index 9a37a1a46..fa701ec03 100644 --- a/Website/playwright.config.ts +++ b/Website/playwright.config.ts @@ -1,24 +1,22 @@ import { devices, type PlaywrightTestConfig } from '@playwright/test'; -const url = process.env.CI ? 'http://localhost:4173' : 'http://localhost:3001'; - const config: PlaywrightTestConfig = { webServer: { - command: 'pnpm run build && pnpm run preview -- --mode dev', - url, + command: 'pnpm run build:dev && pnpm run preview', + url: 'http://localhost:3001', stdout: 'pipe', reuseExistingServer: !process.env.CI, timeout: 120000 }, use: { - baseURL: url + baseURL: 'http://localhost:3001' }, updateSnapshots: process.env.UPDATE_SNAPSHOTS ? 'all' : 'missing', ignoreSnapshots: !process.env.CI, testDir: 'tests', snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}', testMatch: /(.+\.)?(test|spec)\.[jt]s/, - timeout: 600000, + timeout: 60000, projects: [ { name: 'chromium', diff --git a/Website/src/hooks.client.ts b/Website/src/hooks.client.ts index e3f04d061..57e1bde7c 100644 --- a/Website/src/hooks.client.ts +++ b/Website/src/hooks.client.ts @@ -1,6 +1,6 @@ -import { dev } from '$app/environment'; +import { PUBLIC_ENABLE_MSW } from '$env/static/public'; -if (dev) { +if (PUBLIC_ENABLE_MSW === 'true') { const { worker } = await import('./mocks/browser'); await worker.start({ diff --git a/Website/src/hooks.server.ts b/Website/src/hooks.server.ts index f549441f8..89225d2ff 100644 --- a/Website/src/hooks.server.ts +++ b/Website/src/hooks.server.ts @@ -1,15 +1,15 @@ import type { Handle, HandleFetch } from '@sveltejs/kit'; -import { dev } from '$app/environment'; import { DAWNSHARD_API_URL_SSR } from '$env/static/private'; import { PUBLIC_DAWNSHARD_API_URL } from '$env/static/public'; +import { PUBLIC_ENABLE_MSW } from '$env/static/public'; import Cookies from '$lib/auth/cookies.ts'; import getJwtMetadata from '$lib/auth/jwt.ts'; const publicApiUrl = new URL(PUBLIC_DAWNSHARD_API_URL); const internalApiUrl = new URL(DAWNSHARD_API_URL_SSR); -if (dev) { +if (PUBLIC_ENABLE_MSW === 'true') { const { server } = await import('./mocks/node'); server.listen(); } diff --git a/Website/src/routes/(main)/header.svelte b/Website/src/routes/(main)/header.svelte index c23b16bfc..a30408b24 100644 --- a/Website/src/routes/(main)/header.svelte +++ b/Website/src/routes/(main)/header.svelte @@ -10,6 +10,7 @@ import HeaderContents from './headerContents.svelte'; let enhance = false; + let drawerOpen = false; export let hasValidJwt: boolean; @@ -19,13 +20,15 @@ {#if enhance} - -