Assertion
Also called: Expect, Check
The line in an automated test that checks the expected result and fails the test if it's wrong.
Definition
Assertions are the automated version of a test case's expected result, for example "expect the text Booking confirmed to be visible". A test without assertions only performs steps, so it can never fail, even when the app is broken.
In practice
await expect(page.getByText('Booking confirmed')).toBeVisible(); fails the test if the confirmation never appears.
Learn it in context
Lessons that use this term.