home / skills / openclaw / skills / ui-test

ui-test skill

/skills/clawd21/ui-test

This skill lets you describe UI tests in plain English and exports Playwright scripts for CI/CD.

npx playbooks add skill openclaw/skills --skill ui-test

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
5.2 KB
---
name: ui-test
description: Plain English E2E UI testing. Describe tests in natural language, agent executes via browser tool, then exports real Playwright test scripts for CI/CD. Use when asked to create UI tests, test a website, or generate Playwright scripts.
metadata: {"clawdbot":{"emoji":"๐Ÿงช"}}
---

# UI Test โ€” Plain English E2E Testing (๐Ÿงช)

Describe your UI tests in plain English. The agent figures out how to find buttons, navigate the app flow, and execute each step โ€” no selectors or code needed. It screenshots every major step, stitches them into a walkthrough video, and DMs you the result with a pass/fail report.

*Made in ๐Ÿค  Texas โค๏ธ [PlebLab](https://pleblab.dev)*

![UI Test โ€” Describe it. I'll test it.](https://files.catbox.moe/3yezuk.png)

## Workflow

1. **Create** โ€” User names a test and describes steps in plain English
2. **Run** โ€” Agent opens the clawd browser, executes each step, screenshots each action
3. **Export** โ€” Agent generates a Playwright `.spec.ts` from the verified steps
4. **CI/CD** โ€” User drops the script into their test suite, runs with `npx playwright test`

## Agent Execution Flow

When running a test:

1. Load test definition: `node scripts/ui-test.js get "<name>"`
2. Start clawd browser: `browser action=start profile=clawd`
3. Navigate to the test URL
4. For each plain English step:
   a. Interpret what the user means (click, type, assert, wait, etc.)
   b. Use `browser action=snapshot` to see the page
   c. Use `browser action=act` with the appropriate request (click/type/press/etc.)
   d. Take a screenshot after each step
   e. Record what selector/ref was used and whether it passed
5. Save run results: `node scripts/ui-test.js save-run "<name>" passed=true/false`
6. Report results to user with pass/fail per step

When exporting to Playwright:

1. Load the test definition and most recent successful run
2. Map each plain English step to Playwright API calls based on what worked during execution
3. Generate a `.spec.ts` file with proper imports, test structure, and assertions
4. Save to the user's project or a specified output path

## Step Interpretation Guide

The agent should interpret plain English steps like:

| User says | Browser action | Playwright equivalent |
|-----------|---------------|----------------------|
| "click the Sign In button" | `act: click ref="Sign In button"` | `page.getByRole('button', {name: 'Sign In'}).click()` |
| "type [email protected] in the email field" | `act: type ref="email" text="[email protected]"` | `page.getByLabel('Email').fill('[email protected]')` |
| "verify the dashboard shows Welcome" | `snapshot` + check text | `expect(page.getByText('Welcome')).toBeVisible()` |
| "wait for the page to load" | `act: wait` | `page.waitForLoadState('networkidle')` |
| "click the hamburger menu" | `act: click` (find menu icon) | `page.getByRole('button', {name: 'menu'}).click()` |
| "scroll down" | `act: evaluate fn="window.scrollBy(0,500)"` | `page.evaluate(() => window.scrollBy(0, 500))` |
| "check the Remember Me checkbox" | `act: click ref="Remember Me"` | `page.getByLabel('Remember Me').check()` |
| "select 'USD' from the currency dropdown" | `act: select values=["USD"]` | `page.getByLabel('Currency').selectOption('USD')` |
| "take a screenshot" | `browser action=screenshot` | `page.screenshot({path: 'step-N.png'})` |
| "verify URL contains /dashboard" | check current URL | `expect(page).toHaveURL(/dashboard/)` |

## Commands

Run via: `node ~/workspace/skills/ui-test/scripts/ui-test.js <command>`

| Command | Description |
|---------|-------------|
| `create <name> [url]` | Create a new test |
| `add-step <name> <step>` | Add a plain English step |
| `set-steps <name> <json>` | Replace all steps |
| `set-url <name> <url>` | Set the test URL |
| `get <name>` | Show test definition |
| `list` | List all tests |
| `remove <name>` | Delete a test |
| `save-run <name> ...` | Save execution results |
| `runs [name]` | Show run history |
| `export <name> [outfile]` | Export as Playwright script |

## Export Format

Generated Playwright files include:
- Proper TypeScript imports
- `test.describe` block with test name
- `test.beforeEach` with navigation to base URL
- Each step as a sequential action with comments showing the original English
- Assertions where the user said "verify", "check", "should", "expect"
- Screenshots on failure

## Screenshots & Video

During test execution, the agent should:

1. **Before each step**: take a screenshot โ†’ save as `step-NN-before.jpg`
2. **After each step**: take a screenshot โ†’ save as `step-NN-after.jpg`
3. **On failure**: take a screenshot โ†’ save as `step-NN-FAIL.jpg`

Screenshots are saved to: `~/.ui-tests/runs/<slug>-<timestamp>/`

After the run completes, generate a walkthrough video:
```bash
ffmpeg -framerate 1 -pattern_type glob -i '~/.ui-tests/runs/<folder>/step-*.jpg' \
  -vf "scale=1280:-2" -c:v libx264 -pix_fmt yuv420p -y output.mp4
```

Then send the video to the chat.

## Storage

- Test definitions: `~/.ui-tests/<slug>.json`
- Run history: `~/.ui-tests/runs/<slug>-<timestamp>/run.json`
- Screenshots: `~/.ui-tests/runs/<slug>-<timestamp>/step-*.jpg`
- Video: `~/.ui-tests/runs/<slug>-<timestamp>/walkthrough.mp4`
- Exported scripts: user-specified path or `./tests/<slug>.spec.ts`

Overview

This skill provides plain-English end-to-end UI testing. Describe test steps in natural language, the agent runs them in a headless browser, captures screenshots and a walkthrough video, and exports verified Playwright .spec.ts files ready for CI/CD integration.

How this skill works

You create a named test with plain-English steps and a target URL. The agent opens a browser, interprets each step (click, type, assert, wait, etc.), performs actions, snapshots before and after each step, and records whether each step passed. After a successful run the skill maps the executed actions to Playwright API calls and generates a ready-to-run TypeScript test file for your project.

When to use it

  • Create end-to-end UI tests without writing selectors or code
  • Quickly validate flows on a staging site or new feature before release
  • Generate Playwright scripts for inclusion in CI/CD pipelines
  • Capture reproducible run artifacts (screenshots, video) for debugging
  • Audit UI behavior across user journeys with human-readable test definitions

Best practices

  • Write clear, step-by-step plain English instructions (one action per line)
  • Include explicit verification steps using words like verify, check, should, or expect
  • Prefer stable labels or visible text in descriptions to improve selector resolution
  • Run tests against a deterministic environment (staging with seeded data)
  • Review exported Playwright scripts and add authentication or fixtures as needed

Example use cases

  • Onboard QA engineers: describe a login flow in English and export Playwright tests for CI
  • Regression checks: describe critical user journeys and receive pass/fail reports with screenshots
  • Pre-release smoke tests: run key pages, capture a walkthrough video, and attach results to a release ticket
  • Developer handoff: generate a reproducible Playwright spec after manual exploratory testing
  • Cross-team demos: run a recorded walkthrough to show stakeholders the exact UI interactions

FAQ

How are selectors chosen when I only describe steps?

The agent snapshots the page and uses visible roles, labels, and text to find the best match; it records the selector used so the exported Playwright step mirrors what worked during the run.

What artifacts do I get after a run?

You receive before/after screenshots for each step, a walkthrough video stitched from screenshots, a pass/fail report per step, and an optional exported Playwright .spec.ts file.