|
| 1 | +# Linux E2E tests (Docker + tauri-driver) |
| 2 | + |
| 3 | +WebDriverIO E2E tests for Cmdr on Linux, using tauri-driver with WebKitGTK's WebKitWebDriver. |
| 4 | + |
| 5 | +This is the workhorse test suite. All platform-independent app logic lives here: dialog flows, keyboard nav, selection, |
| 6 | +view modes, file viewer, settings, command palette, and file operations. macOS tests only cover platform integration |
| 7 | +(APFS ops, volume detection). |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +``` |
| 12 | +WebDriverIO ──HTTP:4444──> tauri-driver ──> WebKitWebDriver ──> WebKitGTK (in-app) |
| 13 | +``` |
| 14 | + |
| 15 | +Runs inside a Docker container (Ubuntu 24.04) with Xvfb for headless GUI. The host's source code is mounted in, so the |
| 16 | +Tauri app is built inside the container. |
| 17 | + |
| 18 | +## Running |
| 19 | + |
| 20 | +```bash |
| 21 | +cd apps/desktop |
| 22 | +pnpm test:e2e:linux # Docker (recommended, works from macOS) |
| 23 | +pnpm test:e2e:linux:build # force rebuild Docker image |
| 24 | +pnpm test:e2e:linux:shell # interactive shell in container for debugging |
| 25 | +pnpm test:e2e:linux:native # native Linux only (requires Tauri prereqs) |
| 26 | +./scripts/e2e-linux.sh --clean # nuke build cache (try this when tests fail oddly) |
| 27 | +``` |
| 28 | + |
| 29 | +## Fixture system |
| 30 | + |
| 31 | +Tests use a shared fixture helper (`../e2e-shared/fixtures.ts`) that creates a temp directory tree at |
| 32 | +`/tmp/cmdr-e2e-<timestamp>/` with `left/` (text files, sub-dir, hidden file, bulk .dat files) and `right/` (empty). |
| 33 | + |
| 34 | +The `CMDR_E2E_START_PATH` env var tells the app where to open. Fixtures are fully recreated before each test via |
| 35 | +`recreateFixtures()` in the `beforeTest` hook so tests don't affect each other. |
| 36 | + |
| 37 | +## WebKitGTK WebDriver quirks |
| 38 | + |
| 39 | +These are critical for writing tests. Without these workarounds, tests will silently fail. |
| 40 | + |
| 41 | +### 1. Native clicks fail on non-form elements |
| 42 | + |
| 43 | +WebKitGTK's WebDriver rejects clicks on non-interactive container elements. **Use `jsClick()` (JS `el.click()`) |
| 44 | +instead:** |
| 45 | + |
| 46 | +```typescript |
| 47 | +async function jsClick(element: WebdriverIO.Element): Promise<void> { |
| 48 | + await browser.execute((el: HTMLElement) => el.click(), element as unknown as HTMLElement) |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### 2. `browser.keys(' ')` doesn't deliver Space |
| 53 | + |
| 54 | +The Space character hits a CharKey/VirtualKey ambiguity in WebKitWebDriver. **Use the W3C Actions API instead:** |
| 55 | + |
| 56 | +```typescript |
| 57 | +await browser.action('key').down(' ').pause(50).up(' ').perform() |
| 58 | +await browser.releaseActions() |
| 59 | +``` |
| 60 | + |
| 61 | +## Files |
| 62 | + |
| 63 | +| File | Purpose | |
| 64 | +| -------------------------- | --------------------------------------------------------------- | |
| 65 | +| `wdio.conf.ts` | WebDriverIO config: spawns tauri-driver, manages fixtures | |
| 66 | +| `app.spec.ts` | 14 tests: rendering, keyboard nav, mouse interaction, dialogs | |
| 67 | +| `file-operations.spec.ts` | 8 tests: copy, move, rename, mkdir, view modes, hidden, palette | |
| 68 | +| `settings.spec.ts` | 5 tests: settings panel | |
| 69 | +| `viewer.spec.ts` | 10 tests: file viewer | |
| 70 | +| `docker/Dockerfile` | Ubuntu 24.04 image with Tauri prereqs, Xvfb, Node, Rust | |
| 71 | +| `docker/entrypoint.sh` | Xvfb/dbus setup for headless GUI | |
| 72 | +| `tsconfig.json` | TypeScript config for WDIO types | |
| 73 | + |
| 74 | +## Related |
| 75 | + |
| 76 | +- Shared fixture helper: `test/e2e-shared/fixtures.ts` |
| 77 | +- Full guide: `docs/tooling/e2e-testing-guide.md` |
| 78 | +- macOS E2E tests: `test/e2e-macos/` (platform integration only — APFS ops, volume detection) |
| 79 | +- Linux stubs: `src-tauri/src/stubs/` (volumes, network, permissions use stubs on Linux) |
0 commit comments