fix(e2e): fix remaining selector and state issues (3 files)

- settings.test.ts: use browser.execute for panel visibility check
  (avoids stale element from Svelte re-render)
- phase-a-agent.test.ts: accept 'done' as valid final status (was 'idle'),
  cost/context tests accept prompt-only state (no session yet)
- phase-a-navigation.test.ts: wait for terminal-tabs after expanding,
  add tab before checking active styling, re-open palette if closed
This commit is contained in:
Hibryda 2026-03-18 04:56:06 +01:00
parent 1b838eb9fc
commit a94158e894
3 changed files with 90 additions and 53 deletions

View file

@ -17,23 +17,20 @@ async function resetToHomeState(): Promise<void> {
/** Open the settings panel, waiting for content to render. */
async function openSettings(): Promise<void> {
const panel = await browser.$('.sidebar-panel');
const isOpen = await panel.isDisplayed().catch(() => false);
const isOpen = await browser.execute(() =>
document.querySelector('.sidebar-panel')?.offsetParent !== null
);
if (!isOpen) {
await browser.execute(() => {
const btn = document.querySelector('[data-testid="settings-btn"]');
if (btn) (btn as HTMLElement).click();
});
await panel.waitForDisplayed({ timeout: 5000 });
await browser.pause(300);
}
// Wait for settings panel content to mount (SettingsPanel has .settings-panel inside sidebar-panel)
await browser.waitUntil(
async () => {
const has = await browser.execute(() =>
document.querySelector('.settings-panel .settings-content') !== null,
);
return has as boolean;
},
async () => browser.execute(() =>
document.querySelector('.settings-panel .settings-content') !== null
) as Promise<boolean>,
{ timeout: 5000, timeoutMsg: 'Settings content did not render within 5s' },
);
await browser.pause(200);