```ts // MyComponent.stories.ts import { userEvent, within } from '@storybook/testing-library'; import type { Meta, StoryObj } from '@storybook/web-components'; const meta: Meta = { title: 'QueryMethods', component: 'demo-my-component', }; export default meta; type Story = StoryObj; /* See https://storybook.js.org/docs/7.0/web-components/writing-stories/play-function#working-with-the-canvas * to learn more about using the canvasElement to query the DOM */ export const ExampleWithRole: Story = { play: async ({ canvasElement }) => { const canvas = within(canvasElement); // See https://storybook.js.org/docs/7.0/web-components/essentials/actions#automatically-matching-args to learn how to setup logging in the Actions panel await userEvent.click(canvas.getByRole('button', { name: / button label/i })); }, }; ```