What a Playwright click actually waits for

Finishing a click does not guarantee the save has finished.

The editor eventually shows “Saved”, but the test reports “Ready”. Find when the starter reads the status relative to the click on Save note.

Run tests runs your test against the working practice app.

Try it yourself

Run the starter on the working editor. Keep the save click. Change the check so it waits for the page status to show “Saved”.

Starter code

import { test, expect } from "@playwright/test";

test("the editor reports a completed save", async ({ page }) => {
  await page.goto("/");
  const status = page.getByRole("status");
  const beforeSave = await status.textContent();
  await page.getByRole("button", { name: "Save note" }).click();
  expect(beforeSave).toBe("Saved");
});

Open this page on a desktop or laptop. You can edit and run the code there.

The lecture for this exercise