E2E test conventions — semantic selectors, arrange-steps that prove the process started, runtime markers that cannot match the shell echo, typing a launch line rather than a program, waiting for watcher-fed views to catch up with a disk edit, and absolute-path tool invocations. Use when writing or changing a .feature scenario under packages/tests.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of E2e Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/juspay-e2e-testing)
---
name: e2e-testing
description: >-
E2E test conventions — semantic selectors, arrange-steps that prove the process started, runtime markers that cannot match the shell echo, typing a launch line rather than a program, waiting for watcher-fed views to catch up with a disk edit, and absolute-path tool invocations. Use when writing or changing a .feature scenario under packages/tests.
---
## E2E Tests
- **Use semantic selectors**: Never match on CSS classes (`class*="bg-..."`) in test selectors — classes are styling concerns and break when visual design changes. Use `data-testid`, `data-active`, or other semantic `data-*` attributes instead.
- **A step that starts a process must prove the process started.** Typing a command into a PTY and waiting a frame is not an arrangement — it is an unconditional pass. Wait for a marker the *process itself* prints once it is up (e.g. from a `listen` callback), and on timeout quote the terminal's own last lines. Otherwise every environmental way the start can fail — `EADDRINUSE` from a leftover process, a missing tool, a shell still initializing — surfaces much later as a missing UI value and reads as a broken product. In [#1982](https://github.com/juspay/kolu/pull/1982) that cost a CI cycle: the listener never started and the failure said "the Ports section showed `[]`", pointing at the port sensor.
- **A marker you wait for must not appear literally in the command you type.** The shell **echoes** the command line, so a `waitForBufferContains("kolu-e2e-listening")` matches the echo *before* the process runs — the same #1982 guard passed against `/nonexistent/node`. Build the marker at runtime (`"kolu-e2e" + "-listening"`) so only the process's own output can satisfy it, and prove it: point the step at a broken binary and confirm it now fails **at the start step**, quoting the shell's own error. Any new wait/guard gets that negative test before you trust it.
- **Type the launch line, never the program.** Every key typed into a terminal is a full round trip — browser, server, padi, kaval, the shell's echo, a repaint. A stand-in whose program is typed inline (`<bin> -c '<program>'`) pays that per character. Typing the fake Oh My Pi's 1,911-character line failed its start step in two ways: on CI the step's 70 s limit ran out, and with the test world pinned to one core (3 failures in 8 runs) the shell was still echoing the program when the 20 s wait for the agent's "up" line ended. The whole scenario took 46–64 s of steps. Write the program to a file in the scenario's own temp directory and type only `<bin> <file>`: the same scenario then takes about 11 s. That also keeps the program's markers out of the echo.
- **After editing the disk, prove a watcher-fed view has caught up before acting on it.** The Code tab's tree and similar views learn of a disk change one watcher pulse later (~150 ms, then a re-fetch), so for a moment they still show the old state. An arrange check that is true of both the old and the new state proves nothing — wait for something only the new state shows. The gitignored-folder scenario in `code-tab.feature` checked only `kept.md` (listed before and after the ignore edit), then clicked through a `.waterfall` folder still listed as an ordinary one; when the tree caught up, the file left the list and kolu closed it — 6 failures in 6 runs. It now waits until the tree stops listing `.waterfall`.
- **Never depend on a tool being on the PTY's PATH.** Run it by absolute path — `process.execPath` for node. A bare `node` resolves on every dev box and can fail *only* on a host where node lives solely in the dev shell, so the difference presents as a phantom product bug on one machine. Whether the shell resolves `node` is a different question from the one the scenario is asking.