Skip to content

Commit 29879aa

Browse files
committed
Use startup readiness for E2E backend bootstrap wait
1 parent d239a6f commit 29879aa

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

tests/e2e/app.e2e.spec.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,27 @@ async function waitForConnected(window) {
9393
.poll(
9494
async () =>
9595
window.evaluate(async () => {
96-
const statusResult = await window.appAPI.checkServerStatus();
9796
const startupStatus = await window.appAPI.getStartupStatus();
9897
return {
99-
connected: Boolean(statusResult?.success),
100-
error: statusResult?.error || '',
101-
startupState: startupStatus?.state || 'unknown',
102-
startupMessage: startupStatus?.message || '',
103-
label: document.getElementById('server-status')?.textContent || ''
98+
state: startupStatus?.state || 'unknown',
99+
message: startupStatus?.message || ''
104100
};
105101
}),
106102
{ timeout: 50000 }
107103
)
108-
.toMatchObject({ connected: true });
109-
110-
await expect
111-
.poll(
112-
() => window.evaluate(() => document.getElementById('server-status')?.textContent || ''),
113-
{ timeout: 10000 }
114-
)
115-
.toContain('Connected');
104+
.toMatchObject({ state: 'ready' });
105+
106+
// Best-effort status refresh to update renderer badges before UI interactions.
107+
await window.evaluate(async () => {
108+
try {
109+
await Promise.race([
110+
window.appAPI.checkServerStatus(),
111+
new Promise((resolve) => setTimeout(resolve, 3000))
112+
]);
113+
} catch (error) {
114+
// Startup readiness is the source of truth for test setup.
115+
}
116+
});
116117
}
117118

118119
test.describe('DeepSeek OCR Electron E2E', () => {

0 commit comments

Comments
 (0)