Complete worked example
typescript
import { test, expect } from "../support/test.js";
test("records useful fixture evidence", async ({page}, testInfo) => {
await page.goto("/");
const rows = page.getByRole("list", {name:"Matching roles"}).getByRole("listitem");
await expect(rows).toHaveCount(4);
const ids = await rows.evaluateAll(items => items.map(item => item.getAttribute("data-id")));
await testInfo.attach("fixture-ids", {body:JSON.stringify({ids}),contentType:"application/json"});
expect(ids).toEqual(["r1","r2","r3","r4"]);
});- Reasoning
- The attachment records a small synthetic observation without swallowing the assertion.