Skip to content
Skills Library
Programming · Testing

session-to-playwright

/session-to-playwright

Add the witness session recorder to a web app and compile a recorded user session into a Playwright spec that fails until the reported bug is fixed. Use when turning a bug report into a reproducible failing test.

Repository
three.ws ↗
Licence
Apache-2.0
Last repository change
13.11.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content30 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Add the witness session recorder to a web app and compile a recorded user session into a Playwright spec that fails until the reported bug is fixed. Use when turning a bug report into a reproducible failing test.

Original author description

Add the witness session recorder to a web app and compile a recorded user session into a Playwright spec that fails until the reported bug is fixed. Use when turning a bug report into a reproducible failing test.

How it works

  1. Install and record
  2. Compile
  3. Selectors
  4. Privacy
  5. Worked example
Original SKILL.md headings · 49 lines, 320 words
SKILL.md preview
---
name: session-to-playwright
description: Add the witness session recorder to a web app and compile a recorded user session into a Playwright spec that fails until the reported bug is fixed. Use when turning a bug report into a reproducible failing test.
---

# Session to Playwright

`@three-ws/witness` records user intent (navigation, clicks, typed-field metadata, failed requests, page errors) in about 2 KB per session, with no pixels and no DOM mutation stream, then compiles it into a Playwright spec. No dependencies, no build step.

## Install and record

```bash
npm install @three-ws/witness
```

```js
import { witness } from '@three-ws/witness';

witness.start();                              // idempotent, one recorder per page
witness.onFailure(() => showFeedbackPrompt()); // ask at the moment of failure
witness.hasFailure();                          // true after a failed request or page error
const trace = witness.trace();                 // { version, recordedMs, environment, events }
witness.stop();                                // restores every patched global
```

## Compile

```js
import { compileToPlaywright } from '@three-ws/witness/compile';

const { filename, source, confidence, steps } = compileToPlaywright(trace, {
  title: 'Export does nothing',   // test name
  baseUrl: 'http://localhost:3000',
  reportId: 'FB-123',             // linked in a header comment
});
```

Write `source` to `filename` under your Playwright tests directory. The test asserts the failure is gone, so it is red until the bug is fixed. `confidence.score` (0 to 100) says how well every step is anchored to a stable handle.

Other exports: `narrate(trace)` (the human step list), `failuresIn(trace)`, `entryRoute(trace)`, `replayConfidence(trace)`.

## Selectors

Each element gets the strongest handle verified unique in the live document: `data-testid` (100), id (95), aria-label (85), role plus name (80), text (70), name (65), placeholder (60), class (40), structural path (10). Add `data-testid` to the controls in a flow to raise confidence. Helpers are on `@three-ws/witness/selector`.

## Privacy

`@three-ws/witness/redact` exports `redactText`, `redactUrl`, `isSensitiveField` and `summarizeInput`. Typed values are summarised by length, not stored, and sensitive fields are never captured. Do not paste real user data into reports.

## Worked example

Given a trace where the visitor opened `/avatar-studio`, clicked Export and saw `POST /api/export -> 500`, the compiled spec visits the route, clicks `getByTestId("export")`, and expects the failed-request list to be empty. Run it with `npx playwright test`, fix the endpoint, run again until green.

Versions

The database has no other skills named session-to-playwright.

Database snapshot: 13.11.2026 · package version f71760363471 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100e2e-repro
    Turn a bug report into one Playwright E2E test that is red on the bug and green once it is fixed, before anyone touches the code. Use when asked to reproduce a bug, write a regression test for a bug report, or confirm a reported bug is real. Reproduces live in a browser with playwright-cli first.
  • 90api-session
    WAY 2 — API test session. Use when the user says "api it", "test api", "run api tests", "api test" — OpenAPI spec or endpoint list → playwright-bdd API tests → run → file bugs → API session report.
  • 100playwright-best-practices
    Use when writing or modifying Playwright tests (.spec.ts, .test.ts with @playwright/test imports).
  • 90write-playwright-test
    Use when asked to write, add or change Playwright tests in this repo. Gives the exact steps and conventions so every test is reviewed, uses page objects, and is proven to fail when the app is wrong.
  • 96repro-first
    Use when fixing a reported bug — reproduce it with a failing test before touching the code, then make the minimal fix at the true cause; never patch the symptom or files unrelated to the bug.
  • 100pw-init
    Set up Playwright in a project. Use when user says "set up playwright", "add e2e tests", "configure playwright", "testing setup", "init playwright", or "add test infrastructure".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.