Monday, 24 July 2023

Is there a way to access values from the Actions tab in Storybook?

I'm using Chromatic to run interaction tests. When I click the button for "Mexican" cuisine, it appends to the url params. Storybook reflects this in the "Actions" tab (shown below). How can I access those Actions so that I can run an assertion against them?

  play: async ({canvasElement}) => {
    const canvas = within(canvasElement);
    userEvent.click(await canvas.findByRole('button', {name: 'Mexican'}));
    // expect that nextRouter.push is called with the value "?cuisineOption=MEXICAN"
  },

Actions



from Is there a way to access values from the Actions tab in Storybook?

No comments:

Post a Comment