dev #5

Merged
zhangxiang merged 159 commits from dev into main 2026-04-12 17:39:08 +08:00
2 changed files with 12 additions and 5 deletions
Showing only changes of commit e0ca8235c8 - Show all commits
+7 -3
View File
@@ -1,10 +1,14 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
const isCI = !!process.env.CI; const isCI = !!process.env.CI;
const testTier = process.env.TEST_TIER || 'standard'; const testTier = (process.env.TEST_TIER || 'standard') as 'fast' | 'standard' | 'deep';
const baseURL = process.env.BASE_URL || (isCI ? 'http://localhost:3000' : 'https://novalon.cn'); const baseURL = process.env.BASE_URL || (isCI ? 'http://localhost:3000' : 'https://novalon.cn');
const tierConfig = { const tierConfig: Record<'fast' | 'standard' | 'deep', {
timeout: number;
retries: number;
workers: number | undefined;
}> = {
fast: { fast: {
timeout: 15000, timeout: 15000,
retries: 0, retries: 0,
@@ -22,7 +26,7 @@ const tierConfig = {
}, },
}; };
const config = tierConfig[testTier] || tierConfig.standard; const config = tierConfig[testTier];
export default defineConfig({ export default defineConfig({
testDir: './e2e', testDir: './e2e',
+4 -1
View File
@@ -71,8 +71,11 @@ export class TestDataCleaner {
static clearCookies(): void { static clearCookies(): void {
if (typeof document !== 'undefined' && document.cookie) { if (typeof document !== 'undefined' && document.cookie) {
document.cookie.split(';').forEach(cookie => { document.cookie.split(';').forEach(cookie => {
const name = cookie.split('=')[0].trim(); const parts = cookie.split('=');
const name = parts[0]?.trim();
if (name) {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`; document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
}
}); });
} }
} }