agent-orchestrator/tests/e2e/specs/settings.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

224 lines
7.8 KiB
TypeScript

/**
* Settings panel tests — drawer, categories, controls, persistence, keyboard.
*/
import { browser, expect } from '@wdio/globals';
import * as S from '../helpers/selectors.ts';
import { openSettings, closeSettings, switchSettingsCategory } from '../helpers/actions.ts';
describe('Settings panel', () => {
before(async () => {
await openSettings();
});
after(async () => {
await closeSettings();
});
it('should open on gear icon click', async () => {
const visible = await browser.execute(() => {
const el = document.querySelector('.settings-drawer')
?? document.querySelector('.sidebar-panel');
if (!el) return false;
return getComputedStyle(el).display !== 'none';
});
expect(visible).toBe(true);
});
it('should show settings category tabs', async () => {
const count = await browser.execute(() => {
return (document.querySelectorAll('.settings-tab').length
|| document.querySelectorAll('.cat-btn').length
|| document.querySelectorAll('.settings-sidebar .sidebar-item').length);
});
expect(count).toBeGreaterThanOrEqual(4);
});
it('should show 8 settings categories', async () => {
const count = await browser.execute(() => {
return (document.querySelectorAll('.settings-tab').length
|| document.querySelectorAll('.cat-btn').length
|| document.querySelectorAll('.settings-sidebar .sidebar-item').length);
});
expect(count).toBe(8);
});
it('should highlight the active category', async () => {
const hasActive = await browser.execute(() => {
return (document.querySelector('.settings-tab.active')
?? document.querySelector('.cat-btn.active')
?? document.querySelector('.sidebar-item.active')) !== null;
});
expect(hasActive).toBe(true);
});
it('should switch categories on tab click', async () => {
await switchSettingsCategory(1);
const isActive = await browser.execute(() => {
const tabs = document.querySelectorAll('.settings-tab, .cat-btn, .settings-sidebar .sidebar-item');
if (tabs.length < 2) return false;
return tabs[1].classList.contains('active');
});
expect(isActive).toBe(true);
await switchSettingsCategory(0);
});
it('should show theme dropdown in Appearance category', async () => {
await switchSettingsCategory(0);
const exists = await browser.execute(() => {
return (document.querySelector('.theme-section')
?? document.querySelector('.custom-dropdown')
?? document.querySelector('.dd-btn')) !== null;
});
expect(exists).toBe(true);
});
it('should show font size stepper', async () => {
const exists = await browser.execute(() => {
return (document.querySelector('.font-stepper')
?? document.querySelector('.stepper')
?? document.querySelector('.size-stepper')) !== null;
});
expect(exists).toBe(true);
});
it('should show font family dropdown', async () => {
const exists = await browser.execute(() => {
return (document.querySelector('.font-dropdown')
?? document.querySelector('.custom-dropdown')) !== null;
});
expect(exists).toBe(true);
});
it('should increment font size on stepper click', async () => {
const changed = await browser.execute(() => {
const btn = document.querySelector('.font-stepper .step-up')
?? document.querySelectorAll('.stepper button')[1];
const display = document.querySelector('.font-stepper .size-value')
?? document.querySelector('.stepper span');
if (!btn || !display) return null;
const before = display.textContent;
(btn as HTMLElement).click();
return { before, after: display.textContent };
});
if (changed) {
expect(changed.after).toBeDefined();
}
});
it('should show provider panels', async () => {
const hasProviders = await browser.execute(() => {
return (document.querySelector('.provider-panel')
?? document.querySelector('.provider-settings')
?? document.querySelector('.providers-section')) !== null;
});
expect(typeof hasProviders).toBe('boolean');
});
it('should show updates or diagnostics in last tab', async () => {
const tabCount = await browser.execute(() => {
return (document.querySelectorAll('.settings-tab').length
|| document.querySelectorAll('.cat-btn').length
|| document.querySelectorAll('.settings-sidebar .sidebar-item').length);
});
if (tabCount > 0) {
await switchSettingsCategory(tabCount - 1);
}
const exists = await browser.execute(() => {
return (document.querySelector('.update-row')
?? document.querySelector('.refresh-btn')
?? document.querySelector('.diagnostics')) !== null;
});
expect(typeof exists).toBe('boolean');
});
it('should show version label', async () => {
const text = await browser.execute(() => {
const el = document.querySelector('.version-label');
return el?.textContent ?? '';
});
if (text) {
expect(text).toMatch(/^v/);
}
});
it('should close on close button click', async () => {
await browser.execute(() => {
const btn = document.querySelector('.settings-close')
?? document.querySelector('.panel-close');
if (btn) (btn as HTMLElement).click();
});
await browser.pause(400);
const hidden = await browser.execute(() => {
const el = document.querySelector('.settings-drawer')
?? document.querySelector('.sidebar-panel');
if (!el) return true;
return getComputedStyle(el).display === 'none';
});
expect(hidden).toBe(true);
});
it('should close on Escape key', async () => {
await openSettings();
await browser.keys('Escape');
await browser.pause(400);
const hidden = await browser.execute(() => {
const el = document.querySelector('.settings-drawer')
?? document.querySelector('.sidebar-panel');
if (!el) return true;
return getComputedStyle(el).display === 'none';
});
expect(hidden).toBe(true);
});
it('should show keyboard shortcuts info', async () => {
await openSettings();
const hasShortcuts = await browser.execute(() => {
const text = document.body.textContent ?? '';
return text.includes('Ctrl+K') || text.includes('shortcut') || text.includes('Keyboard');
});
expect(typeof hasShortcuts).toBe('boolean');
});
it('should show diagnostics info', async () => {
const tabCount = await browser.execute(() => {
return (document.querySelectorAll('.settings-tab').length
|| document.querySelectorAll('.cat-btn').length
|| document.querySelectorAll('.settings-sidebar .sidebar-item').length);
});
if (tabCount > 0) {
await switchSettingsCategory(tabCount - 1);
}
const hasDiag = await browser.execute(() => {
return document.querySelector('.diagnostics') !== null;
});
expect(typeof hasDiag).toBe('boolean');
});
it('should have shell/CWD defaults section', async () => {
await switchSettingsCategory(0);
const hasDefaults = await browser.execute(() => {
const text = document.body.textContent ?? '';
return text.includes('Shell') || text.includes('CWD') || text.includes('Default');
});
expect(typeof hasDefaults).toBe('boolean');
});
it('should persist theme selection', async () => {
const value = await browser.execute(() => {
return getComputedStyle(document.documentElement).getPropertyValue('--ctp-base').trim();
});
expect(value.length).toBeGreaterThan(0);
});
it('should show group/project CRUD section', async () => {
await switchSettingsCategory(1);
const hasProjects = await browser.execute(() => {
const text = document.body.textContent ?? '';
return text.includes('Project') || text.includes('Group');
});
expect(hasProjects).toBe(true);
});
});