Skip to content
Back to skills

Ui Testing

ASecurity

Drive a web UI to prove it works: Playwright flows against a dev server on $PORT (start, wait, tear down, Windows too), console/network/a11y assertions, and worst-case data (long strings, RTL, emoji, huge lists, slow network, 200% zoom). Load before testing interactive UI.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
ai-agentsgonodetestingapi

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add k6w/baton --skill ui-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ui Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ui Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/k6w-ui-testing/badge)](https://www.skillsdirectory.com/skills/k6w-ui-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ui-testing
description: "Drive a web UI to prove it works: Playwright flows against a dev server on $PORT (start, wait, tear down, Windows too), console/network/a11y assertions, and worst-case data (long strings, RTL, emoji, huge lists, slow network, 200% zoom). Load before testing interactive UI."
keywords: [e2e, end-to-end, playwright, browser test, ui test, user flow, console errors, accessibility, a11y, edge cases, long strings, rtl, slow network, break the ui]
---
# UI testing

A UI change is done when a script has clicked through it and nothing complained. This skill is
how to write that script and what to assert. It does not judge looks: screenshots at four widths
and the visual review are `visual-qa`; what to put in your report is `ui-evidence`; how motion
should behave is `motion`.

References (load with `load_skill("ui-testing", "references/<file>")`):
`harness.md` (cross-platform server runner and a full flow script), `break-ui.md` (worst-case
data catalogue and failure signatures), `assertions.md` (console, network, a11y and layout checks
in code).

## 0. Look and click with Baton's screen tools

For seeing and poking at a UI, use the screen tools on Baton's bus: they run off-screen, sandboxed
to localhost and your worktree, and save every output under `.baton/screens/`.

- Web: `browser_open(url, viewport?)` → `browser_click(selector | text)`, `browser_type(text, selector?)`,
  `browser_press("Enter" | "Tab" | "Control+a")`, `browser_eval(js)`, `browser_screenshot(path?, fullPage?, selector?)`,
  `browser_close()`.
- Terminal programs and TUIs: `term_run(command, cols?, rows?)` → `term_send("q{Enter}" | "{Ctrl+C}" | "{Down}")`,
  `term_screen(wait_for?)` (the text frame), `term_screenshot(path?)` (a PNG), `term_close()`.

Repeatable test suites (Playwright scripts, below) are fine too: they also run headless.

**Never drive real windows.** No SendKeys, keybd_event / SendInput, xdotool key/type, AppleScript
`keystroke`, nircmd, AutoHotkey, pyautogui or clipboard-paste automation into a real window, and
never focus or type into a terminal or browser the user can see: those keystrokes land in the user's
own windows (their editor, their Baton session). Baton asks the user before running such a command,
at every autonomy level.

## 1. Run the app the safe way

- **Always `$PORT`** (or `$BATON_PORT_0/1`); other agents run servers on this machine. Never a fixed
  port, never kill a process you didn't start.
- Start → wait until the URL answers (poll with a timeout, ~60s) → run → **always** tear down, in a
  `finally`, including the browser. On Windows a dev server is a process tree (`npm`/`bun` → `node`
  → workers): kill the tree (`taskkill /pid <pid> /T /F`), not just the parent, or the port stays taken.
- Prefer the project's own e2e setup if it has one (`playwright.config.*` with `webServer`, an
  `e2e` script). Use the harness in `references/harness.md` only when there is none.
- Static pages need no server: `file:///absolute/path/index.html`.
- Memory is shared: one browser, one context per scenario, close each when done.

## 2. Write the flow like a user

1. **Recon first.** Load the page, wait for it to settle (`networkidle` or a known element), then
   list what's there (roles, labels, buttons) before writing selectors. Don't guess selectors from the source.
2. **Select by what the user sees:** `getByRole("button", { name: "Save" })`, `getByLabel`,
   `getByText`. Fall back to `data-testid`, never to CSS chains or nth-child.
3. **Wait for conditions, not time.** Playwright locator assertions auto-wait (`await
   expect(locator).toBeVisible()`); `waitForTimeout` only to observe an animation, never to "let it load".
4. One flow per user goal: *sign up*, *add item to cart and check out*, *filter, then clear filters*.
   Each covers the happy path and at least one failure path (invalid input, server error).
5. Use the keyboard for at least one flow end to end: Tab order reaches every control, Enter/Space
   activate, Escape closes overlays, focus returns to the trigger.

## 3. Assert more than "it rendered"

Every flow, every page, collects and fails on:

- **Console errors and uncaught exceptions** (`page.on("console")` type `error`, `page.on("pageerror")`).
  Allowlist known noise explicitly, with a reason; never ignore all.
- **Failed requests:** `requestfailed`, and responses with status ≥ 400 from your own origin
  (a 404 for a font or a 500 from the API both count).
- **The end state the user cares about:** the toast text, the new row in the table, the URL, the
  value persisted after reload. Not just "no error".
- **Basic accessibility:** run axe (`@axe-core/playwright`) if available and fail on serious/critical;
  without it, check images have `alt`, inputs have accessible names, buttons have names, one `h1`,
  `lang` on `<html>`, and focus is visible on Tab.
- **Layout sanity:** no horizontal overflow at 390 wide, no element wider than the viewport, no text
  overflowing its box (code in `references/assertions.md`).

## 4. Break it on purpose

Demo data is chosen to look good. Re-run the key screens with realistic worst cases, one category
at a time, and record what breaks. Every value must be something a real user could produce;
nonsense strings prove nothing.

| Category | Try |
|---|---|
| Text length | very long names, unbroken emails/URLs/IDs, one-letter names, empty and whitespace-only values |
| Scripts | RTL (Arabic/Hebrew) with `dir="auto"`, CJK without spaces, stacked diacritics (Vietnamese, Thai), German compounds, translated labels 30–40% longer |
| Emoji | emoji-first names, ZWJ sequences, skin tones (string slicing and initials break) |
| Numbers | 0, 1 (plurals), 1,000,000, negatives, long decimals, `null`/`NaN`, other locales' separators |
| Collections | empty, one item, exactly a page and page + 1, 1,000+ items, one item ten times larger |
| Missing data | optional fields absent, broken image URLs, no avatar |
| Markup in data | `<b>`, `&amp;`, `**bold**`, a newline in a one-line field: all render as literal text |
| Network | slow 3G-like latency, a request that fails (500), one that times out, offline, a double submit |
| Environment | 320px wide container, browser zoom 200% / large text, dark mode, RTL page direction, touch only (no hover), reduced motion |

Wire it so it's repeatable: a `?fixture=worst` switch, a route that renders the component with each
dataset, or request interception (`page.route`) that serves the worst-case JSON. The full catalogue
with values and the fix for each failure signature is in `references/break-ui.md`.

## 5. When something fails

- Reproduce it in the script first, so the fix is proven by the same script going green.
- Save a screenshot and the collected console/network log for every failing step
  (`.baton/shots/<label>/`), and quote the first error line in your report.
- Distinguish **app bug** (fix or report), **test bug** (wrong selector, race; fix the test, don't
  add sleeps), and **environment** (server didn't start, browser missing; report it as not verified).
- Flaky means a race exists. Find the condition to wait for; retries are not a fix.

## 6. Report

Per flow: name, steps, result (pass/fail), and the evidence: assertion counts, console errors (0 or
the lines), failed requests (0 or the URLs), a11y violations by impact. Then the break-the-UI table:

```
| # | Severity | Case            | What happened                               | Fix                                  |
|---|----------|-----------------|---------------------------------------------|--------------------------------------|
| 1 | blocking | 1,000 rows      | list freezes 4s on open                     | virtualize the list                  |
| 2 | major    | long email      | row action menu pushed off-screen at 390    | min-width: 0 on text column          |
| 3 | minor    | count = 1       | "1 members"                                 | Intl.PluralRules                     |
```

End with **what held up** (cases that passed) and **not verified** (browsers, devices, states you
didn't run). The commands you ran and their output go in the report as `ui-evidence` describes.

Files in this skill

  • SKILL.md6.8 KB
  • references/assertions.md5.2 KB
  • references/break-ui.md8.9 KB
  • references/harness.md8.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.