How seleniumhq/selenium-ide works
Project Type and Purpose
• This is a large monorepo for an open-source automation tool: Selenium IDE.
• It comprises a desktop Electron application (with React UI), multiple CLIs, a playback engine, code-export tooling, migration and test utilities, all wired together via shared libraries in a pnpm/Bazel workspace.
High-Level Architectural Overview
• Monorepo root: orchestration via pnpm-workspace.yaml and BUILD.bazel.
• Packages:
• selenium-ide – Electron app (Main & Renderer processes, React frontend).
• side-runner, side-cli – NodeJS CLIs for batch execution and interactive use.
• side-runtime – Playback engine interpreting .side test files.
• side-api – Typed IPC façade for renderer↔main communication and plugins.
• side-model – Metadata definitions (commands, args, I18N).
• side-commons – Shared utilities.
• side-code-export + code-export-* – Transpilers to various target languages.
• side-migrate – Legacy test-file migration tool.
• side-testkit & webdriver-testkit – Fixtures and helpers for testing.
• get-driver – WebDriver binary management.
Main Components & Interactions
A. Electron Application (“selenium-ide” package)
1. Main Process
– Initializes the app, spawns BrowserWindow instances for UI and playback.
– Hosts “session controllers” implementing side-api commands (Driver, Playback, Menu, Plugins, File I/O, etc.)
– Manages Electron IPC channels (utilizing side-api types)
2. Renderer Process (React UI)
– UI components (AppBar, Controls, Drawer, Project Editor, Playback Panels)
– Uses side-api client to send commands (record, playback, open/close windows).
– Loads preload scripts into UI windows for recording/playback.
3. Preload Scripts
– Injected into each BrowserWindow to bridge DOM events → IPC commands (recorders, selectors).
B. NodeJS Tools
– side-runner: Loads .side files, invokes side-runtime playback API (direct library calls), reports results.
– side-cli: Interactive TTY UI (Ink/React), drives side-runtime like side-runner.
– side-migrate: Reads legacy IDE HTML, outputs .side JSON via migration pipeline modules.
– side-code-export & code-export-*: Library pipeline to transpile .side JSON → language code.
C. Shared Libraries
– side-runtime: Core engine (command tree, callstack, errors, webdriver sync)
– side-api: Type definitions and boilerplate for IPC; shared by all packages needing IDE commands.
– side-model: Schema of commands & args (used by UI, code-export, autocomplete).
– side-commons: Utility functions (events, async, string).
– get-driver & webdriver-testkit: Download, resolve, cache WebDriver binaries for playback.
D. External Integrations
– Web browsers (Chrome, Firefox) via WebDriver
– File system (open/save projects, load code-export templates)
– Plugins (external node modules hooking into side-api)
– CI/CD (GitHub Actions, Bazel)
Architectural Patterns & Principles
• Monorepo modularization: each feature/tool lives in its own package, dependencies declared in package.json and BUILD.bazel.
• Electron multi-process: clear separation of Main vs Renderer, bridged by IPC.
• Layered playback engine: model → runtime → executor (WebDriver)
• Pluggable commands and code-export via well-defined side-api interfaces
• Shared type definitions (TypeScript) to enforce consistency across packages