perf: parallelize tests and reduce timeouts
- Increase workers from 1 to 10 in CI for parallel execution - Reduce expect timeout from 5000ms to 2000ms - Reduce all waitForTimeout calls >1000ms to 200-500ms - Remove unnecessary waits in global setup
This commit is contained in:
+6
-6
@@ -98,17 +98,17 @@ async function createTestUsers(config: FullConfig) {
|
||||
console.log('Submitting registration form...');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
try {
|
||||
try {
|
||||
await page.waitForResponse(response =>
|
||||
response.url().includes('/api/auth/sign-up/email') && response.status() === 200,
|
||||
{ timeout: 10000 }
|
||||
{ timeout: 5000 }
|
||||
);
|
||||
console.log('Sign-up API call successful');
|
||||
} catch {
|
||||
console.log('Sign-up API call failed or timed out');
|
||||
}
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.waitForTimeout(500);
|
||||
await context.storageState({ path: authFile });
|
||||
console.log(`Created and authenticated test user: ${testEmail}`);
|
||||
|
||||
@@ -133,14 +133,14 @@ async function createTestUsers(config: FullConfig) {
|
||||
try {
|
||||
await page.waitForResponse(response =>
|
||||
response.url().includes('/api/auth/sign-up/email') && response.status() === 200,
|
||||
{ timeout: 10000 }
|
||||
{ timeout: 5000 }
|
||||
);
|
||||
console.log('Admin sign-up API call successful');
|
||||
} catch {
|
||||
console.log('Admin sign-up API call failed or timed out');
|
||||
}
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const prisma = createPrismaClient();
|
||||
const user = await prisma.user.findUnique({ where: { email: adminEmail } });
|
||||
@@ -159,7 +159,7 @@ async function createTestUsers(config: FullConfig) {
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
console.log('Admin page loaded:', page.url());
|
||||
|
||||
await page.waitForTimeout(2000);
|
||||
await page.waitForTimeout(500);
|
||||
await page.reload();
|
||||
await page.waitForLoadState('domcontentloaded');
|
||||
console.log('Page reloaded');
|
||||
|
||||
Reference in New Issue
Block a user