How wtechtec/electron-jest works
• A Chrome extension (jest-chrome-plugin) used for element selection on web pages.
• An Electron desktop client built with Vite (jest-electron-vite), which serves as the primary user interface for automated task operations.
• A task execution module (jest-electron-stage) which acts as a runner or “engine” for executing automated flows.
• A lightweight server component (jest-server) that likely offers auxiliary services or API endpoints.
Main Components
a. Chrome Extension (jest-chrome-plugin):
– Contains manifest.json, background, content, and popup folders.
– Uses React (JSX) for UI components and includes custom hooks, utilities, and styling (Stylus).
– Its purpose is to interact with web pages to “capture” UI elements for processes used later by the automation workflow.
b. Electron Desktop Client (jest-electron-vite):
– Built using Electron and Vite with a clearly organized Electron folder (with main.ts, preload.ts, etc.) for the main process.
– Contains a React-based front end (tsx files in src) as well as various components to display, configure, or trigger tasks.
– Integrates the Chrome extension after it is built by placing the packaged extension into a specifically named directory (chrome_extension/JestPro) according to the instructions.
c. Task Executor (jest-electron-stage):
– Contains scripts and configuration (task.data, run scripts) that facilitate running automated tasks.
– Serves as the “engine” or back-end automation runner, likely triggered by the Electron client.
d. Server Component (jest-server):
– Although simpler in structure, it likely handles communication or central coordination (e.g., plugin requests, managing sessions, etc.).
Relationships and Data Flow
– The Chrome extension is used to record/select UI elements; its output is then integrated into the overall automation flow.
– The Electron client (jest-electron-vite) provides a unified UI that may leverage the output from the Chrome extension and interact with the task execution module.
– The task executor (jest-electron-stage) processes and executes the recorded flows/tasks. It might be invoked by the Electron client and possibly interact with components in the server.
– The server (jest-server) might be used for coordination, logging, or other distributed services required by the automation tool.
Architectural Patterns and Design Principles
– Separation of Concerns: Different modules clearly handle distinct responsibilities (UI recording, desktop UI, task execution, and server functions).
– Modular Design: Each module is largely self-contained, making it easier to develop, test, and deploy individually.
– Client-Server Interaction: The Electron client may communicate with the internal task executor or even the server component using IPC (Inter-Process Communication) or WebSocket mechanisms.
– Technology Stack: The system combines modern frontend (React, Vite) in both the Chrome extension and Electron interface, and leverages Electron’s main and preload processes to bridge native integrations.
Essential Elements
– Clear labels for each primary module: Chrome Extension, Electron Client, Task Executor, and Server.
• From “Chrome Extension” to “Electron Client” (integration and packaging).
• From “Electron Client” to “Task Executor” (execution control).
• From “Task Executor” and/or “Electron Client” to “Server” (optional communication/coordination).