How to Run Tests for everyone-can-use-english: Playwright E2E Test Guide
Run yarn enjoy:test from the repository root to build the Electron app and execute all Playwright end-to-end tests, or use yarn enjoy:test:main and yarn enjoy:test:renderer to run specific test suites.
The everyone-can-use-english repository by ZuodaoTech is an Electron-based language learning application. Its testing infrastructure relies on Yarn workspaces and Playwright to validate both the main process and renderer (UI) layers. This guide walks through the exact commands, configuration files, and workflow needed to run tests for everyone-can-use-english based on the actual source code implementation.
Prerequisites for Running Tests
Before executing any test commands, ensure your environment meets the following requirements:
- Node.js ≥ 20
- Yarn 4+ (the repository uses Yarn workspaces)
- Operating system with native dependencies for Electron (macOS, Linux, or Windows)
Install all workspace dependencies once:
yarn install
This command installs packages across all workspaces defined in the root package.json.
Test Scripts Overview
The test execution flow is orchestrated through two levels of package.json files: the repository root and the enjoy workspace. Here is the complete breakdown of available test commands for everyone-can-use-english:
| Command | What It Does | Source Location |
|---|---|---|
yarn enjoy:test |
Packages the app, then runs all Playwright tests | [enjoy/package.json](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/package.json#L18) |
yarn enjoy:test:main |
Runs only main process tests (e2e/main.spec.ts) |
[enjoy/package.json](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/package.json#L19) |
yarn enjoy:test:renderer |
Runs only renderer/UI tests (e2e/renderer.spec.ts) |
[enjoy/package.json](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/package.json#L20) |
The test script in enjoy/package.json chains two operations: yarn run package (build) followed by playwright test (execution). This ensures tests always run against the latest packaged build.
Step-by-Step: Run Tests for everyone-can-use-english
Method 1: Full Test Suite (Recommended)
This approach builds the application and runs both main and renderer tests:
# From repository root
yarn install
yarn enjoy:test
The enjoy:test command executes approximately:
cd enjoy && yarn run package && yarn playwright test
Method 2: Targeted Test Suites
For faster iteration during development, run only the relevant test layer:
Main process tests only:
yarn enjoy:test:main
Renderer process tests only:
yarn enjoy:test:renderer
Method 3: Manual Playwright Execution
If you need fine-grained control over Playwright options:
# Step 1: Build the application (required once)
yarn enjoy:package
# Step 2: Run specific spec file with custom options
cd enjoy
yarn playwright test e2e/main.spec.ts -- headed -- project=chromium
Test Configuration Details
Playwright Configuration
The Playwright setup lives in [enjoy/playwright.config.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/playwright.config.ts). Key characteristics include:
- Reporter: HTML output enabled by default
- Test directory:
e2e/folder containing spec files - Electron integration: Tests launch against packaged Electron builds rather than a dev server
Test File Organization
| File | Purpose | Direct Link |
|---|---|---|
e2e/main.spec.ts |
Validates main Electron process functionality | [main.spec.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/e2e/main.spec.ts) |
e2e/renderer.spec.ts |
Validates UI/renderer process behavior | [renderer.spec.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/e2e/renderer.spec.ts) |
Both spec files use Playwright's Electron testing capabilities to automate the actual built application.
Viewing Test Results
After test execution completes, generate and view the HTML report:
macOS:
open ./enjoy/playwright-report/index.html
Linux:
xdg-open ./enjoy/playwright-report/index.html
Windows:
start .\enjoy\playwright-report\index.html
The report includes screenshots, traces, and step-by-step execution logs for any failed tests.
Key Files Summary
Understanding these source files is essential for anyone maintaining or extending tests for everyone-can-use-english:
- [
package.json](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/package.json) — Root workspace configuration defining cross-workspace scripts - [
enjoy/package.json](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/package.json) — Concrete test script definitions (test,test:main,test:renderer) - [
enjoy/playwright.config.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/playwright.config.ts) — Playwright runner configuration - [
enjoy/e2e/main.spec.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/e2e/main.spec.ts) — Example test suite for Electron main process - [
enjoy/e2e/renderer.spec.ts](https://github.com/ZuodaoTech/everyone-can-use-english/blob/main/enjoy/e2e/renderer.spec.ts) — Example test suite for UI interactions
Troubleshooting Common Issues
- Tests fail with "executable not found": Run
yarn enjoy:packagefirst to ensure the Electron binary exists - Renderer tests timeout: Verify display environment (Xvfb on headless Linux) or use
--headedflag for debugging - Outdated test snapshots: Run
yarn playwright test --update-snapshotsto regenerate visual regression baselines
Summary
- Primary command:
yarn enjoy:testbuilds and runs all tests for everyone-can-use-english - Granular control: Use
yarn enjoy:test:mainoryarn enjoy:test:rendererfor specific test layers - Build dependency: Tests require a packaged app; the
testscript handles this automatically - Reporting: HTML reports generate automatically in
playwright-report/index.html - Configuration: All Playwright settings reside in
enjoy/playwright.config.ts
Frequently Asked Questions
What testing framework does everyone-can-use-english use?
The repository uses Playwright for end-to-end testing of the Electron application. According to the ZuodaoTech/everyone-can-use-english source code, Playwright is configured in enjoy/playwright.config.ts with HTML reporting enabled. Tests are organized into main process and renderer process suites located in the enjoy/e2e/ directory.
Do I need to build the app before running tests?
No when using yarn enjoy:test — this command automatically runs yarn run package first to build the Electron app. Yes if running Playwright directly with yarn playwright test — you must manually execute yarn enjoy:package beforehand to ensure the packaged application exists for the test runner to launch.
How do I run only the main process tests?
Execute yarn enjoy:test:main from the repository root. This command is defined in enjoy/package.json and specifically targets e2e/main.spec.ts, skipping the renderer test suite entirely. This is useful for validating backend Electron functionality without the overhead of UI automation.
Where are the test results saved?
Playwright generates an HTML report at enjoy/playwright-report/index.html after each test run. The configuration in playwright.config.ts uses the default HTML reporter. Open this file in any browser to view detailed results including failure traces, screenshots, and execution timelines.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →