Page.stories.js 715 B

1234567891011121314151617181920212223
  1. import { within, userEvent } from '@storybook/testing-library';
  2. import { createPage } from './Page';
  3. export default {
  4. title: 'Example/Page',
  5. parameters: {
  6. // More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
  7. layout: 'fullscreen',
  8. },
  9. };
  10. const Template = () => createPage();
  11. export const LoggedOut = Template.bind({});
  12. export const LoggedIn = Template.bind({});
  13. // More on interaction testing: https://storybook.js.org/docs/html/writing-tests/interaction-testing
  14. LoggedIn.play = async ({ canvasElement }) => {
  15. const canvas = within(canvasElement);
  16. const loginButton = await canvas.getByRole('button', { name: /Log in/i });
  17. await userEvent.click(loginButton);
  18. };