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
90 lines
2.7 KiB
JavaScript
90 lines
2.7 KiB
JavaScript
/**
|
|
* WebDriverIO config for Electrobun stack E2E tests.
|
|
*
|
|
* Extends shared config with WebKitWebDriver lifecycle and optional
|
|
* PTY daemon management. Port: 9761 (per project convention).
|
|
*/
|
|
|
|
import { execSync } from 'node:child_process';
|
|
import { resolve, dirname } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { existsSync, rmSync } from 'node:fs';
|
|
import { sharedConfig } from './wdio.shared.conf.js';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const projectRoot = resolve(__dirname, '../..');
|
|
const electrobunRoot = resolve(projectRoot, 'ui-electrobun');
|
|
|
|
// Use the Electrobun fixture generator (different groups.json format)
|
|
let fixture;
|
|
try {
|
|
const { createTestFixture } = await import('../../ui-electrobun/tests/e2e/fixtures.ts');
|
|
fixture = createTestFixture('agor-ebun-unified');
|
|
} catch {
|
|
// Fall back to the Tauri fixture generator if Electrobun fixtures not available
|
|
const { createTestFixture } = await import('./infra/fixtures.ts');
|
|
fixture = createTestFixture('agor-ebun-unified');
|
|
}
|
|
|
|
process.env.AGOR_TEST = '1';
|
|
process.env.AGOR_TEST_DATA_DIR = fixture.dataDir;
|
|
process.env.AGOR_TEST_CONFIG_DIR = fixture.configDir;
|
|
|
|
const WEBDRIVER_PORT = 9761;
|
|
|
|
console.log(`[electrobun] Test fixture at ${fixture.rootDir ?? fixture.configDir}`);
|
|
|
|
export const config = {
|
|
...sharedConfig,
|
|
|
|
port: WEBDRIVER_PORT,
|
|
|
|
capabilities: [{
|
|
'wdio:enforceWebDriverClassic': true,
|
|
browserName: 'webkit',
|
|
}],
|
|
|
|
onPrepare() {
|
|
const electrobunBinary = resolve(electrobunRoot, 'build/Agent Orchestrator');
|
|
|
|
if (!existsSync(electrobunBinary) && !process.env.SKIP_BUILD) {
|
|
console.log('Building Electrobun canary...');
|
|
execSync('vite build && electrobun build --env=canary', {
|
|
cwd: electrobunRoot,
|
|
stdio: 'inherit',
|
|
});
|
|
}
|
|
|
|
if (!existsSync(electrobunBinary)) {
|
|
throw new Error(
|
|
`Electrobun binary not found at ${electrobunBinary}. ` +
|
|
"Run 'cd ui-electrobun && bun run build:canary' first."
|
|
);
|
|
}
|
|
},
|
|
|
|
async before() {
|
|
// Wait for Electrobun app to load
|
|
await browser.waitUntil(
|
|
async () => {
|
|
const hasEl = await browser.execute(() =>
|
|
document.querySelector('.app-shell') !== null
|
|
|| document.querySelector('.project-grid') !== null
|
|
|| document.querySelector('.status-bar') !== null
|
|
);
|
|
return hasEl;
|
|
},
|
|
{ timeout: 20_000, interval: 500, timeoutMsg: 'Electrobun app did not load in 20s' },
|
|
);
|
|
console.log('[electrobun] App loaded.');
|
|
},
|
|
|
|
afterSession() {
|
|
const cleanup = fixture.cleanup ?? (() => {
|
|
try {
|
|
if (fixture.rootDir) rmSync(fixture.rootDir, { recursive: true, force: true });
|
|
} catch { /* best-effort */ }
|
|
});
|
|
cleanup();
|
|
},
|
|
};
|