```js
// MyForm.stories.js

import { expect } from '@storybook/jest';

import { userEvent, waitFor, within } from '@storybook/testing-library';

import { MyForm } from './MyForm';

export default {
  /* 👇 The title prop is optional.
   * See https://storybook.js.org/docs/7.0/react/configure/overview#configure-story-loading
   * to learn how to generate automatic titles
   */
  title: 'MyForm',
  component: MyForm,
  argTypes: {
    onSubmit: { action: true },
  },
};

export const Submitted = {
  play: async () => {
    // Starts querying the component from its root element
    const canvas = within(canvasElement);

    await userEvent.type(canvas.getByTestId('email'), 'hi@example.com');
    await userEvent.type(canvas.getByTestId('password'), 'supersecret');
    await userEvent.click(canvas.getByRole('button'));

    await waitFor(() => expect(args.onSubmit).toHaveBeenCalled());
  },
};
```
