chore: update CI configuration and enhance test stability

- Added deterministic API key and environment variables in e2e-tests.yml to ensure consistent test behavior.
- Refactored CodexProvider tests to improve type safety and mock handling, ensuring reliable test execution.
- Updated provider-factory tests to mock installation detection for CodexProvider, enhancing test isolation.
- Adjusted Playwright configuration to conditionally use external backend, improving flexibility in test environments.
- Enhanced kill-test-servers script to handle external server scenarios, ensuring proper cleanup of test processes.

These changes improve the reliability and maintainability of the testing framework, leading to a more stable development experience.
This commit is contained in:
DhanushSantosh
2026-01-07 00:27:38 +05:30
parent 96f154d440
commit 251f0fd88e
12 changed files with 194 additions and 160 deletions

View File

@@ -72,15 +72,21 @@ export async function handleLoginScreenIfPresent(page: Page): Promise<boolean> {
'[data-testid="welcome-view"], [data-testid="board-view"], [data-testid="context-view"], [data-testid="agent-view"]'
);
// Race between login screen and actual content
const maxWaitMs = 15000;
// Race between login screen, a delayed redirect to /login, and actual content
const loginVisible = await Promise.race([
page
.waitForURL((url) => url.pathname.includes('/login'), { timeout: maxWaitMs })
.then(() => true)
.catch(() => false),
loginInput
.waitFor({ state: 'visible', timeout: 5000 })
.waitFor({ state: 'visible', timeout: maxWaitMs })
.then(() => true)
.catch(() => false),
appContent
.first()
.waitFor({ state: 'visible', timeout: 5000 })
.waitFor({ state: 'visible', timeout: maxWaitMs })
.then(() => false)
.catch(() => false),
]);
@@ -101,8 +107,8 @@ export async function handleLoginScreenIfPresent(page: Page): Promise<boolean> {
// Wait for navigation away from login - either to content or URL change
await Promise.race([
page.waitForURL((url) => !url.pathname.includes('/login'), { timeout: 10000 }),
appContent.first().waitFor({ state: 'visible', timeout: 10000 }),
page.waitForURL((url) => !url.pathname.includes('/login'), { timeout: 15000 }),
appContent.first().waitFor({ state: 'visible', timeout: 15000 }),
]).catch(() => {});
// Wait for page to load