nddipiazza/robos / .agents/skills/create-test
create-test
VerifiedGenerate robust E2E and unit tests for RobOS Electron apps using the robos-test framework.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.7 KB |
SKILL.md
View on GitHub---
name: create-test
description: Generate robust E2E and unit tests for RobOS Electron apps using the robos-test framework.
---
# Create a RobOS App Test
Generate a test for a RobOS Electron app using the robos-test framework.
## Input
$ARGUMENTS — `<app-id> <description of what to test>`
## CRITICAL: Verify selectors before writing any test
**Never write a test with guessed selectors.** Before writing a single assertion:
1. Read `packages/<app-id>/renderer/app.html` (or `index.html`) to find actual element IDs and classes
2. Read `packages/<app-id>/renderer/app.js` to understand event listeners and dynamic elements
3. Only use IDs/classes that **literally exist** in those files
Use `grep` to confirm each selector you intend to use:
```bash
grep -n 'id="btn-run"\|class="skill-chip"' packages/<app-id>/renderer/app.html
grep -n "getElementById('btn-run')\|querySelector('.skill-chip')" packages/<app-id>/renderer/app.js
```
If a selector isn't found, do NOT use it — adapt to what's actually there.
## What to create
### Test file
Create `tests/<app-id>/<slug>.test.js` where `<slug>` is derived from the description (lowercase, hyphens).
For smoke tests, use `tests/<app-id>/smoke.test.js`.
For regression tests, use `tests/<app-id>/regression-<bug-id>.test.js`.
### Template
```javascript
const { test, launch } = require('robos-test');
test('<app-id>: <description>', async (t) => {
const app = await launch('<app-id>');
// 1. Verify initial state — assert on text that MUST be present on load
const initial = await app.textSnapshot();
t.assertContains(initial, 'some text that is always in the DOM on load');
// 2. Perform action — use ONLY selectors confirmed to exist in renderer HTML/JS
await app.click('#btn-confirmed-id'); // confirmed: grep found this in app.html
await app.type('#search-input', 'hello'); // confirmed: grep found this in app.html
// 3. Wait for result — for async ops (network, IPC) use waitForText
await t.waitForText('#status-element', 'expected text', { timeout: 5000 });
// 4. Assert final state
const result = await app.textSnapshot();
t.assertContains(result, 'text that appears after the action');
await app.close();
});
```
### How to fill in the template
1. **Read the renderer first** — grep actual IDs/classes from `packages/<app-id>/renderer/`
2. Each `app.click()`, `app.type()`, `app.eval()` must use a selector confirmed in step 1
3. Each `t.assertContains()` must assert on text that will actually be in the DOM
4. For operations that require AI/network, **do not call the real endpoint** — inject mock state via `app.eval()` instead
5. Keep tests fast: no `minHold`-style sleeps > 2000ms unless waiting for a real async IPC call
6. Use `app.screenshot()` at key steps to capture evidence when a test fails
### Mocking AI/network results in tests
When a feature normally requires an AI call or network request, mock it by injecting the expected DOM state directly:
```javascript
// Instead of clicking "Run" and waiting for real AI response:
await app.eval(`
document.getElementById('results-section').style.display = 'block';
document.getElementById('results-summary').textContent = 'Mock summary';
document.getElementById('steps-list').innerHTML = '<div class="step-item">Step 1 done</div>';
`);
const after = await app.textSnapshot();
t.assertContains(after, 'Mock summary');
```
## Validation checklist
- [ ] Every selector in the test was confirmed by grepping the renderer HTML/JS
- [ ] No test waits more than 2s for AI/network — mocked instead
- [ ] `t.assertContains` assertions match text that will actually be in the DOM
- [ ] Test has a clear pass/fail signal
- [ ] Test file created at correct path in `tests/<app-id>/`
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |