diff --git a/e2e/auth-flow.spec.ts b/e2e/auth-flow.spec.ts index 6a3e3aa7..bab3ede0 100644 --- a/e2e/auth-flow.spec.ts +++ b/e2e/auth-flow.spec.ts @@ -47,14 +47,14 @@ test.describe('Authentication Flow', () => { if (await errorLocator.isVisible()) { console.log('Registration error visible, going to login.'); - await page.goto('http://localhost:3000/login'); + await page.goto('/login'); } } catch (e) { if (page.url().includes('/login')) { console.log('Redirected to login page automatically.'); } else { console.log('State unclear, forcing login.'); - await page.goto('http://localhost:3000/login'); + await page.goto('/login'); } } @@ -69,7 +69,7 @@ test.describe('Authentication Flow', () => { // --- Verify Success --- // Wait for redirect to home - await page.waitForURL('http://localhost:3000/', { timeout: 10000 }); + await page.waitForURL('/', { timeout: 10000 }); // Verify Content // The dashboard shows "Welcome back, wttwins". @@ -87,7 +87,7 @@ test.describe('Authentication Flow', () => { await page.locator('button[type="submit"]').click(); // Verify Admin Login and Home Page - await page.waitForURL('http://localhost:3000/'); + await page.waitForURL('/'); // --- Go to Settings > User Management --- // Open Settings (Button with gear icon, sr-only text "Settings" or "设置") diff --git a/playwright.config.ts b/playwright.config.ts index 4ee2b453..773d547e 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -12,7 +12,7 @@ export default defineConfig({ trace: 'on-first-retry', }, webServer: { - command: process.env.CI ? 'npm run start' : 'npm run dev', + command: process.env.CI ? 'node .next/standalone/server.js' : 'npm run dev', url: 'http://127.0.0.1:3000', reuseExistingServer: !process.env.CI, timeout: 120 * 1000,