```ts // MyComponent.stories.ts import type { Meta, StoryObj } from '@storybook/web-components'; import { userEvent, within } from '@storybook/test'; const meta: Meta = { component: 'demo-my-component', }; export default meta; type Story = StoryObj; export const ExampleStory: Story = { play: async ({ canvasElement }) => { // Assigns canvas to the component root element const canvas = within(canvasElement); // Starts querying from the component's root element await userEvent.type(canvas.getByTestId('example-element'), 'something'); await userEvent.click(canvas.getByRole('another-element')); }, }; ```