Complete worked example
typescript
import { test, expect } from "../support/test.js";
test("empty query result is observable", async ({page}) => {
await page.goto("/");
await page.getByLabel("Search roles").fill("no-such-role");
await expect(page.getByText("No matching roles", {exact:true})).toBeVisible();
await expect(page.getByRole("list", {name:"Matching roles"}).getByRole("listitem")).toHaveCount(0);
});- Reasoning
- The test waits for the meaningful empty outcome, not a guessed duration.