Skip to content

Green recording, a dialog that never appeared

Adityo Guni Waluyo

A passing QA test does not guarantee the filled dialog appears in the feature-tour recording. Measured pauses and element screenshots make the moment real.

TL;DR

A test passed, yet the recording never showed the dialogs being filled. Assertions verify final state and can succeed in a window shorter than one frame, while the recorder blindly captures whatever's on screen. The fix: deliberate pauses and named screenshots before each action, plus keeping the test tab in the foreground.

The test passed. All assertions green, no flake, no retry. I opened the recording of the feature tour to check it before it went into the documentation, and watched it from start to finish. The filled create dialog never appeared. Neither did the edit dialog. Just the list view, a brief flicker, then the updated row, as if the data had edited itself.

My first assumption: the recording must contain everything the test exercised, because the test proved the flow worked. That assumption was wrong, and the gap sits exactly between two tools with different jobs.

Assertions guard the final state

Playwright's web-first assertions auto-retry: the element is re-fetched and re-checked until the condition holds or the timeout is reached, with a 5 second default [3]. For test stability this is the right design. Flakiness drops because the assertion tolerates timing noise.

But an assertion promises nothing about the recording. In this case the assertion actually succeeded: the dialog was visible, the condition held, and the very next statement clicked save. The window can be shorter than a single frame. The dialog opened, got filled, and closed inside an interval too brief to leave a mark. What remained was the end state: a success toast and a new row in the table.

Recording is a separate artifact

Video capture in Playwright is enabled through the video option in the test configuration, it is off by default, and the file is only saved when the browser context closes [2]. The recorder does not know which moments matter for evidence. It simply captures whatever the screen shows, for however long that happens to be.

Screenshots give control the recorder cannot: page.screenshot({ path }) writes to a file, can target a single element, and supports fullPage for entire pages [1]. One element screenshot locks one moment as a named file, independent of frame luck.

The moment has to be made explicit

The fix applied to the CRUD capture: a deliberate 2000 ms pause after the dialog is filled, a named element screenshot, and only then the save click.

// after the dialog is filled, before save
await pause(page, 2000);
shots.push(await shot(page, "grup-fitur", "dialog-tambah"));
await saveButton.click();
await expect(page.getByText("Perubahan tersimpan").first()).toBeVisible();
await pause(page, 1500); // toast and row state get captured

Two seconds is not arbitrary. Long enough that the moment survives frame timing, short enough that the mp4 does not balloon; the capture touches 24 feature groups, and every second of pause multiplies across all tours. The same pattern runs for the edit dialog with the dialog-edit artifact. The 1500 ms pause after save gives the toast time to appear and the row state to change before the next action.

Two forms of evidence come out of one step. The frame inside the recording shows the sequence of events; the named screenshot becomes an artifact the manifest audit can require. In this project's documentation contract, every screenshot needs a step caption, and that caption only means something if the image actually shows the moment: the dialog filled, not the dialog already closed.

The order of content matters too. The public-facing section sits deliberately at the end of the recording, with longer pauses on the public screen, so a viewer who only watches the last part of the file still arrives at the page real users will read.

The recording tab must stay visible

One constraint is easy to miss: browsers stop sending requestAnimationFrame callbacks and throttle setTimeout in background tabs [6]. A capture run with its tab in the background risks unstable pauses and rendering, including the deliberate pauses above. The practice is simple: keep the tab that runs the test in the foreground until the capture finishes.

The lesson from one green but silent recording: a passing test proves the application's logic, not the existence of visual evidence. If a recording is meant as proof, the moments have to be planned: deliberate pauses, screenshots before the action, and a recorder that actually watches.

Sources

  1. Playwright Documentation, Screenshots
  2. Playwright Documentation, Videos
  3. Playwright Documentation, Assertions
  4. MDN Web Docs, Page Visibility API

Related articles