Playwright's 5 Actionability Checks
Before performing an action like
click(), Playwright verifies:
1.
Attached: Present in the DOM.
2.
Visible: Has non-empty bounding box, not hidden.
3.
Stable: CSS animations and transitions have finished.
4.
Receives Events: Not obscured by modal overlays or spinners.
5.
Enabled:
disabled attribute is false.
// ✅ Best Practice: Wait for the exact network response
const responsePromise = page.waitForResponse("**/api/checkout");
await page.getByRole("button", { name: "Place Order" }).click();
const response = await responsePromise;
expect(response.status()).toBe(200);