oh-my-codex-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
- package/.agent/skills/agent-kb/README.md +46 -0
- package/.agent/skills/agent-kb/SKILL.md +128 -0
- package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
- package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
- package/.agent/skills/aireview/SKILL.md +704 -0
- package/.agent/skills/analyze/SKILL.md +81 -0
- package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
- package/.agent/skills/architect-planner/README.md +41 -0
- package/.agent/skills/architect-planner/SKILL.md +539 -0
- package/.agent/skills/auto-mbti/SKILL.md +291 -0
- package/.agent/skills/autopilot/SKILL.md +222 -0
- package/.agent/skills/backend-patterns/SKILL.md +602 -0
- package/.agent/skills/bdd-generator/README.md +78 -0
- package/.agent/skills/bdd-generator/SKILL.md +436 -0
- package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
- package/.agent/skills/brainstorming/README.md +41 -0
- package/.agent/skills/brainstorming/SKILL.md +165 -0
- package/.agent/skills/build-fix/SKILL.md +190 -0
- package/.agent/skills/cancel/SKILL.md +658 -0
- package/.agent/skills/checkpoint/SKILL.md +94 -0
- package/.agent/skills/code-review/SKILL.md +273 -0
- package/.agent/skills/coding-standards/SKILL.md +535 -0
- package/.agent/skills/conductor/SKILL.md +128 -0
- package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
- package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
- package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
- package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
- package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
- package/.agent/skills/conductor/scripts/install.sh +89 -0
- package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
- package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
- package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
- package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
- package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
- package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
- package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
- package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
- package/.agent/skills/conductor/templates/rules/README.md +23 -0
- package/.agent/skills/conductor/templates/rules/agents.md +49 -0
- package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
- package/.agent/skills/conductor/templates/rules/dev.md +20 -0
- package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
- package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
- package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
- package/.agent/skills/conductor/templates/rules/performance.md +47 -0
- package/.agent/skills/conductor/templates/rules/research.md +26 -0
- package/.agent/skills/conductor/templates/rules/review.md +22 -0
- package/.agent/skills/conductor/templates/rules/security.md +36 -0
- package/.agent/skills/conductor/templates/rules/testing.md +30 -0
- package/.agent/skills/conductor/templates/workflow.md +333 -0
- package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
- package/.agent/skills/consensus/README.md +41 -0
- package/.agent/skills/consensus/SKILL.md +317 -0
- package/.agent/skills/content-research-writer/SKILL.md +537 -0
- package/.agent/skills/debug-analysis/SKILL.md +331 -0
- package/.agent/skills/deepinit/SKILL.md +347 -0
- package/.agent/skills/deepsearch/SKILL.md +56 -0
- package/.agent/skills/doctor/SKILL.md +158 -0
- package/.agent/skills/drawio/EXAMPLES.md +382 -0
- package/.agent/skills/drawio/QUICK_START.md +237 -0
- package/.agent/skills/drawio/README.md +315 -0
- package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
- package/.agent/skills/drawio/SKILL.md +1176 -0
- package/.agent/skills/e2e/SKILL.md +396 -0
- package/.agent/skills/ecomode/SKILL.md +160 -0
- package/.agent/skills/electron-driver/SKILL.md +144 -0
- package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
- package/.agent/skills/eval/SKILL.md +140 -0
- package/.agent/skills/eval-harness/SKILL.md +242 -0
- package/.agent/skills/evolve/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/frontend-patterns/SKILL.md +646 -0
- package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
- package/.agent/skills/git-master/SKILL.md +75 -0
- package/.agent/skills/help/SKILL.md +89 -0
- package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
- package/.agent/skills/local-skills-setup/SKILL.md +483 -0
- package/.agent/skills/log-analyzer/SKILL.md +187 -0
- package/.agent/skills/mcp-setup/SKILL.md +226 -0
- package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
- package/.agent/skills/multi-model-research/README.md +233 -0
- package/.agent/skills/multi-model-research/SKILL.md +541 -0
- package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
- package/.agent/skills/note/SKILL.md +80 -0
- package/.agent/skills/omc-setup/SKILL.md +219 -0
- package/.agent/skills/orchestrate/SKILL.md +620 -0
- package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
- package/.agent/skills/patent-workflow/README.md +455 -0
- package/.agent/skills/patent-workflow/SKILL.md +1036 -0
- package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
- package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
- package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
- package/.agent/skills/pattern-recognition/SKILL.md +792 -0
- package/.agent/skills/pipeline/SKILL.md +448 -0
- package/.agent/skills/plan/SKILL.md +309 -0
- package/.agent/skills/planning-methodology/SKILL.md +370 -0
- package/.agent/skills/planning-with-files/SKILL.md +210 -0
- package/.agent/skills/planning-with-files/examples.md +202 -0
- package/.agent/skills/planning-with-files/reference.md +218 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
- package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
- package/.agent/skills/planning-with-files/templates/findings.md +95 -0
- package/.agent/skills/planning-with-files/templates/progress.md +114 -0
- package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
- package/.agent/skills/project-analyze/CLAUDE.md +18 -0
- package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
- package/.agent/skills/project-analyze/README.md +42 -0
- package/.agent/skills/project-analyze/SKILL.md +289 -0
- package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
- package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
- package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
- package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
- package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
- package/.agent/skills/project-session-manager/SKILL.md +428 -0
- package/.agent/skills/project-session-manager/lib/config.sh +86 -0
- package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
- package/.agent/skills/project-session-manager/lib/session.sh +132 -0
- package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
- package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
- package/.agent/skills/project-session-manager/psm.sh +629 -0
- package/.agent/skills/project-session-manager/templates/feature.md +56 -0
- package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
- package/.agent/skills/project-session-manager/templates/projects.json +19 -0
- package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
- package/.agent/skills/quality-check/README.md +50 -0
- package/.agent/skills/quality-check/SKILL.md +240 -0
- package/.agent/skills/quality-check/SKILL.md.backup +238 -0
- package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
- package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
- package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
- package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
- package/.agent/skills/quality-validation/SKILL.md +519 -0
- package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
- package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
- package/.agent/skills/ralph/SKILL.md +236 -0
- package/.agent/skills/ralph-init/SKILL.md +78 -0
- package/.agent/skills/ralplan/SKILL.md +58 -0
- package/.agent/skills/refactor-clean/SKILL.md +49 -0
- package/.agent/skills/release/SKILL.md +84 -0
- package/.agent/skills/research/SKILL.md +526 -0
- package/.agent/skills/research-methodology/SKILL.md +268 -0
- package/.agent/skills/review/SKILL.md +53 -0
- package/.agent/skills/security-review/SKILL.md +509 -0
- package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/.agent/skills/setup-pm/SKILL.md +102 -0
- package/.agent/skills/skill/SKILL.md +424 -0
- package/.agent/skills/skill-create/SKILL.md +209 -0
- package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
- package/.agent/skills/skill-debugger/README.md +44 -0
- package/.agent/skills/skill-debugger/SKILL.md +326 -0
- package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
- package/.agent/skills/skill-development/SKILL.md +661 -0
- package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
- package/.agent/skills/skill-doc-generator/README.md +37 -0
- package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
- package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
- package/.agent/skills/skill-quality-analyzer/README.md +61 -0
- package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
- package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
- package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
- package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
- package/.agent/skills/skill-tester/README.md +46 -0
- package/.agent/skills/skill-tester/SKILL.md +345 -0
- package/.agent/skills/start-dev/SKILL.md +701 -0
- package/.agent/skills/swarm/SKILL.md +691 -0
- package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
- package/.agent/skills/task-kb-record/SKILL.md +417 -0
- package/.agent/skills/tdd/SKILL.md +446 -0
- package/.agent/skills/tdd-generator/DEMO.md +516 -0
- package/.agent/skills/tdd-generator/README.md +89 -0
- package/.agent/skills/tdd-generator/SKILL.md +278 -0
- package/.agent/skills/tdd-workflow/SKILL.md +424 -0
- package/.agent/skills/test-coverage/SKILL.md +48 -0
- package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
- package/.agent/skills/thinkdeep/README.md +41 -0
- package/.agent/skills/thinkdeep/SKILL.md +343 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/.agent/skills/ultrapilot/SKILL.md +647 -0
- package/.agent/skills/ultraqa/SKILL.md +152 -0
- package/.agent/skills/ultrawork/SKILL.md +123 -0
- package/.agent/skills/update-codemaps/SKILL.md +38 -0
- package/.agent/skills/update-docs/SKILL.md +52 -0
- package/.agent/skills/verification-loop/SKILL.md +140 -0
- package/.agent/skills/verify/SKILL.md +80 -0
- package/.agent/skills/writer-memory/SKILL.md +459 -0
- package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
- package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
- package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
- package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
- package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
- package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
- package/.governance/skill-lint.allowlist +4 -0
- package/.governance/skill-llm.allowlist +4 -0
- package/AGENTS.md +59 -0
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/README.zh.md +145 -0
- package/bin/omcodex.js +8 -0
- package/commands/conductor/implement.toml +358 -0
- package/commands/conductor/newTrack.toml +142 -0
- package/commands/conductor/revert.toml +123 -0
- package/commands/conductor/setup.toml +429 -0
- package/commands/conductor/status.toml +57 -0
- package/docs/ALIGNMENT.md +40 -0
- package/docs/CODEX.md +133 -0
- package/docs/NOTIFY.md +81 -0
- package/docs/SKILL_GOVERNANCE.md +72 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
- package/package.json +50 -0
- package/prompts/architect.md +105 -0
- package/prompts/executor.md +134 -0
- package/prompts/planner.md +113 -0
- package/scripts/check-skill-governance.sh +84 -0
- package/scripts/check-skill-llm-governance.js +302 -0
- package/scripts/eval-skills.js +217 -0
- package/scripts/generate-catalog-docs.js +95 -0
- package/scripts/generate-codex-mcp-config.sh +22 -0
- package/scripts/install-codex-force.sh +5 -0
- package/scripts/install-codex-incremental.sh +5 -0
- package/scripts/install-codex.sh +79 -0
- package/scripts/notify-dispatch.js +15 -0
- package/scripts/setup-package-manager.js +137 -0
- package/src/catalog/generated/public-catalog.json +547 -0
- package/src/catalog/manifest.json +542 -0
- package/src/catalog/reader.js +43 -0
- package/src/catalog/schema.js +79 -0
- package/src/cli/doctor.js +62 -0
- package/src/cli/index.js +85 -0
- package/src/cli/notify.js +127 -0
- package/src/cli/route.js +43 -0
- package/src/cli/setup.js +155 -0
- package/src/cli/team.js +125 -0
- package/src/config/generator.js +119 -0
- package/src/mcp/memory-server.js +241 -0
- package/src/mcp/state-server.js +112 -0
- package/src/mcp/trace-server.js +168 -0
- package/src/notify/dispatch.js +74 -0
- package/src/notify/extensibility/dispatcher.js +113 -0
- package/src/notify/extensibility/events.js +15 -0
- package/src/notify/extensibility/loader.js +54 -0
- package/src/router/skill-router.js +90 -0
- package/src/team/auto-advance.js +72 -0
- package/src/team/orchestrator.js +82 -0
- package/src/team/state-store.js +33 -0
- package/src/utils/paths.js +33 -0
- package/templates/AGENTS.md +15 -0
- package/templates/catalog-manifest.json +542 -0
- package/templates/code_styleguides/csharp.md +115 -0
- package/templates/code_styleguides/dart.md +238 -0
- package/templates/code_styleguides/general.md +23 -0
- package/templates/code_styleguides/go.md +48 -0
- package/templates/code_styleguides/html-css.md +49 -0
- package/templates/code_styleguides/javascript.md +51 -0
- package/templates/code_styleguides/python.md +37 -0
- package/templates/code_styleguides/typescript.md +43 -0
- package/templates/rules/README.md +23 -0
- package/templates/rules/agents.md +49 -0
- package/templates/rules/coding-style.md +70 -0
- package/templates/rules/dev.md +20 -0
- package/templates/rules/git-workflow.md +45 -0
- package/templates/rules/notify.md +6 -0
- package/templates/rules/patterns.md +55 -0
- package/templates/rules/performance.md +47 -0
- package/templates/rules/research.md +26 -0
- package/templates/rules/review.md +22 -0
- package/templates/rules/security.md +36 -0
- package/templates/rules/testing.md +30 -0
- package/templates/workflow.md +333 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e
|
|
3
|
+
description: Imported from everything-codex command e2e
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
description: Generate and run end-to-end tests with Playwright. Creates test journeys, runs tests, captures screenshots/videos/traces, and uploads artifacts.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# E2E Command
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Native Subagent Protocol (Codex)
|
|
14
|
+
|
|
15
|
+
Codex supports native subagents. Delegate with `spawn_agent`, coordinate with `send_input`, collect via `wait`, and clean up with `close_agent`.
|
|
16
|
+
|
|
17
|
+
Execution preference:
|
|
18
|
+
1. Use native subagents first for independent workstreams (parallel when possible).
|
|
19
|
+
2. Merge results in main thread and run final verification.
|
|
20
|
+
3. Fallback only when delegation is blocked: use the `[ANALYST]`/`[ARCHITECT]`/`[EXECUTOR]`/`[REVIEWER]` structure in a single response.
|
|
21
|
+
|
|
22
|
+
Minimal orchestration pattern:
|
|
23
|
+
```text
|
|
24
|
+
spawn_agent -> send_input (optional) -> wait -> close_agent
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command invokes the **e2e-runner** agent to generate, maintain, and execute end-to-end tests using Playwright.
|
|
28
|
+
|
|
29
|
+
## What This Command Does
|
|
30
|
+
|
|
31
|
+
1. **Generate Test Journeys** - Create Playwright tests for user flows
|
|
32
|
+
2. **Run E2E Tests** - Execute tests across browsers
|
|
33
|
+
3. **Capture Artifacts** - Screenshots, videos, traces on failures
|
|
34
|
+
4. **Upload Results** - HTML reports and JUnit XML
|
|
35
|
+
5. **Identify Flaky Tests** - Quarantine unstable tests
|
|
36
|
+
|
|
37
|
+
## When to Use
|
|
38
|
+
|
|
39
|
+
Use `$e2e` when:
|
|
40
|
+
- Testing critical user journeys (login, trading, payments)
|
|
41
|
+
- Verifying multi-step flows work end-to-end
|
|
42
|
+
- Testing UI interactions and navigation
|
|
43
|
+
- Validating integration between frontend and backend
|
|
44
|
+
- Preparing for production deployment
|
|
45
|
+
|
|
46
|
+
## Integration with `tdd` and `electron-driver`
|
|
47
|
+
|
|
48
|
+
Use `$e2e` as the top-level E2E orchestrator:
|
|
49
|
+
|
|
50
|
+
1. `$tdd` covers unit and integration tests first.
|
|
51
|
+
2. `$e2e` covers cross-layer user journeys.
|
|
52
|
+
3. If target is Electron desktop app, route execution to `$electron-driver` for runtime driving while keeping Playwright-style assertions and artifacts.
|
|
53
|
+
|
|
54
|
+
Electron routing signals:
|
|
55
|
+
- `electron` in package dependencies or scripts
|
|
56
|
+
- desktop window flows, native menu, preload/IPC interactions
|
|
57
|
+
- user explicitly asks for Electron app automation
|
|
58
|
+
|
|
59
|
+
## How It Works
|
|
60
|
+
|
|
61
|
+
The e2e-runner agent will:
|
|
62
|
+
|
|
63
|
+
1. **Analyze user flow** and identify test scenarios
|
|
64
|
+
2. **Generate Playwright test** using Page Object Model pattern
|
|
65
|
+
3. **Run tests** across multiple browsers (Chrome, Firefox, Safari)
|
|
66
|
+
4. **Capture failures** with screenshots, videos, and traces
|
|
67
|
+
5. **Generate report** with results and artifacts
|
|
68
|
+
6. **Identify flaky tests** and recommend fixes
|
|
69
|
+
|
|
70
|
+
## Example Usage
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
User: $e2e Test the market search and view flow
|
|
74
|
+
|
|
75
|
+
Agent (e2e-runner):
|
|
76
|
+
# E2E Test Generation: Market Search and View Flow
|
|
77
|
+
|
|
78
|
+
## Test Scenario Identified
|
|
79
|
+
|
|
80
|
+
**User Journey:** Market Search → View Results → Click Market → View Details
|
|
81
|
+
|
|
82
|
+
**Test Coverage:**
|
|
83
|
+
1. Navigate to markets page
|
|
84
|
+
2. Perform semantic search
|
|
85
|
+
3. Verify search results
|
|
86
|
+
4. Click on first result
|
|
87
|
+
5. Verify market details page loads
|
|
88
|
+
6. Verify chart renders
|
|
89
|
+
|
|
90
|
+
## Generated Test Code
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// tests/e2e/markets/search-and-view.spec.ts
|
|
94
|
+
import { test, expect } from '@playwright/test'
|
|
95
|
+
import { MarketsPage } from '../../pages/MarketsPage'
|
|
96
|
+
import { MarketDetailsPage } from '../../pages/MarketDetailsPage'
|
|
97
|
+
|
|
98
|
+
test.describe('Market Search and View Flow', () => {
|
|
99
|
+
test('user can search markets and view details', async ({ page }) => {
|
|
100
|
+
// 1. Navigate to markets page
|
|
101
|
+
const marketsPage = new MarketsPage(page)
|
|
102
|
+
await marketsPage.goto()
|
|
103
|
+
|
|
104
|
+
// Verify page loaded
|
|
105
|
+
await expect(page).toHaveTitle(/Markets/)
|
|
106
|
+
await expect(page.locator('h1')).toContainText('Markets')
|
|
107
|
+
|
|
108
|
+
// 2. Perform semantic search
|
|
109
|
+
await marketsPage.searchMarkets('election')
|
|
110
|
+
|
|
111
|
+
// Wait for API response
|
|
112
|
+
await page.waitForResponse(resp =>
|
|
113
|
+
resp.url().includes('/api/markets/search') && resp.status() === 200
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
// 3. Verify search results
|
|
117
|
+
const marketCards = marketsPage.marketCards
|
|
118
|
+
await expect(marketCards.first()).toBeVisible()
|
|
119
|
+
const resultCount = await marketCards.count()
|
|
120
|
+
expect(resultCount).toBeGreaterThan(0)
|
|
121
|
+
|
|
122
|
+
// Take screenshot of search results
|
|
123
|
+
await page.screenshot({ path: 'artifacts/search-results.png' })
|
|
124
|
+
|
|
125
|
+
// 4. Click on first result
|
|
126
|
+
const firstMarketTitle = await marketCards.first().textContent()
|
|
127
|
+
await marketCards.first().click()
|
|
128
|
+
|
|
129
|
+
// 5. Verify market details page loads
|
|
130
|
+
await expect(page).toHaveURL(/\/markets\/[a-z0-9-]+/)
|
|
131
|
+
|
|
132
|
+
const detailsPage = new MarketDetailsPage(page)
|
|
133
|
+
await expect(detailsPage.marketName).toBeVisible()
|
|
134
|
+
await expect(detailsPage.marketDescription).toBeVisible()
|
|
135
|
+
|
|
136
|
+
// 6. Verify chart renders
|
|
137
|
+
await expect(detailsPage.priceChart).toBeVisible()
|
|
138
|
+
|
|
139
|
+
// Verify market name matches
|
|
140
|
+
const detailsTitle = await detailsPage.marketName.textContent()
|
|
141
|
+
expect(detailsTitle?.toLowerCase()).toContain(
|
|
142
|
+
firstMarketTitle?.toLowerCase().substring(0, 20) || ''
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
// Take screenshot of market details
|
|
146
|
+
await page.screenshot({ path: 'artifacts/market-details.png' })
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
test('search with no results shows empty state', async ({ page }) => {
|
|
150
|
+
const marketsPage = new MarketsPage(page)
|
|
151
|
+
await marketsPage.goto()
|
|
152
|
+
|
|
153
|
+
// Search for non-existent market
|
|
154
|
+
await marketsPage.searchMarkets('xyznonexistentmarket123456')
|
|
155
|
+
|
|
156
|
+
// Verify empty state
|
|
157
|
+
await expect(page.locator('[data-testid="no-results"]')).toBeVisible()
|
|
158
|
+
await expect(page.locator('[data-testid="no-results"]')).toContainText(
|
|
159
|
+
/no.*results|no.*markets/i
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const marketCount = await marketsPage.marketCards.count()
|
|
163
|
+
expect(marketCount).toBe(0)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
test('can clear search and see all markets again', async ({ page }) => {
|
|
167
|
+
const marketsPage = new MarketsPage(page)
|
|
168
|
+
await marketsPage.goto()
|
|
169
|
+
|
|
170
|
+
// Initial market count
|
|
171
|
+
const initialCount = await marketsPage.marketCards.count()
|
|
172
|
+
|
|
173
|
+
// Perform search
|
|
174
|
+
await marketsPage.searchMarkets('trump')
|
|
175
|
+
await page.waitForLoadState('networkidle')
|
|
176
|
+
|
|
177
|
+
// Verify filtered results
|
|
178
|
+
const filteredCount = await marketsPage.marketCards.count()
|
|
179
|
+
expect(filteredCount).toBeLessThan(initialCount)
|
|
180
|
+
|
|
181
|
+
// Clear search
|
|
182
|
+
await marketsPage.searchInput.clear()
|
|
183
|
+
await page.waitForLoadState('networkidle')
|
|
184
|
+
|
|
185
|
+
// Verify all markets shown again
|
|
186
|
+
const finalCount = await marketsPage.marketCards.count()
|
|
187
|
+
expect(finalCount).toBe(initialCount)
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Running Tests
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Run the generated test
|
|
196
|
+
npx playwright test tests/e2e/markets/search-and-view.spec.ts
|
|
197
|
+
|
|
198
|
+
Running 3 tests using 3 workers
|
|
199
|
+
|
|
200
|
+
✓ [chromium] › search-and-view.spec.ts:5:3 › user can search markets and view details (4.2s)
|
|
201
|
+
✓ [chromium] › search-and-view.spec.ts:52:3 › search with no results shows empty state (1.8s)
|
|
202
|
+
✓ [chromium] › search-and-view.spec.ts:67:3 › can clear search and see all markets again (2.9s)
|
|
203
|
+
|
|
204
|
+
3 passed (9.1s)
|
|
205
|
+
|
|
206
|
+
Artifacts generated:
|
|
207
|
+
- artifacts/search-results.png
|
|
208
|
+
- artifacts/market-details.png
|
|
209
|
+
- playwright-report/index.html
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Test Report
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
216
|
+
║ E2E Test Results ║
|
|
217
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
218
|
+
║ Status: ✅ ALL TESTS PASSED ║
|
|
219
|
+
║ Total: 3 tests ║
|
|
220
|
+
║ Passed: 3 (100%) ║
|
|
221
|
+
║ Failed: 0 ║
|
|
222
|
+
║ Flaky: 0 ║
|
|
223
|
+
║ Duration: 9.1s ║
|
|
224
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
225
|
+
|
|
226
|
+
Artifacts:
|
|
227
|
+
📸 Screenshots: 2 files
|
|
228
|
+
📹 Videos: 0 files (only on failure)
|
|
229
|
+
🔍 Traces: 0 files (only on failure)
|
|
230
|
+
📊 HTML Report: playwright-report/index.html
|
|
231
|
+
|
|
232
|
+
View report: npx playwright show-report
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
✅ E2E test suite ready for CI/CD integration!
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Test Artifacts
|
|
239
|
+
|
|
240
|
+
When tests run, the following artifacts are captured:
|
|
241
|
+
|
|
242
|
+
**On All Tests:**
|
|
243
|
+
- HTML Report with timeline and results
|
|
244
|
+
- JUnit XML for CI integration
|
|
245
|
+
|
|
246
|
+
**On Failure Only:**
|
|
247
|
+
- Screenshot of the failing state
|
|
248
|
+
- Video recording of the test
|
|
249
|
+
- Trace file for debugging (step-by-step replay)
|
|
250
|
+
- Network logs
|
|
251
|
+
- Console logs
|
|
252
|
+
|
|
253
|
+
## Viewing Artifacts
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# View HTML report in browser
|
|
257
|
+
npx playwright show-report
|
|
258
|
+
|
|
259
|
+
# View specific trace file
|
|
260
|
+
npx playwright show-trace artifacts/trace-abc123.zip
|
|
261
|
+
|
|
262
|
+
# Screenshots are saved in artifacts/ directory
|
|
263
|
+
open artifacts/search-results.png
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Flaky Test Detection
|
|
267
|
+
|
|
268
|
+
If a test fails intermittently:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
⚠️ FLAKY TEST DETECTED: tests/e2e/markets/trade.spec.ts
|
|
272
|
+
|
|
273
|
+
Test passed 7/10 runs (70% pass rate)
|
|
274
|
+
|
|
275
|
+
Common failure:
|
|
276
|
+
"Timeout waiting for element '[data-testid="confirm-btn"]'"
|
|
277
|
+
|
|
278
|
+
Recommended fixes:
|
|
279
|
+
1. Add explicit wait: await page.waitForSelector('[data-testid="confirm-btn"]')
|
|
280
|
+
2. Increase timeout: { timeout: 10000 }
|
|
281
|
+
3. Check for race conditions in component
|
|
282
|
+
4. Verify element is not hidden by animation
|
|
283
|
+
|
|
284
|
+
Quarantine recommendation: Mark as test.fixme() until fixed
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Browser Configuration
|
|
288
|
+
|
|
289
|
+
Tests run on multiple browsers by default:
|
|
290
|
+
- ✅ Chromium (Desktop Chrome)
|
|
291
|
+
- ✅ Firefox (Desktop)
|
|
292
|
+
- ✅ WebKit (Desktop Safari)
|
|
293
|
+
- ✅ Mobile Chrome (optional)
|
|
294
|
+
|
|
295
|
+
Configure in `playwright.config.ts` to adjust browsers.
|
|
296
|
+
|
|
297
|
+
## CI/CD Integration
|
|
298
|
+
|
|
299
|
+
Add to your CI pipeline:
|
|
300
|
+
|
|
301
|
+
```yaml
|
|
302
|
+
# .github/workflows/e2e.yml
|
|
303
|
+
- name: Install Playwright
|
|
304
|
+
run: npx playwright install --with-deps
|
|
305
|
+
|
|
306
|
+
- name: Run E2E tests
|
|
307
|
+
run: npx playwright test
|
|
308
|
+
|
|
309
|
+
- name: Upload artifacts
|
|
310
|
+
if: always()
|
|
311
|
+
uses: actions/upload-artifact@v3
|
|
312
|
+
with:
|
|
313
|
+
name: playwright-report
|
|
314
|
+
path: playwright-report/
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## PMX-Specific Critical Flows
|
|
318
|
+
|
|
319
|
+
For PMX, prioritize these E2E tests:
|
|
320
|
+
|
|
321
|
+
**🔴 CRITICAL (Must Always Pass):**
|
|
322
|
+
1. User can connect wallet
|
|
323
|
+
2. User can browse markets
|
|
324
|
+
3. User can search markets (semantic search)
|
|
325
|
+
4. User can view market details
|
|
326
|
+
5. User can place trade (with test funds)
|
|
327
|
+
6. Market resolves correctly
|
|
328
|
+
7. User can withdraw funds
|
|
329
|
+
|
|
330
|
+
**🟡 IMPORTANT:**
|
|
331
|
+
1. Market creation flow
|
|
332
|
+
2. User profile updates
|
|
333
|
+
3. Real-time price updates
|
|
334
|
+
4. Chart rendering
|
|
335
|
+
5. Filter and sort markets
|
|
336
|
+
6. Mobile responsive layout
|
|
337
|
+
|
|
338
|
+
## Best Practices
|
|
339
|
+
|
|
340
|
+
**DO:**
|
|
341
|
+
- ✅ Use Page Object Model for maintainability
|
|
342
|
+
- ✅ Use data-testid attributes for selectors
|
|
343
|
+
- ✅ Wait for API responses, not arbitrary timeouts
|
|
344
|
+
- ✅ Test critical user journeys end-to-end
|
|
345
|
+
- ✅ Run tests before merging to main
|
|
346
|
+
- ✅ Review artifacts when tests fail
|
|
347
|
+
|
|
348
|
+
**DON'T:**
|
|
349
|
+
- ❌ Use brittle selectors (CSS classes can change)
|
|
350
|
+
- ❌ Test implementation details
|
|
351
|
+
- ❌ Run tests against production
|
|
352
|
+
- ❌ Ignore flaky tests
|
|
353
|
+
- ❌ Skip artifact review on failures
|
|
354
|
+
- ❌ Test every edge case with E2E (use unit tests)
|
|
355
|
+
|
|
356
|
+
## Important Notes
|
|
357
|
+
|
|
358
|
+
**CRITICAL for PMX:**
|
|
359
|
+
- E2E tests involving real money MUST run on testnet/staging only
|
|
360
|
+
- Never run trading tests against production
|
|
361
|
+
- Set `test.skip(process.env.NODE_ENV === 'production')` for financial tests
|
|
362
|
+
- Use test wallets with small test funds only
|
|
363
|
+
|
|
364
|
+
## Integration with Other Commands
|
|
365
|
+
|
|
366
|
+
- Use `$plan` to identify critical journeys to test
|
|
367
|
+
- Use `$tdd` for unit tests (faster, more granular)
|
|
368
|
+
- Use `$e2e` for integration and user journey tests
|
|
369
|
+
- Use `$code-review` to verify test quality
|
|
370
|
+
|
|
371
|
+
## Related Agents
|
|
372
|
+
|
|
373
|
+
This command invokes the `e2e-runner` agent located at:
|
|
374
|
+
`~/.codex/agents/e2e-runner.md` (if present)
|
|
375
|
+
|
|
376
|
+
## Quick Commands
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Run all E2E tests
|
|
380
|
+
npx playwright test
|
|
381
|
+
|
|
382
|
+
# Run specific test file
|
|
383
|
+
npx playwright test tests/e2e/markets/search.spec.ts
|
|
384
|
+
|
|
385
|
+
# Run in headed mode (see browser)
|
|
386
|
+
npx playwright test --headed
|
|
387
|
+
|
|
388
|
+
# Debug test
|
|
389
|
+
npx playwright test --debug
|
|
390
|
+
|
|
391
|
+
# Generate test code
|
|
392
|
+
npx playwright codegen http:/$localhost:3000
|
|
393
|
+
|
|
394
|
+
# View report
|
|
395
|
+
npx playwright show-report
|
|
396
|
+
```
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ecomode
|
|
3
|
+
description: Token-efficient parallel execution mode using Haiku and Sonnet agents
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ecomode Skill
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Native Subagent Protocol (Codex)
|
|
10
|
+
|
|
11
|
+
Codex supports native subagents. Delegate with `spawn_agent`, coordinate with `send_input`, collect via `wait`, and clean up with `close_agent`.
|
|
12
|
+
|
|
13
|
+
Execution preference:
|
|
14
|
+
1. Use native subagents first for independent workstreams (parallel when possible).
|
|
15
|
+
2. Merge results in main thread and run final verification.
|
|
16
|
+
3. Fallback only when delegation is blocked: use the `[ANALYST]`/`[ARCHITECT]`/`[EXECUTOR]`/`[REVIEWER]` structure in a single response.
|
|
17
|
+
|
|
18
|
+
Minimal orchestration pattern:
|
|
19
|
+
```text
|
|
20
|
+
spawn_agent -> send_input (optional) -> wait -> close_agent
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> Codex invocation: use `$ecomode ...` or `ecomode: ...`
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Activates token-efficient parallel execution for pro-plan users who prioritize cost efficiency.
|
|
27
|
+
|
|
28
|
+
## When Activated
|
|
29
|
+
|
|
30
|
+
This skill enhances Codex's capabilities by:
|
|
31
|
+
|
|
32
|
+
1. **Parallel Execution**: Running multiple agents simultaneously for independent tasks
|
|
33
|
+
2. **Token-Conscious Routing**: Preferring Haiku and Sonnet agents, avoiding Opus
|
|
34
|
+
3. **Background Operations**: Using `run_in_background: true` for long operations
|
|
35
|
+
4. **Persistence Enforcement**: Never stopping until all tasks are verified complete
|
|
36
|
+
5. **Cost Optimization**: Minimizing token usage while maintaining quality
|
|
37
|
+
|
|
38
|
+
## Ecomode Routing Rules (CRITICAL)
|
|
39
|
+
|
|
40
|
+
**ALWAYS prefer lower tiers. Only escalate when task genuinely requires it.**
|
|
41
|
+
|
|
42
|
+
| Decision | Rule |
|
|
43
|
+
|----------|------|
|
|
44
|
+
| DEFAULT | Use LOW tier (Haiku) for all tasks |
|
|
45
|
+
| UPGRADE | Use MEDIUM (Sonnet) only when task complexity warrants |
|
|
46
|
+
| AVOID | HIGH tier (Opus) - only use for planning/critique if explicitly essential |
|
|
47
|
+
|
|
48
|
+
## Smart Model Routing (PREFER LOW TIER)
|
|
49
|
+
|
|
50
|
+
**Choose tier based on task complexity: LOW (haiku) preferred → MEDIUM (sonnet) fallback → HIGH (opus) AVOID**
|
|
51
|
+
|
|
52
|
+
### Agent Routing Table
|
|
53
|
+
|
|
54
|
+
| Domain | PREFERRED (Haiku) | FALLBACK (Sonnet) | AVOID (Opus) |
|
|
55
|
+
|--------|-------------------|-------------------|--------------|
|
|
56
|
+
| **Analysis** | `architect-low` | `architect-medium` | ~~`architect`~~ |
|
|
57
|
+
| **Execution** | `executor-low` | `executor` | ~~`executor-high`~~ |
|
|
58
|
+
| **Search** | `explore` | `explore-medium` | ~~`explore-high`~~ |
|
|
59
|
+
| **Research** | `researcher-low` | `researcher` | - |
|
|
60
|
+
| **Frontend** | `designer-low` | `designer` | ~~`designer-high`~~ |
|
|
61
|
+
| **Docs** | `writer` | - | - |
|
|
62
|
+
| **Visual** | - | `vision` | - |
|
|
63
|
+
| **Planning** | - | - | `planner` (if essential) |
|
|
64
|
+
| **Critique** | - | - | `critic` (if essential) |
|
|
65
|
+
| **Testing** | - | `qa-tester` | ~~`qa-tester-high`~~ |
|
|
66
|
+
| **Security** | `security-reviewer-low` | - | ~~`security-reviewer`~~ |
|
|
67
|
+
| **Build** | `build-fixer-low` | `build-fixer` | - |
|
|
68
|
+
| **TDD** | `tdd-guide-low` | `tdd-guide` | - |
|
|
69
|
+
| **Code Review** | `code-reviewer-low` | - | ~~`code-reviewer`~~ |
|
|
70
|
+
| **Data Science** | `scientist-low` | `scientist` | ~~`scientist-high`~~ |
|
|
71
|
+
|
|
72
|
+
### Tier Selection Guide (Token-Conscious)
|
|
73
|
+
|
|
74
|
+
| Task Complexity | Tier | Examples |
|
|
75
|
+
|-----------------|------|----------|
|
|
76
|
+
| Simple lookups | LOW | "What does this function return?", "Find where X is defined" |
|
|
77
|
+
| Standard work | LOW first, MEDIUM if fails | "Add error handling", "Implement this feature" |
|
|
78
|
+
| Complex analysis | MEDIUM | "Debug this issue", "Refactor this module" |
|
|
79
|
+
| Planning only | HIGH (if essential) | "Design architecture for new system" |
|
|
80
|
+
|
|
81
|
+
### Routing Examples
|
|
82
|
+
|
|
83
|
+
**CRITICAL: Always pass `model` parameter explicitly - Codex does NOT auto-apply models from agent definitions!**
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
// Simple question -> LOW tier (DEFAULT)
|
|
87
|
+
[ARCHITECT-LOW | haiku] "What does this function return?"
|
|
88
|
+
|
|
89
|
+
// Standard implementation -> TRY LOW first
|
|
90
|
+
[EXECUTOR-LOW | haiku] "Add validation to login form"
|
|
91
|
+
|
|
92
|
+
// If LOW fails, escalate to MEDIUM
|
|
93
|
+
[EXECUTOR | sonnet] "Add error handling to login"
|
|
94
|
+
|
|
95
|
+
// File lookup -> ALWAYS LOW
|
|
96
|
+
[EXPLORE-LOW | haiku] "Find where UserService is defined"
|
|
97
|
+
|
|
98
|
+
// Only use MEDIUM for complex patterns
|
|
99
|
+
[EXPLORE | sonnet] "Find all authentication patterns in the codebase"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## DELEGATION ENFORCEMENT (CRITICAL)
|
|
103
|
+
|
|
104
|
+
**YOU ARE AN ORCHESTRATOR, NOT AN IMPLEMENTER.**
|
|
105
|
+
|
|
106
|
+
| Action | YOU Do | DELEGATE |
|
|
107
|
+
|--------|--------|----------|
|
|
108
|
+
| Read files for context | ✓ | |
|
|
109
|
+
| Track progress (TODO) | ✓ | |
|
|
110
|
+
| Spawn parallel agents | ✓ | |
|
|
111
|
+
| **ANY code change** | ✗ NEVER | executor-low/executor |
|
|
112
|
+
| **UI work** | ✗ NEVER | designer-low/designer |
|
|
113
|
+
| **Docs** | ✗ NEVER | writer |
|
|
114
|
+
|
|
115
|
+
**Path Exception**: Only write to `.omc/`, `.codex/`, `CLAUDE.md`, `AGENTS.md`
|
|
116
|
+
|
|
117
|
+
## Background Execution Rules
|
|
118
|
+
|
|
119
|
+
**Run in Background** (set `run_in_background: true`):
|
|
120
|
+
- Package installation: npm install, pip install, cargo build
|
|
121
|
+
- Build processes: npm run build, make, tsc
|
|
122
|
+
- Test suites: npm test, pytest, cargo test
|
|
123
|
+
- Docker operations: docker build, docker pull
|
|
124
|
+
|
|
125
|
+
**Run Blocking** (foreground):
|
|
126
|
+
- Quick status checks: git status, ls, pwd
|
|
127
|
+
- File reads (NOT edits - delegate edits to executor-low)
|
|
128
|
+
- Simple commands
|
|
129
|
+
|
|
130
|
+
## Verification Checklist
|
|
131
|
+
|
|
132
|
+
Before stopping, verify:
|
|
133
|
+
- [ ] TODO LIST: Zero pending/in_progress tasks
|
|
134
|
+
- [ ] FUNCTIONALITY: All requested features work
|
|
135
|
+
- [ ] TESTS: All tests pass (if applicable)
|
|
136
|
+
- [ ] ERRORS: Zero unaddressed errors
|
|
137
|
+
|
|
138
|
+
**If ANY checkbox is unchecked, CONTINUE WORKING.**
|
|
139
|
+
|
|
140
|
+
## Token Savings Tips
|
|
141
|
+
|
|
142
|
+
1. **Batch similar tasks** to one agent instead of spawning many
|
|
143
|
+
2. **Use explore (haiku)** for file discovery, not architect
|
|
144
|
+
3. **Prefer executor-low** for simple changes - only upgrade if it fails
|
|
145
|
+
4. **Avoid opus agents** unless the task genuinely requires deep reasoning
|
|
146
|
+
5. **Use writer (haiku)** for all documentation tasks
|
|
147
|
+
|
|
148
|
+
## STATE CLEANUP ON COMPLETION
|
|
149
|
+
|
|
150
|
+
**IMPORTANT: Delete state files on completion - do NOT just set `active: false`**
|
|
151
|
+
|
|
152
|
+
When ecomode completes (all verification passes):
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Delete ecomode state files
|
|
156
|
+
rm -f .omc/state/ecomode-state.json
|
|
157
|
+
rm -f ~/.codex/ecomode-state.json
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This ensures clean state for future sessions. Stale state files with `active: false` should not be left behind.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: electron-driver
|
|
3
|
+
description: E2E Testing & Automation for Electron Apps (Playwright)
|
|
4
|
+
model: sonnet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Electron Driver Skill
|
|
8
|
+
|
|
9
|
+
**The standard tool for End-to-End (E2E) Verification of Electron Applications.**
|
|
10
|
+
|
|
11
|
+
Use this skill when you need to:
|
|
12
|
+
- **Verify UI functionality** (clicking buttons, checking text, form submission).
|
|
13
|
+
- **Run automated regression tests** on a packaged or local Electron app.
|
|
14
|
+
- **Drive the application** to reproduce bugs or set up state.
|
|
15
|
+
- **Inspect** the DOM and console of a running Electron process.
|
|
16
|
+
|
|
17
|
+
Supports two robust modes: **Launch** (Clean E2E Test) and **Attach** (Live Debugging).
|
|
18
|
+
|
|
19
|
+
- **Launch**: Start a new Electron instance with a controlled environment.
|
|
20
|
+
- **Attach**: Connect to an existing process via CDP (requires `--remote-debugging-port`).
|
|
21
|
+
- **Inspect**: Smartly find the main window (ignoring DevTools).
|
|
22
|
+
- **Interact**: Click, type, and verify using modern Playwright Locators.
|
|
23
|
+
|
|
24
|
+
## Integration with `e2e` and `tdd`
|
|
25
|
+
|
|
26
|
+
`electron-driver` is the Electron-specific execution backend in the testing stack:
|
|
27
|
+
|
|
28
|
+
1. `$tdd` validates core logic and IPC units first.
|
|
29
|
+
2. `$e2e` defines end-user journey scenarios.
|
|
30
|
+
3. `$electron-driver` executes those scenarios against real Electron runtime windows/processes.
|
|
31
|
+
|
|
32
|
+
Use this skill when `$e2e` detects Electron context or when desktop-runtime debugging is required.
|
|
33
|
+
|
|
34
|
+
## Prerequisites
|
|
35
|
+
|
|
36
|
+
1. **Playwright**: `npm install playwright-core` (locally preferred) or `npm install -g playwright-core`.
|
|
37
|
+
2. **Electron Executable**:
|
|
38
|
+
- For **Launch**: Path to the Electron executable (e.g., `node_modules/.bin/electron` or the packaged app).
|
|
39
|
+
- For **Attach**: The target app MUST be running with `--remote-debugging-port=<port>`.
|
|
40
|
+
|
|
41
|
+
## Strategy Selection
|
|
42
|
+
|
|
43
|
+
| Mode | Use Case | Pros | Cons |
|
|
44
|
+
|------|----------|------|------|
|
|
45
|
+
| **Launch** | Automated tests, reproducible tasks | Clean env, no port conflicts, auto-close | Slower start, loses current app state |
|
|
46
|
+
| **Attach** | Debugging current session, "Drive my app" | Preserves state, instant feedback | Complex setup (ports), fragile |
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### 1. Launch Mode (Recommended)
|
|
51
|
+
|
|
52
|
+
Create a script that launches the app.
|
|
53
|
+
|
|
54
|
+
**File:** `test-driver.cjs` (Use `.cjs` to avoid ESM/CJS issues)
|
|
55
|
+
```javascript
|
|
56
|
+
const { _electron: electron } = require('playwright-core');
|
|
57
|
+
|
|
58
|
+
(async () => {
|
|
59
|
+
// Launch the app
|
|
60
|
+
// args: pointing to main.js or the packaged app executable
|
|
61
|
+
const app = await electron.launch({
|
|
62
|
+
args: ['.'], // Or path to executable
|
|
63
|
+
env: { ...process.env, NODE_ENV: 'development' }
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
// Smart Window Find (ignoring DevTools)
|
|
68
|
+
const page = await app.firstWindow();
|
|
69
|
+
if (page.url().startsWith('devtools://')) {
|
|
70
|
+
// Loop to find real window if first one is devtools
|
|
71
|
+
// (Logic typically handled by waiting for first non-devtools window)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log(`Title: ${await page.title()}`);
|
|
75
|
+
|
|
76
|
+
// --- ACTION LOGIC ---
|
|
77
|
+
// Modern Locator API
|
|
78
|
+
await page.getByRole('button', { name: 'Login' }).click();
|
|
79
|
+
await expect(page.getByText('Welcome')).toBeVisible(); // requires @playwright/test runner or stand-alone expect
|
|
80
|
+
|
|
81
|
+
// Simple wait (if not using expect)
|
|
82
|
+
await page.locator('.status').waitFor();
|
|
83
|
+
// --------------------
|
|
84
|
+
|
|
85
|
+
} catch (err) {
|
|
86
|
+
console.error(err);
|
|
87
|
+
} finally {
|
|
88
|
+
// Close app
|
|
89
|
+
await app.close();
|
|
90
|
+
}
|
|
91
|
+
})();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Attach Mode (Debugging)
|
|
95
|
+
|
|
96
|
+
**Pre-check**: Ensure app is running with `--remote-debugging-port=9222` (or check console for actual port).
|
|
97
|
+
|
|
98
|
+
**File:** `attach-driver.cjs`
|
|
99
|
+
```javascript
|
|
100
|
+
const { chromium } = require('playwright-core');
|
|
101
|
+
|
|
102
|
+
(async () => {
|
|
103
|
+
try {
|
|
104
|
+
// Connect to CDP
|
|
105
|
+
const browser = await chromium.connectOverCDP('http://localhost:9222');
|
|
106
|
+
|
|
107
|
+
// Find the right page (Filter out DevTools)
|
|
108
|
+
const context = browser.contexts()[0];
|
|
109
|
+
const pages = context.pages();
|
|
110
|
+
const page = pages.find(p => !p.url().startsWith('devtools://'));
|
|
111
|
+
|
|
112
|
+
if (!page) throw new Error('No valid app window found');
|
|
113
|
+
|
|
114
|
+
// --- ACTION LOGIC ---
|
|
115
|
+
await page.locator('#submit-btn').click();
|
|
116
|
+
// --------------------
|
|
117
|
+
|
|
118
|
+
await browser.close(); // Disconnects (does not kill app)
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.error(e);
|
|
121
|
+
}
|
|
122
|
+
})();
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Playwright Modern Cheatsheet
|
|
126
|
+
|
|
127
|
+
- **Locators (Preferred)**:
|
|
128
|
+
- `page.getByRole('button', { name: 'Save' })`
|
|
129
|
+
- `page.getByText('Hello World')`
|
|
130
|
+
- `page.getByPlaceholder('Email')`
|
|
131
|
+
- `page.locator('.css-class')`
|
|
132
|
+
- **Actions**:
|
|
133
|
+
- `await locator.click()`
|
|
134
|
+
- `await locator.fill('text')`
|
|
135
|
+
- **Waiting**:
|
|
136
|
+
- ❌ `await page.waitForSelector(...)` (Old)
|
|
137
|
+
- ✅ `await locator.waitFor()` (Explicit)
|
|
138
|
+
- ✅ `await locator.click()` (Auto-waits)
|
|
139
|
+
|
|
140
|
+
## Troubleshooting
|
|
141
|
+
|
|
142
|
+
- **ESM Error**: `SyntaxError: Cannot use import statement...` -> Save file as `.mjs` or change project type. **Recommendation**: Always save temp scripts as `.cjs` and use `require`.
|
|
143
|
+
- **DevTools Window**: If the script interacts with the inspector instead of the app, check the window filtering logic.
|
|
144
|
+
- **Port Conflict**: If 9222 is busy, try a different port in Launch args or Attach URL.
|