Testing / Playwright Interview questions
What is the difference between Playwright's expect and Jest's expect?
Playwright Test's expect is a superset built on the same familiar matcher syntax as Jest's, but extended specifically for asynchronous UI state.
| Playwright's expect | Jest's expect |
| Adds web-first matchers: toBeVisible, toHaveText, toHaveScreenshot | General-purpose value matchers: toBe, toEqual, toContain |
| Web-first matchers auto-retry until timeout | All matchers check once, immediately |
| Understands Locator objects directly | Has no concept of a Locator |
Ordinary value matchers like toBe() or toEqual() work identically in both, so knowledge of Jest transfers directly - the real difference is the added retrying, locator-aware matchers that Jest's expect was never designed to handle, since Jest has no browser automation concept at all.
More Related questions...