```ts // MyForm.stories.ts import { expect, fireEvent, userEvent, within } from '@storybook/test'; import { Meta, StoryObj } from '@storybook/react'; // 👇 Must use this import path to have mocks typed correctly import { getRouter } from '@storybook/nextjs/router.mock'; import MyForm from './my-form'; const meta: Meta = { component: MyForm, }; export default meta; type Story = StoryObj; export const GoBack: Story = { async play({ canvasElement }) { const canvas = within(canvasElement); const backBtn = await canvas.findByText('Go back'); await userEvent.click(backBtn); // 👇 Assert that your component called back() await expect(getRouter().back).toHaveBeenCalled(); }, }; ```