修正E2E用例github runner执行失败

This commit is contained in:
wttwins
2025-12-17 19:46:12 +08:00
parent 60ce3fd4c6
commit f79cef0daa
2 changed files with 5 additions and 5 deletions

View File

@@ -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 "设置")

View File

@@ -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,