agent-orchestrator/tests/e2e/specs/keyboard.test.ts
Hibryda 77b9ce9f62 feat: unified E2E testing engine — 205 tests, dual-stack support
Infrastructure:
- adapters/: base, tauri (port 9750), electrobun (port 9761 + PTY daemon)
- helpers/: 120+ centralized selectors, reusable actions, custom assertions
- wdio.shared.conf.js + stack-specific configs

18 unified specs (205 tests):
splash(6) smoke(15) settings(19) terminal(14) agent(15) search(12)
files(15) comms(10) tasks(10) theme(12) groups(12) keyboard(8)
notifications(10) diagnostics(8) status-bar(12) context(9)
worktree(8) llm-judged(10)

Daemon: --stack tauri|electrobun|both flag
Scripts: test:e2e:tauri, test:e2e:electrobun, test:e2e:both
2026-03-22 05:27:36 +01:00

100 lines
3.1 KiB
TypeScript

/**
* Command palette / keyboard shortcut tests — Ctrl+K, commands, filtering.
*/
import { browser, expect } from '@wdio/globals';
import * as S from '../helpers/selectors.ts';
import { openCommandPalette, closeCommandPalette } from '../helpers/actions.ts';
describe('Command palette', () => {
it('should open via Ctrl+K', async () => {
await openCommandPalette();
const visible = await browser.execute((sel: string) => {
const el = document.querySelector(sel);
if (!el) return false;
return getComputedStyle(el).display !== 'none';
}, S.PALETTE_BACKDROP);
if (visible) {
expect(visible).toBe(true);
}
});
it('should show the palette panel with input', async () => {
const panel = await browser.$(S.PALETTE_PANEL);
if (await panel.isExisting()) {
await expect(panel).toBeDisplayed();
}
const input = await browser.$(S.PALETTE_INPUT);
if (await input.isExisting()) {
await expect(input).toBeDisplayed();
}
});
it('should list 18 commands', async () => {
const count = await browser.execute((sel: string) => {
return document.querySelectorAll(sel).length;
}, S.PALETTE_ITEM);
expect(count).toBe(18);
});
it('should show command labels and shortcuts', async () => {
const labelCount = await browser.execute((sel: string) => {
return document.querySelectorAll(sel).length;
}, S.CMD_LABEL);
expect(labelCount).toBeGreaterThan(0);
const shortcutCount = await browser.execute((sel: string) => {
return document.querySelectorAll(sel).length;
}, S.CMD_SHORTCUT);
expect(shortcutCount).toBeGreaterThan(0);
});
it('should filter commands on text input', async () => {
const input = await browser.$(S.PALETTE_INPUT);
if (!(await input.isExisting())) return;
await input.setValue('terminal');
await browser.pause(200);
const count = await browser.execute((sel: string) => {
return document.querySelectorAll(sel).length;
}, S.PALETTE_ITEM);
expect(count).toBeLessThan(18);
expect(count).toBeGreaterThan(0);
});
it('should highlight first item', async () => {
const hasHighlight = await browser.execute(() => {
return (document.querySelector('.palette-item.active')
?? document.querySelector('.palette-item.highlighted')
?? document.querySelector('.palette-item:first-child')) !== null;
});
expect(hasHighlight).toBe(true);
});
it('should navigate with arrow keys', async () => {
// Clear filter first
const input = await browser.$(S.PALETTE_INPUT);
if (await input.isExisting()) {
await input.clearValue();
await browser.pause(100);
}
await browser.keys('ArrowDown');
await browser.pause(100);
// Just verify no crash
});
it('should close on Escape key', async () => {
await closeCommandPalette();
const hidden = await browser.execute((sel: string) => {
const el = document.querySelector(sel);
if (!el) return true;
return getComputedStyle(el).display === 'none';
}, S.PALETTE_BACKDROP);
expect(hidden).toBe(true);
});
});