forked from jsnbuchanan/crowd-funder-for-time-pwa
fix(tests): improve Playwright test reliability with robust onboarding and timing fixes
- Fix onboarding dialog handling in project creation tests * Replace blocking onboarding dismissal with try-catch approach * Use short timeout (2000ms) to detect dialog presence * Gracefully handle missing onboarding dialogs on projects page * Add console logging for debugging dialog state - Improve project creation timing and synchronization * Add networkidle wait after project save operation * Add networkidle wait before project list search * Increase timeout for project visibility check (10s) * Add debug logging to show all projects in list - Apply consistent pattern across both test files * 20-create-project.spec.ts: Enhanced with timing fixes * 25-create-project-x10.spec.ts: Applied onboarding fix These changes resolve test failures caused by UI timing issues and onboarding dialog state variability, improving test reliability from 42/44 passing to expected 44/44 passing tests.
This commit is contained in:
@@ -126,11 +126,16 @@ test('Create 10 new projects', async ({ page }) => {
|
||||
for (let i = 0; i < projectCount; i++) {
|
||||
await page.goto('./projects');
|
||||
if (i === 0) {
|
||||
// close onboarding using established pattern
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
await page.waitForFunction(() => {
|
||||
return !document.querySelector('.dialog-overlay');
|
||||
}, { timeout: 5000 });
|
||||
// Check if onboarding dialog exists and close it if present
|
||||
try {
|
||||
await page.getByTestId('closeOnboardingAndFinish').click({ timeout: 2000 });
|
||||
await page.waitForFunction(() => {
|
||||
return !document.querySelector('.dialog-overlay');
|
||||
}, { timeout: 5000 });
|
||||
} catch (error) {
|
||||
// No onboarding dialog present, continue
|
||||
console.log('No onboarding dialog found on projects page');
|
||||
}
|
||||
}
|
||||
await page.locator('button > svg.fa-plus').click();
|
||||
await page.getByPlaceholder('Idea Name').fill(finalTitles[i]); // Add random suffix
|
||||
|
||||
Reference in New Issue
Block a user