Releases: happo/happo-plugin-storybook
v2.9.0
This minor release adds support for an afterScreenshot
hook. Similar to beforeScreenshot
, this hook can be used to clean up things after taking a screenshot of a component.
const Foo = () => <Foo />;
Foo.parameters = {
happo: {
afterScreenshot: () => {
document.querySelector('. bar').remove();
},
},
};
export { Foo };
v2.8.0
This version adds a new option to stories: beforeScreenshot
. Use this as a hook to perform certain operations in the DOM before Happo takes the screenshot. Here's an example where a button is clicked in a beforeScreenshot
hook:
const BasicModal = () => <ModalExample />;
BasicModal.parameters = {
happo: {
beforeScreenshot: () => {
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false,
});
document.querySelector('button.open-modal').dispatchEvent(clickEvent);
},
},
};
export { BasicModal };
v2.7.0
This minor release adds support for a new waitFor
option that can be used to make certain Storybook stories wait for a condition to be truthy before taking the screenshot. Here's a usage example:
storiesOf('Some lazy-loading component', module)
.add('waiting for a selector', () => <LazyLoadingExample />, {
happo: { waitFor: () => document.querySelector('.lazy-content-ready') },
});
v2.6.0
This minor release adds support for a new usePrebuiltPackage
option to happoPluginStorybook
:
// .happo.js
const happoPluginStorybook = require('happo-plugin-storybook');
module.exports = {
...
plugins: [
happoPluginStorybook({ usePrebuiltPackage: true }),
],
...
};
This new option allows you to use a pre-built package, which can help speed up certain CI setups.
v2.5.3
v2.5.2
v2.5.1
v2.5.0
This release adds support for a waitForContent
parameter. Use it in cases where you have asynchronously loaded content that Happo isn't automatically detecting. E.g.
storiesOf('PaymentForm', module)
.add('default', () => <PaymentForm />, { happo: { waitForContent: 'Credit card' } });
v2.4.0
v2.3.2
Fixes an issue in Safari where a story with a short delay before rendering any content would be considered done prematurely. We work around this by deferring things until the next execution tick, allowing the old story to be unmounted and the new one take its place.