feat: enhance E2E test setup and error handling

- Updated Playwright configuration to explicitly unset ALLOWED_ROOT_DIRECTORY for unrestricted testing paths.
- Improved E2E fixture setup script to reset server settings to a known state, ensuring test isolation.
- Enhanced error handling in ContextView and WelcomeView components to reset state and provide user feedback on failures.
- Updated tests to ensure proper navigation and visibility checks during logout processes, improving reliability.
This commit is contained in:
webdevcody
2026-01-07 23:01:57 -05:00
parent d8cdb0bf7a
commit eb627ef323
6 changed files with 192 additions and 5 deletions

View File

@@ -120,13 +120,21 @@ test.describe('Settings startup sync race', () => {
};
expect(beforeLogout.projects?.length).toBeGreaterThan(0);
// Navigate to settings and click logout.
// Navigate to settings, then to Account section (logout button is only visible there)
await page.goto('/settings');
// Wait for settings view to load, then click on Account section
await page.locator('button:has-text("Account")').first().click();
// Wait for account section to be visible before clicking logout
await page
.locator('[data-testid="logout-button"]')
.waitFor({ state: 'visible', timeout: 10000 });
await page.locator('[data-testid="logout-button"]').click();
// Ensure we landed on logged-out or login (either is acceptable).
// Note: The page uses curly apostrophe (') so we match the heading role instead
await page
.locator('text=Youve been logged out, text=Authentication Required')
.getByRole('heading', { name: /logged out/i })
.or(page.locator('text=Authentication Required'))
.first()
.waitFor({ state: 'visible', timeout: 30000 });