new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

playwrightassertions

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

PlaywrightAssertions class overview

PlaywrightAssertions provides Web-First Assertions with convenience methods for creating assertions that wait and retry until the expected condition is met. By default, the timeout for assertions is set to 5 seconds.

PlaywrightAssertions.expectAPIResponse method

The expectAPIResponse method creates an APIResponseAssertions object for the given APIResponse. It takes a response parameter of type APIResponse and returns an APIResponseAssertions object. Since v1.18, aliases are: assertThat in Java, expect in Python, expect in JavaScript, and Expect in C#.

PlaywrightAssertions.expectGeneric method

The expectGeneric method (alias expect in JavaScript) creates a GenericAssertions object for the given value. It takes a value parameter of type any and returns a GenericAssertions object. Available since v1.9 in JavaScript only.

PlaywrightAssertions.expectLocator method

The expectLocator method creates a LocatorAssertions object for the given Locator. It takes a locator parameter of type Locator and returns a LocatorAssertions object. Since v1.18, aliases are: assertThat in Java, expect in Python, expect in JavaScript, and Expect in C#.

PlaywrightAssertions.expectPage method

The expectPage method creates a PageAssertions object for the given Page. It takes a page parameter of type Page and returns a PageAssertions object. Since v1.18, aliases are: assertThat in Java, expect in Python, expect in JavaScript, and Expect in C#.

PlaywrightAssertions.setDefaultAssertionTimeout method

The setDefaultAssertionTimeout method changes the default timeout for Playwright assertions from 5 seconds to the specified value. It takes a timeout parameter of type float representing milliseconds. Available in Java only since v1.25.

Assertion retry behavior example

Example code showing assertion retry: await expect(page.locator('.status')).toHaveText('Submitted'); Playwright will re-test the node with the selector .status until the fetched node has the 'Submitted' text, re-fetching and checking repeatedly until the condition is met or the timeout is reached.

Give your agent this brain