From 6b010fdde2ea845191926a76d482c73d287c3723 Mon Sep 17 00:00:00 2001 From: linonetwo Date: Thu, 2 Apr 2026 18:41:53 +0800 Subject: [PATCH] fix: address Copilot review - main window lookup and comment clarity - tidgiMiniWindow.ts: use index.html URL pattern to find main window (consistent with other step defs, avoids matching preferences window) - ui.ts: clarify networkidle timeout comment --- features/stepDefinitions/tidgiMiniWindow.ts | 4 ++-- features/stepDefinitions/ui.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/features/stepDefinitions/tidgiMiniWindow.ts b/features/stepDefinitions/tidgiMiniWindow.ts index 408521ee..4caf79e2 100644 --- a/features/stepDefinitions/tidgiMiniWindow.ts +++ b/features/stepDefinitions/tidgiMiniWindow.ts @@ -105,8 +105,8 @@ When('I toggle tidgi mini window via IPC', async function(this: ApplicationWorld throw new Error('Application not launched'); } await this.app.evaluate(async ({ BrowserWindow }) => { - // Find the main window and call toggleTidgiMiniWindow via the service proxy - const mainWindow = BrowserWindow.getAllWindows().find(w => !w.isDestroyed() && w.webContents?.getType() === 'window'); + // Find the main window by URL (consistent with other step defs) + const mainWindow = BrowserWindow.getAllWindows().find(w => !w.isDestroyed() && w.webContents?.getURL().includes('index.html')); if (!mainWindow) throw new Error('Main window not found'); await mainWindow.webContents.executeJavaScript('window.service.window.toggleTidgiMiniWindow()'); }); diff --git a/features/stepDefinitions/ui.ts b/features/stepDefinitions/ui.ts index 60ef51fa..dc6fc51b 100644 --- a/features/stepDefinitions/ui.ts +++ b/features/stepDefinitions/ui.ts @@ -45,7 +45,8 @@ When('I wait for the page to load completely', async function(this: ApplicationW } await currentWindow?.waitForLoadState('domcontentloaded', { timeout: PLAYWRIGHT_TIMEOUT }); // Short networkidle gives workspace-creation and other startup IPC time to finish - // without blocking on long-lived connections. 3s is enough for the initial burst. + // without blocking on long-lived connections. 3s is intentionally different from + // PLAYWRIGHT_TIMEOUT — this is just a grace period, not a hard requirement. try { await currentWindow?.waitForLoadState('networkidle', { timeout: 3000 }); } catch {