test(v2): add integration tests for layout, agent-bridge, and dispatcher

Add 59 new vitest tests: layout.test.ts (30), agent-bridge.test.ts (11),
agent-dispatcher.test.ts (18). Fix unused import in sdk-messages.test.ts.
Add WebDriver E2E scaffold README. Total: 104 vitest + 29 cargo tests.
This commit is contained in:
Hibryda 2026-03-06 15:42:34 +01:00
parent a2bc8838b4
commit 020dc20d4f
5 changed files with 856 additions and 1 deletions

52
v2/tests/e2e/README.md Normal file
View file

@ -0,0 +1,52 @@
# E2E Tests (WebDriver)
Tauri apps use the WebDriver protocol for E2E testing (not Playwright directly).
The app runs inside WebKit2GTK on Linux, so tests interact with the real WebView.
## Prerequisites
- Built Tauri app (`npm run tauri build`)
- Display server (X11 or Wayland) -- headless Xvfb works for CI
- `tauri-driver` installed (`cargo install tauri-driver`)
- WebdriverIO (`npm install --save-dev @wdio/cli @wdio/local-runner @wdio/mocha-framework`)
## Running
```bash
# Terminal 1: Start tauri-driver (bridges WebDriver to WebKit2GTK)
tauri-driver
# Terminal 2: Run tests
npm run test:e2e
```
## CI setup (headless)
```bash
# Install virtual framebuffer
sudo apt install xvfb
# Run with Xvfb wrapper
xvfb-run npm run test:e2e
```
## Writing tests
Tests use WebdriverIO. Example:
```typescript
import { browser } from '@wdio/globals';
describe('BTerminal', () => {
it('should show the terminal pane on startup', async () => {
const terminal = await browser.$('.terminal-pane');
await expect(terminal).toBeDisplayed();
});
});
```
## References
- Tauri WebDriver docs: https://v2.tauri.app/develop/tests/webdriver/
- WebdriverIO docs: https://webdriver.io/
- tauri-driver: https://crates.io/crates/tauri-driver