Skip to content

Releases: happo/happo-plugin-storybook

v4.0.1

16 Jan 11:02
Compare
Choose a tag to compare

This patch release has two small fixes:

  • Slightly better detection for Storybook 7 by looking for a 'storybook' dependency in package.json (along with '@storybook/*' dependencies)
  • When using the HAPPO_DEBUG=true environment variable, we now log the full build command so that it's easier to spot mistakes.

v4.0.0

11 Jan 21:06
Compare
Choose a tag to compare

The main breaking change in this major release is that Storybook v5 is no longer supported. You can still use v3.4.1 which works with Storybook v5 and if there are critical bug fixes we might release patch releases for version 3. But any new features will be for Storybook v6 and v7.

This release also contains a bugfix for waiting for stories to complete before taking the screenshot. We were relying on a property to exist in order to set up the complete-listener. But that property only existed if someone else was listening for the storyRenderPhaseChanged event. The fix involves always listening to the storyRenderPhaseChanged event. This works for everyone on Storybook v6.4.0 or later. If you are on an earlier version than 6.4.0, you should disable this behavior using the following function:

// .storybook/preview.js
import { setShouldWaitForCompletedEvent } from 'happo-plugin-storybook/register';

setShouldWaitForCompletedEvent(false);

v3.4.1

22 Dec 11:47
Compare
Choose a tag to compare

This patch release fixes some code that detects if you're on storybook v6 or v7.

v3.4.0

22 Nov 07:40
Compare
Choose a tag to compare

This minor release adds new functionality to tell Happo to take screenshots in a play() function. Let's say you have a dropdown that you want to test in an open state and a closed state.

To do this, your play function could look like the following:

import { forceHappoScreenshot } from 'happo-plugin-storybook/register';

export const Dropdown = {
  play: async ({ args, canvasElement }) => {
    const canvas = within(canvasElement);

    await step('open', async () => {
      await userEvent.click(canvas.getByRole('button'));
      await expect(canvas.getByText('Edit item')).toBeInTheDocument();
      await forceHappoScreenshot('open');
    });

    await step('closed', async () => {
      await userEvent.click(canvas.getByRole('button'));
      await expect(canvas.getByText('Edit item')).not.toBeInTheDocument();
      await forceHappoScreenshot('closed');
    });
  },
};

The forceHappoScreenshot function takes a string argument which will be used to identify the story in the Happo report. In the above example, you will see these snapshots:

  • Dropdown > Default-open
  • Dropdown > Default-closed
  • Dropdown > Default

Apart from taking all the "forced" screenshot, Happo also takes one screenshot of the "finished" state of the play function. This means that you could potentially omit the last step in the play execution, since it will be part of the Happo report anyway.

Under the hood, forceHappoScreenshot throws an error that gets picked up by Happo. This means that the play function will be invoked several times, restarting execution from the beginning (until Happo finds a step that it hasn't seen before).

v3.3.1

13 Sep 06:52
Compare
Choose a tag to compare

This patch release changes the order in which stories are processed when you're using themes. Before, different themes for a story would be processed right after each other. With this release, all stories for one theme are processed, then all stories are processed again for the next theme. This will lead to less theme-switching which will make jobs process faster and more reliable.

v3.3.0

30 May 09:05
Compare
Choose a tag to compare

This minor release adds a way to configure the timeout used when waiting for interactive events happening as part of rendering a story. To set it, use the setRenderTimeoutMs function exported by happo-plugin-storybook/register:

import { setRenderTimeoutMs } from 'happo-plugin-storybook/register';

setRenderTimeoutMs(5000);

The default timeout is 2000ms/2s.

v3.2.4

29 May 10:00
Compare
Choose a tag to compare

This patch release makes interactive story support a little bit better by waiting for the "completed" storyRenderPhaseChanged event before taking a screenshot. If you have asynchronous events happening in a play function for instance, the screenshot is guaranteed to happen after the play invocation is completed/awaited.

v3.2.3

06 Apr 07:40
Compare
Choose a tag to compare

This patch release fixes an issue when using yarn 2. We try to detect whether to use build-storybook or storybook build. The former is the old build command in SB v6 and earlier. The latter is the new build command. As part of the detection code, we issue a yarn list command. Yarn 2 doesn't have that command which led us into using the wrong build command.

v3.2.2

22 Mar 21:00
Compare
Choose a tag to compare

This patch release fixes a bug in our release flow. The built 3.2.1 release didn't contain the changes we thought it would contain.

v3.2.1

22 Mar 08:25
Compare
Choose a tag to compare

This patch release has a bug fix for Storybook v7 setups where all screenshots would have the "Sorry, but you either have no stories or none are selected somehow." box visible. The issue was related to communicating through the addons channel. We're using a more robust communication path now.