refactor!: rebrand bterminal to agor (agents-orchestrator)

Rename Cargo crates (bterminal-core→agor-core, bterminal-relay→agor-relay),
env vars (BTERMINAL_*→AGOR_*), config paths (~/.config/agor), CSS custom
properties, plugin API object, package names, and all documentation.

BREAKING CHANGE: config/data paths changed from bterminal to agor.
This commit is contained in:
Hibryda 2026-03-17 01:12:25 +01:00
parent ef3548a569
commit a63e6711ac
52 changed files with 3889 additions and 169 deletions

View file

@ -21,21 +21,21 @@ npm run test:e2e
SKIP_BUILD=1 npm run test:e2e
# With test isolation (custom data/config dirs)
BTERMINAL_TEST_DATA_DIR=/tmp/bt-test/data BTERMINAL_TEST_CONFIG_DIR=/tmp/bt-test/config npm run test:e2e
AGOR_TEST_DATA_DIR=/tmp/bt-test/data AGOR_TEST_CONFIG_DIR=/tmp/bt-test/config npm run test:e2e
```
The `wdio.conf.js` handles:
1. Building the debug binary (`cargo tauri build --debug --no-bundle`) in `onPrepare`
2. Spawning `tauri-driver` before each session (TCP readiness probe, 10s deadline)
3. Killing `tauri-driver` after each session
4. Passing `BTERMINAL_TEST=1` env var to the app for test mode isolation
4. Passing `AGOR_TEST=1` env var to the app for test mode isolation
## Test Mode (`BTERMINAL_TEST=1`)
## Test Mode (`AGOR_TEST=1`)
When `BTERMINAL_TEST=1` is set:
When `AGOR_TEST=1` is set:
- File watchers (watcher.rs, fs_watcher.rs) are disabled to avoid inotify noise
- Wake scheduler is disabled (no auto-wake timers)
- Data/config directories can be overridden via `BTERMINAL_TEST_DATA_DIR` / `BTERMINAL_TEST_CONFIG_DIR`
- Data/config directories can be overridden via `AGOR_TEST_DATA_DIR` / `AGOR_TEST_CONFIG_DIR`
## CI setup (headless)
@ -132,7 +132,7 @@ tests/e2e/
├── fixtures.ts # Test fixture generator (isolated environments)
├── results-db.ts # JSON test results store
└── specs/
├── bterminal.test.ts # Smoke tests (CSS class selectors, 50+ tests)
├── agor.test.ts # Smoke tests (CSS class selectors, 50+ tests)
└── agent-scenarios.test.ts # Phase A scenarios (data-testid selectors, 22 tests)
```

View file

@ -9,9 +9,9 @@ import { tmpdir } from 'node:os';
export interface TestFixture {
/** Root temp directory for this test run */
rootDir: string;
/** BTERMINAL_TEST_DATA_DIR — isolated data dir */
/** AGOR_TEST_DATA_DIR — isolated data dir */
dataDir: string;
/** BTERMINAL_TEST_CONFIG_DIR — isolated config dir */
/** AGOR_TEST_CONFIG_DIR — isolated config dir */
configDir: string;
/** Path to a minimal git repo for agent testing */
projectDir: string;
@ -25,7 +25,7 @@ export interface TestFixture {
* - Temp config dir with a minimal groups.json
* - A simple git repo with one file for agent testing
*/
export function createTestFixture(name = 'bterminal-e2e'): TestFixture {
export function createTestFixture(name = 'agor-e2e'): TestFixture {
const rootDir = join(tmpdir(), `${name}-${Date.now()}`);
const dataDir = join(rootDir, 'data');
const configDir = join(rootDir, 'config');
@ -38,9 +38,9 @@ export function createTestFixture(name = 'bterminal-e2e'): TestFixture {
// Create a minimal git repo for agent testing
execSync('git init', { cwd: projectDir, stdio: 'ignore' });
execSync('git config user.email "test@bterminal.dev"', { cwd: projectDir, stdio: 'ignore' });
execSync('git config user.name "BTerminal Test"', { cwd: projectDir, stdio: 'ignore' });
writeFileSync(join(projectDir, 'README.md'), '# Test Project\n\nA simple test project for BTerminal E2E tests.\n');
execSync('git config user.email "test@agor.dev"', { cwd: projectDir, stdio: 'ignore' });
execSync('git config user.name "Agor Test"', { cwd: projectDir, stdio: 'ignore' });
writeFileSync(join(projectDir, 'README.md'), '# Test Project\n\nA simple test project for Agor E2E tests.\n');
writeFileSync(join(projectDir, 'hello.py'), 'def greet(name: str) -> str:\n return f"Hello, {name}!"\n');
execSync('git add -A && git commit -m "initial commit"', { cwd: projectDir, stdio: 'ignore' });
@ -75,9 +75,9 @@ export function createTestFixture(name = 'bterminal-e2e'): TestFixture {
);
const env: Record<string, string> = {
BTERMINAL_TEST: '1',
BTERMINAL_TEST_DATA_DIR: dataDir,
BTERMINAL_TEST_CONFIG_DIR: configDir,
AGOR_TEST: '1',
AGOR_TEST_DATA_DIR: dataDir,
AGOR_TEST_CONFIG_DIR: configDir,
};
return { rootDir, dataDir, configDir, projectDir, env };
@ -96,15 +96,15 @@ export function destroyTestFixture(fixture: TestFixture): void {
* Create a groups.json with multiple projects for multi-project testing.
*/
export function createMultiProjectFixture(projectCount = 3): TestFixture {
const fixture = createTestFixture('bterminal-multi');
const fixture = createTestFixture('agor-multi');
const projects = [];
for (let i = 0; i < projectCount; i++) {
const projDir = join(fixture.rootDir, `project-${i}`);
mkdirSync(projDir, { recursive: true });
execSync('git init', { cwd: projDir, stdio: 'ignore' });
execSync('git config user.email "test@bterminal.dev"', { cwd: projDir, stdio: 'ignore' });
execSync('git config user.name "BTerminal Test"', { cwd: projDir, stdio: 'ignore' });
execSync('git config user.email "test@agor.dev"', { cwd: projDir, stdio: 'ignore' });
execSync('git config user.name "Agor Test"', { cwd: projDir, stdio: 'ignore' });
writeFileSync(join(projDir, 'README.md'), `# Project ${i}\n`);
execSync('git add -A && git commit -m "init"', { cwd: projDir, stdio: 'ignore' });

View file

@ -386,7 +386,7 @@ describe('Scenario 7 — Agent Prompt Submission', () => {
it('should show stop button during agent execution (if Claude available)', async function () {
// Send a minimal prompt
await sendAgentPrompt('Reply with exactly: BTERMINAL_TEST_OK');
await sendAgentPrompt('Reply with exactly: AGOR_TEST_OK');
// Wait for running status (generous timeout for sidecar spin-up)
try {

View file

@ -0,0 +1,799 @@
import { browser, expect } from '@wdio/globals';
// All E2E tests run in a single spec file because Tauri launches one app
// instance per session, and tauri-driver doesn't support re-creating sessions.
describe('BTerminal — Smoke Tests', () => {
it('should render the application window', async () => {
// Wait for the app to fully load before any tests
await browser.waitUntil(
async () => (await browser.getTitle()) === 'BTerminal',
{ timeout: 10_000, timeoutMsg: 'App did not load within 10s' },
);
const title = await browser.getTitle();
expect(title).toBe('BTerminal');
});
it('should display the status bar', async () => {
const statusBar = await browser.$('.status-bar');
await expect(statusBar).toBeDisplayed();
});
it('should show version text in status bar', async () => {
const version = await browser.$('.status-bar .version');
await expect(version).toBeDisplayed();
const text = await version.getText();
expect(text).toContain('BTerminal');
});
it('should display the sidebar rail', async () => {
const sidebarRail = await browser.$('.sidebar-rail');
await expect(sidebarRail).toBeDisplayed();
});
it('should display the workspace area', async () => {
const workspace = await browser.$('.workspace');
await expect(workspace).toBeDisplayed();
});
it('should toggle sidebar with settings button', async () => {
const settingsBtn = await browser.$('.rail-btn');
await settingsBtn.click();
const sidebarPanel = await browser.$('.sidebar-panel');
await expect(sidebarPanel).toBeDisplayed();
// Click again to close
await settingsBtn.click();
await expect(sidebarPanel).not.toBeDisplayed();
});
});
describe('BTerminal — Workspace & Projects', () => {
it('should display the project grid', async () => {
const grid = await browser.$('.project-grid');
await expect(grid).toBeDisplayed();
});
it('should render at least one project box', async () => {
const boxes = await browser.$$('.project-box');
expect(boxes.length).toBeGreaterThanOrEqual(1);
});
it('should show project header with name', async () => {
const header = await browser.$('.project-header');
await expect(header).toBeDisplayed();
const name = await browser.$('.project-name');
const text = await name.getText();
expect(text.length).toBeGreaterThan(0);
});
it('should show project-level tabs (Model, Docs, Context, Files, SSH, Memory, ...)', async () => {
const box = await browser.$('.project-box');
const tabs = await box.$$('.ptab');
// v3 has 6+ tabs: Model, Docs, Context, Files, SSH, Memory (+ role-specific)
expect(tabs.length).toBeGreaterThanOrEqual(6);
});
it('should highlight active project on click', async () => {
const header = await browser.$('.project-header');
await header.click();
const activeBox = await browser.$('.project-box.active');
await expect(activeBox).toBeDisplayed();
});
it('should switch project tabs', async () => {
// Use JS click — WebDriver clicks don't always trigger Svelte onclick
// on buttons inside complex components via WebKit2GTK/tauri-driver
const switched = await browser.execute(() => {
const box = document.querySelector('.project-box');
if (!box) return false;
const tabs = box.querySelectorAll('.ptab');
if (tabs.length < 2) return false;
(tabs[1] as HTMLElement).click();
return true;
});
expect(switched).toBe(true);
await browser.pause(500);
const box = await browser.$('.project-box');
const activeTab = await box.$('.ptab.active');
const text = await activeTab.getText();
// Tab[1] is "Docs" in v3 tab bar (Model, Docs, Context, Files, ...)
expect(text.toLowerCase()).toContain('docs');
// Switch back to Model tab
await browser.execute(() => {
const tab = document.querySelector('.project-box .ptab');
if (tab) (tab as HTMLElement).click();
});
await browser.pause(300);
});
it('should display the status bar with project count', async () => {
const statusBar = await browser.$('.status-bar .left');
const text = await statusBar.getText();
expect(text).toContain('projects');
});
it('should display project and agent info in status bar', async () => {
const statusBar = await browser.$('.status-bar .left');
const text = await statusBar.getText();
// Status bar always shows project count; agent counts only when > 0
// (shows "X running", "X idle", "X stalled" — not the word "agents")
expect(text).toContain('projects');
});
});
/** 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);
if (!isOpen) {
// Use data-testid for unambiguous selection
await browser.execute(() => {
const btn = document.querySelector('[data-testid="settings-btn"]');
if (btn) (btn as HTMLElement).click();
});
await panel.waitForDisplayed({ timeout: 5000 });
}
// Wait for settings content to mount
await browser.waitUntil(
async () => {
const count = await browser.execute(() =>
document.querySelectorAll('.settings-tab .settings-section').length,
);
return (count as number) >= 1;
},
{ timeout: 5000, timeoutMsg: 'Settings sections did not render within 5s' },
);
await browser.pause(200);
}
/** Close the settings panel if open. */
async function closeSettings(): Promise<void> {
const panel = await browser.$('.sidebar-panel');
if (await panel.isDisplayed().catch(() => false)) {
await browser.execute(() => {
const btn = document.querySelector('.panel-close');
if (btn) (btn as HTMLElement).click();
});
await browser.pause(500);
}
}
describe('BTerminal — Settings Panel', () => {
before(async () => {
await openSettings();
});
after(async () => {
await closeSettings();
});
it('should display the settings tab container', async () => {
const settingsTab = await browser.$('.settings-tab');
await expect(settingsTab).toBeDisplayed();
});
it('should show settings sections', async () => {
const sections = await browser.$$('.settings-section');
expect(sections.length).toBeGreaterThanOrEqual(1);
});
it('should display theme dropdown', async () => {
const dropdown = await browser.$('.custom-dropdown .dropdown-trigger');
await expect(dropdown).toBeDisplayed();
});
it('should open theme dropdown and show options', async () => {
// Use JS click — WebDriver clicks don't reliably trigger Svelte onclick
// on buttons inside scrollable panels via WebKit2GTK/tauri-driver
await browser.execute(() => {
const trigger = document.querySelector('.custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(500);
const menu = await browser.$('.dropdown-menu');
await menu.waitForExist({ timeout: 3000 });
const options = await browser.$$('.dropdown-option');
expect(options.length).toBeGreaterThan(0);
// Close dropdown by clicking trigger again
await browser.execute(() => {
const trigger = document.querySelector('.custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(300);
});
it('should display group list', async () => {
// Groups section is below Appearance/Defaults/Providers — scroll into view
await browser.execute(() => {
const el = document.querySelector('.group-list');
if (el) el.scrollIntoView({ behavior: 'instant', block: 'center' });
});
await browser.pause(300);
const groupList = await browser.$('.group-list');
await expect(groupList).toBeDisplayed();
});
it('should close settings panel with close button', async () => {
// Ensure settings is open
await openSettings();
// Use JS click for reliability
await browser.execute(() => {
const btn = document.querySelector('.panel-close');
if (btn) (btn as HTMLElement).click();
});
await browser.pause(500);
const panel = await browser.$('.sidebar-panel');
await expect(panel).not.toBeDisplayed();
});
});
/** Open command palette — idempotent (won't toggle-close if already open). */
async function openCommandPalette(): Promise<void> {
// Ensure sidebar is closed first (it can intercept keyboard events)
await closeSettings();
// Check if already open
const alreadyOpen = await browser.execute(() => {
const p = document.querySelector('.palette');
return p !== null && getComputedStyle(p).display !== 'none';
});
if (alreadyOpen) return;
// Dispatch Ctrl+K via JS for reliability with WebKit2GTK/tauri-driver
await browser.execute(() => {
document.dispatchEvent(new KeyboardEvent('keydown', {
key: 'k', code: 'KeyK', ctrlKey: true, bubbles: true, cancelable: true,
}));
});
await browser.pause(300);
const palette = await browser.$('.palette');
await palette.waitForDisplayed({ timeout: 5000 });
}
/** Close command palette if open — uses backdrop click (more reliable than Escape). */
async function closeCommandPalette(): Promise<void> {
const isOpen = await browser.execute(() => {
const p = document.querySelector('.palette');
return p !== null && getComputedStyle(p).display !== 'none';
});
if (!isOpen) return;
// Click backdrop to close (more reliable than dispatching Escape)
await browser.execute(() => {
const backdrop = document.querySelector('.palette-backdrop');
if (backdrop) (backdrop as HTMLElement).click();
});
await browser.pause(500);
}
describe('BTerminal — Command Palette', () => {
beforeEach(async () => {
await closeCommandPalette();
});
it('should show palette input', async () => {
await openCommandPalette();
const input = await browser.$('.palette-input');
await expect(input).toBeDisplayed();
// Verify input accepts text (functional focus test, not activeElement check
// which is unreliable in WebKit2GTK/tauri-driver)
const canType = await browser.execute(() => {
const el = document.querySelector('.palette-input') as HTMLInputElement | null;
if (!el) return false;
el.focus();
return el === document.activeElement;
});
expect(canType).toBe(true);
await closeCommandPalette();
});
it('should show palette items with command labels and categories', async () => {
await openCommandPalette();
const items = await browser.$$('.palette-item');
expect(items.length).toBeGreaterThanOrEqual(1);
// Each command item should have a label
const cmdLabel = await browser.$('.palette-item .cmd-label');
await expect(cmdLabel).toBeDisplayed();
const labelText = await cmdLabel.getText();
expect(labelText.length).toBeGreaterThan(0);
// Commands should be grouped under category headers
const categories = await browser.$$('.palette-category');
expect(categories.length).toBeGreaterThanOrEqual(1);
await closeCommandPalette();
});
it('should highlight selected item in palette', async () => {
await openCommandPalette();
// First item should be selected by default
const selectedItem = await browser.$('.palette-item.selected');
await expect(selectedItem).toBeExisting();
await closeCommandPalette();
});
it('should filter palette items by typing', async () => {
await openCommandPalette();
const itemsBefore = await browser.$$('.palette-item');
const countBefore = itemsBefore.length;
// Type a nonsense string that won't match any group name
const input = await browser.$('.palette-input');
await input.setValue('zzz_nonexistent_group_xyz');
await browser.pause(300);
// Should show no results or fewer items
const noResults = await browser.$('.no-results');
const itemsAfter = await browser.$$('.palette-item');
// Either no-results message appears OR item count decreased
const filtered = (await noResults.isExisting()) || itemsAfter.length < countBefore;
expect(filtered).toBe(true);
await closeCommandPalette();
});
it('should close palette by clicking backdrop', async () => {
await openCommandPalette();
const palette = await browser.$('.palette');
// Click the backdrop (outside the palette)
await browser.execute(() => {
const backdrop = document.querySelector('.palette-backdrop');
if (backdrop) (backdrop as HTMLElement).click();
});
await browser.pause(500);
await expect(palette).not.toBeDisplayed();
});
});
describe('BTerminal — Terminal Tabs', () => {
before(async () => {
// Ensure Claude tab is active so terminal section is visible
await browser.execute(() => {
const tab = document.querySelector('.project-box .ptab');
if (tab) (tab as HTMLElement).click();
});
await browser.pause(300);
});
it('should show terminal toggle on Claude tab', async () => {
const toggle = await browser.$('.terminal-toggle');
await expect(toggle).toBeDisplayed();
const label = await browser.$('.toggle-label');
const text = await label.getText();
expect(text.toLowerCase()).toContain('terminal');
});
it('should expand terminal area on toggle click', async () => {
// Click terminal toggle via JS
await browser.execute(() => {
const toggle = document.querySelector('.terminal-toggle');
if (toggle) (toggle as HTMLElement).click();
});
await browser.pause(500);
const termArea = await browser.$('.project-terminal-area');
await expect(termArea).toBeDisplayed();
// Chevron should have expanded class
const chevron = await browser.$('.toggle-chevron.expanded');
await expect(chevron).toBeExisting();
});
it('should show add tab button when terminal expanded', async () => {
const addBtn = await browser.$('.tab-add');
await expect(addBtn).toBeDisplayed();
});
it('should add a shell tab', async () => {
// Click add tab button via JS (Svelte onclick)
await browser.execute(() => {
const btn = document.querySelector('.tab-bar .tab-add');
if (btn) (btn as HTMLElement).click();
});
await browser.pause(500);
// Verify tab title via JS to avoid stale element issues
const title = await browser.execute(() => {
const el = document.querySelector('.tab-bar .tab-title');
return el ? el.textContent : '';
});
expect((title as string).toLowerCase()).toContain('shell');
});
it('should show active tab styling', async () => {
const activeTab = await browser.$('.tab.active');
await expect(activeTab).toBeExisting();
});
it('should add a second shell tab and switch between them', async () => {
// Add second tab via JS
await browser.execute(() => {
const btn = document.querySelector('.tab-bar .tab-add');
if (btn) (btn as HTMLElement).click();
});
await browser.pause(500);
const tabCount = await browser.execute(() => {
return document.querySelectorAll('.tab-bar .tab').length;
});
expect(tabCount as number).toBeGreaterThanOrEqual(2);
// Click first tab and verify it becomes active with Shell title
await browser.execute(() => {
const tabs = document.querySelectorAll('.tab-bar .tab');
if (tabs[0]) (tabs[0] as HTMLElement).click();
});
await browser.pause(300);
const activeTitle = await browser.execute(() => {
const active = document.querySelector('.tab-bar .tab.active .tab-title');
return active ? active.textContent : '';
});
expect(activeTitle as string).toContain('Shell');
});
it('should close a tab', async () => {
const tabsBefore = await browser.$$('.tab');
const countBefore = tabsBefore.length;
// Close the last tab
await browser.execute(() => {
const closeBtns = document.querySelectorAll('.tab-close');
if (closeBtns.length > 0) {
(closeBtns[closeBtns.length - 1] as HTMLElement).click();
}
});
await browser.pause(500);
const tabsAfter = await browser.$$('.tab');
expect(tabsAfter.length).toBe(Number(countBefore) - 1);
});
after(async () => {
// Clean up: close remaining tabs and collapse terminal
await browser.execute(() => {
// Close all tabs
const closeBtns = document.querySelectorAll('.tab-close');
closeBtns.forEach(btn => (btn as HTMLElement).click());
});
await browser.pause(300);
// Collapse terminal
await browser.execute(() => {
const toggle = document.querySelector('.terminal-toggle');
if (toggle) {
const chevron = toggle.querySelector('.toggle-chevron.expanded');
if (chevron) (toggle as HTMLElement).click();
}
});
await browser.pause(300);
});
});
describe('BTerminal — Theme Switching', () => {
before(async () => {
await openSettings();
// Scroll to top for theme dropdown
await browser.execute(() => {
const content = document.querySelector('.panel-content') || document.querySelector('.sidebar-panel');
if (content) content.scrollTop = 0;
});
await browser.pause(300);
});
after(async () => {
await closeSettings();
});
it('should show theme dropdown with group labels', async () => {
// Close any open dropdowns first
await browser.execute(() => {
const openMenu = document.querySelector('.dropdown-menu');
if (openMenu) {
const trigger = openMenu.closest('.custom-dropdown')?.querySelector('.dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
}
});
await browser.pause(200);
// Click the first dropdown trigger (theme dropdown)
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(500);
const menu = await browser.$('.dropdown-menu');
await menu.waitForExist({ timeout: 5000 });
// Should have group labels (Catppuccin, Editor, Deep Dark)
const groupLabels = await browser.$$('.dropdown-group-label');
expect(groupLabels.length).toBeGreaterThanOrEqual(2);
// Close dropdown
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(300);
});
it('should switch theme and update CSS variables', async () => {
// Get current base color
const baseBefore = await browser.execute(() => {
return getComputedStyle(document.documentElement).getPropertyValue('--ctp-base').trim();
});
// Open theme dropdown (first custom-dropdown in settings)
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(500);
// Wait for dropdown menu
const menu = await browser.$('.dropdown-menu');
await menu.waitForExist({ timeout: 5000 });
// Click the first non-active theme option
const changed = await browser.execute(() => {
const options = document.querySelectorAll('.dropdown-menu .dropdown-option:not(.active)');
if (options.length > 0) {
(options[0] as HTMLElement).click();
return true;
}
return false;
});
expect(changed).toBe(true);
await browser.pause(500);
// Verify CSS variable changed
const baseAfter = await browser.execute(() => {
return getComputedStyle(document.documentElement).getPropertyValue('--ctp-base').trim();
});
expect(baseAfter).not.toBe(baseBefore);
// Switch back to Catppuccin Mocha (first option) to restore state
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(500);
await browser.execute(() => {
const options = document.querySelectorAll('.dropdown-menu .dropdown-option');
if (options.length > 0) (options[0] as HTMLElement).click();
});
await browser.pause(300);
});
it('should show active theme option', async () => {
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(500);
const menu = await browser.$('.dropdown-menu');
await menu.waitForExist({ timeout: 5000 });
const activeOption = await browser.$('.dropdown-option.active');
await expect(activeOption).toBeExisting();
await browser.execute(() => {
const trigger = document.querySelector('.settings-tab .custom-dropdown .dropdown-trigger');
if (trigger) (trigger as HTMLElement).click();
});
await browser.pause(300);
});
});
describe('BTerminal — Settings Interaction', () => {
before(async () => {
await openSettings();
// Scroll to top for font controls
await browser.execute(() => {
const content = document.querySelector('.panel-content') || document.querySelector('.sidebar-panel');
if (content) content.scrollTop = 0;
});
await browser.pause(300);
});
after(async () => {
await closeSettings();
});
it('should show font size controls with increment/decrement', async () => {
const sizeControls = await browser.$$('.size-control');
expect(sizeControls.length).toBeGreaterThanOrEqual(1);
const sizeBtns = await browser.$$('.size-btn');
expect(sizeBtns.length).toBeGreaterThanOrEqual(2); // at least - and + for one control
const sizeInput = await browser.$('.size-input');
await expect(sizeInput).toBeExisting();
});
it('should increment font size', async () => {
const sizeInput = await browser.$('.size-input');
const valueBefore = await sizeInput.getValue();
// Click the + button (second .size-btn in first .size-control)
await browser.execute(() => {
const btns = document.querySelectorAll('.size-control .size-btn');
// Second button is + (first is -)
if (btns.length >= 2) (btns[1] as HTMLElement).click();
});
await browser.pause(300);
const afterEl = await browser.$('.size-input');
const valueAfter = await afterEl.getValue();
expect(parseInt(valueAfter as string)).toBe(parseInt(valueBefore as string) + 1);
});
it('should decrement font size back', async () => {
const sizeInput = await browser.$('.size-input');
const valueBefore = await sizeInput.getValue();
// Click the - button (first .size-btn)
await browser.execute(() => {
const btns = document.querySelectorAll('.size-control .size-btn');
if (btns.length >= 1) (btns[0] as HTMLElement).click();
});
await browser.pause(300);
const afterEl = await browser.$('.size-input');
const valueAfter = await afterEl.getValue();
expect(parseInt(valueAfter as string)).toBe(parseInt(valueBefore as string) - 1);
});
it('should display group rows with active indicator', async () => {
// Scroll to Groups section (below Appearance, Defaults, Providers)
await browser.execute(() => {
const el = document.querySelector('.group-list');
if (el) el.scrollIntoView({ behavior: 'instant', block: 'center' });
});
await browser.pause(300);
const groupRows = await browser.$$('.group-row');
expect(groupRows.length).toBeGreaterThanOrEqual(1);
const activeGroup = await browser.$('.group-row.active');
await expect(activeGroup).toBeExisting();
});
it('should show project cards', async () => {
// Scroll to Projects section
await browser.execute(() => {
const el = document.querySelector('.project-cards');
if (el) el.scrollIntoView({ behavior: 'instant', block: 'center' });
});
await browser.pause(300);
const cards = await browser.$$('.project-card');
expect(cards.length).toBeGreaterThanOrEqual(1);
});
it('should display project card with name and path', async () => {
const nameInput = await browser.$('.card-name-input');
await expect(nameInput).toBeExisting();
const name = await nameInput.getValue() as string;
expect(name.length).toBeGreaterThan(0);
const cwdInput = await browser.$('.cwd-input');
await expect(cwdInput).toBeExisting();
const cwd = await cwdInput.getValue() as string;
expect(cwd.length).toBeGreaterThan(0);
});
it('should show project toggle switch', async () => {
const toggle = await browser.$('.card-toggle');
await expect(toggle).toBeExisting();
const track = await browser.$('.toggle-track');
await expect(track).toBeDisplayed();
});
it('should show add project form', async () => {
// Scroll to add project form (at bottom of Projects section)
await browser.execute(() => {
const el = document.querySelector('.add-project-form');
if (el) el.scrollIntoView({ behavior: 'instant', block: 'center' });
});
await browser.pause(300);
const addForm = await browser.$('.add-project-form');
await expect(addForm).toBeDisplayed();
const addBtn = await browser.$('.add-project-form .btn-primary');
await expect(addBtn).toBeExisting();
});
});
describe('BTerminal — Keyboard Shortcuts', () => {
before(async () => {
await closeSettings();
await closeCommandPalette();
});
it('should open command palette with Ctrl+K', async () => {
await openCommandPalette();
const input = await browser.$('.palette-input');
await expect(input).toBeDisplayed();
// Close with Escape
await closeCommandPalette();
const palette = await browser.$('.palette');
const isGone = !(await palette.isDisplayed().catch(() => false));
expect(isGone).toBe(true);
});
it('should toggle settings with Ctrl+,', async () => {
await browser.keys(['Control', ',']);
const panel = await browser.$('.sidebar-panel');
await panel.waitForDisplayed({ timeout: 3000 });
// Close with Ctrl+,
await browser.keys(['Control', ',']);
await panel.waitForDisplayed({ timeout: 3000, reverse: true });
});
it('should toggle sidebar with Ctrl+B', async () => {
// Open sidebar first
await browser.keys(['Control', ',']);
const panel = await browser.$('.sidebar-panel');
await panel.waitForDisplayed({ timeout: 3000 });
// Toggle off with Ctrl+B
await browser.keys(['Control', 'b']);
await panel.waitForDisplayed({ timeout: 3000, reverse: true });
});
it('should close sidebar with Escape', async () => {
// Open sidebar
await browser.keys(['Control', ',']);
const panel = await browser.$('.sidebar-panel');
await panel.waitForDisplayed({ timeout: 3000 });
// Close with Escape
await browser.keys('Escape');
await panel.waitForDisplayed({ timeout: 3000, reverse: true });
});
it('should show command palette with categorized commands', async () => {
await openCommandPalette();
const items = await browser.$$('.palette-item');
expect(items.length).toBeGreaterThanOrEqual(1);
// Commands should have labels
const cmdLabel = await browser.$('.palette-item .cmd-label');
await expect(cmdLabel).toBeDisplayed();
await closeCommandPalette();
});
});

View file

@ -7,7 +7,7 @@ import { isJudgeAvailable, assertWithJudge } from '../llm-judge';
//
// Prerequisites:
// - Built debug binary (or SKIP_BUILD=1)
// - groups.json with 2+ projects (use BTERMINAL_TEST_CONFIG_DIR or default)
// - groups.json with 2+ projects (use AGOR_TEST_CONFIG_DIR or default)
// - ANTHROPIC_API_KEY env var for LLM-judged tests (skipped if absent)
// ─── Helpers ──────────────────────────────────────────────────────────

View file

@ -10,12 +10,12 @@ const projectRoot = resolve(__dirname, '../..');
// Debug binary path (built with `cargo tauri build --debug --no-bundle`)
// Cargo workspace target dir is at v2/target/, not v2/src-tauri/target/
const tauriBinary = resolve(projectRoot, 'target/debug/bterminal');
const tauriBinary = resolve(projectRoot, 'target/debug/agent-orchestrator');
let tauriDriver;
// ── Test Fixture (created eagerly so env vars are available for capabilities) ──
const fixtureRoot = join(tmpdir(), `bterminal-e2e-${Date.now()}`);
const fixtureRoot = join(tmpdir(), `agor-e2e-${Date.now()}`);
const fixtureDataDir = join(fixtureRoot, 'data');
const fixtureConfigDir = join(fixtureRoot, 'config');
const fixtureProjectDir = join(fixtureRoot, 'test-project');
@ -26,9 +26,9 @@ mkdirSync(fixtureProjectDir, { recursive: true });
// Create a minimal git repo for agent testing
execSync('git init', { cwd: fixtureProjectDir, stdio: 'ignore' });
execSync('git config user.email "test@bterminal.dev"', { cwd: fixtureProjectDir, stdio: 'ignore' });
execSync('git config user.name "BTerminal Test"', { cwd: fixtureProjectDir, stdio: 'ignore' });
writeFileSync(join(fixtureProjectDir, 'README.md'), '# Test Project\n\nA simple test project for BTerminal E2E tests.\n');
execSync('git config user.email "test@agor.dev"', { cwd: fixtureProjectDir, stdio: 'ignore' });
execSync('git config user.name "Agor Test"', { cwd: fixtureProjectDir, stdio: 'ignore' });
writeFileSync(join(fixtureProjectDir, 'README.md'), '# Test Project\n\nA simple test project for Agor E2E tests.\n');
writeFileSync(join(fixtureProjectDir, 'hello.py'), 'def greet(name: str) -> str:\n return f"Hello, {name}!"\n');
execSync('git add -A && git commit -m "initial commit"', { cwd: fixtureProjectDir, stdio: 'ignore' });
@ -58,9 +58,9 @@ writeFileSync(
// Inject env vars into process.env so tauri-driver inherits them
// (tauri:options.env may not reliably set process-level env vars)
process.env.BTERMINAL_TEST = '1';
process.env.BTERMINAL_TEST_DATA_DIR = fixtureDataDir;
process.env.BTERMINAL_TEST_CONFIG_DIR = fixtureConfigDir;
process.env.AGOR_TEST = '1';
process.env.AGOR_TEST_DATA_DIR = fixtureDataDir;
process.env.AGOR_TEST_CONFIG_DIR = fixtureConfigDir;
console.log(`Test fixture created at ${fixtureRoot}`);
@ -78,7 +78,7 @@ export const config = {
// Single spec file — Tauri launches one app instance per session,
// and tauri-driver can't re-create sessions between spec files.
specs: [
resolve(__dirname, 'specs/bterminal.test.ts'),
resolve(__dirname, 'specs/agor.test.ts'),
resolve(__dirname, 'specs/agent-scenarios.test.ts'),
resolve(__dirname, 'specs/phase-b.test.ts'),
resolve(__dirname, 'specs/phase-c.test.ts'),
@ -92,9 +92,9 @@ export const config = {
application: tauriBinary,
// Test isolation: fixture-created data/config dirs, disable watchers/telemetry
env: {
BTERMINAL_TEST: '1',
BTERMINAL_TEST_DATA_DIR: fixtureDataDir,
BTERMINAL_TEST_CONFIG_DIR: fixtureConfigDir,
AGOR_TEST: '1',
AGOR_TEST_DATA_DIR: fixtureDataDir,
AGOR_TEST_CONFIG_DIR: fixtureConfigDir,
},
},
}],