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 · Test runner API · all subjects

fixtures/mount

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

mount fixture for component testing

The mount fixture mounts a component story and returns a Locator pointing to the root element the story was rendered into. Queries should be scoped from the returned locator (e.g., component.getByRole('button'), not page.getByRole('button')). A story is a small wrapper component that embeds the component under test in one specific scenario. Stories are rendered by a gallery page that exposes window.mount(params) and window.unmount() functions. Each call to mount navigates to the baseURL and calls window.mount() with the story id and props. The returned locator is augmented with update(props) to re-render the same story with new props and unmount() to unmount the story. Available since v1.62. Returns type: Locator.

mount fixture parameters

The mount fixture takes two parameters: storyId (string, required) - the identifier of the story to mount as resolved by the gallery page, conventionally the story file path plus the exported story name (e.g., 'components/Button/Primary'); props (Object, optional) - optional plain, serializable props passed to the story.

mount fixture type checking with template argument

The mount fixture supports passing the story type as a template argument to type-check the props. Example: const component = await mount<typeof WithTitle>('Button/WithTitle', { title: 'Hello' });

mount fixture basic usage example

test('click should expand', async ({ mount }) => { const component = await mount('components/Expandable/Stateful'); await component.getByRole('button').click(); await expect(component.getByTestId('expanded')).toHaveValue('true'); });

Give your agent this brain