
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@junk-temporary-prototypes/addon-interactions
Advanced tools
Automate, test and debug user interactions
Storybook Addon Interactions enables visual debugging of interactions and tests in Storybook.
Install this addon by adding the @storybook/addon-interactions
dependency:
yarn add -D @storybook/addon-interactions @storybook/jest @storybook/testing-library
within .storybook/main.js
:
export default {
addons: ['@storybook/addon-interactions'],
};
Note that @storybook/addon-interactions
must be listed after @storybook/addon-actions
or @storybook/addon-essentials
.
Interactions relies on "instrumented" versions of Jest and Testing Library, that you import from @storybook/jest
and
@storybook/testing-library
instead of their original package. You can then use these libraries in your play
function.
import { Button } from './Button';
import { expect } from '@storybook/jest';
import { within, userEvent } from '@storybook/testing-library';
export default {
title: 'Button',
component: Button,
argTypes: {
onClick: { action: true },
},
};
const Template = (args) => <Button {...args} />;
export const Demo = Template.bind({});
Demo.play = async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole('button'));
await expect(args.onClick).toHaveBeenCalled();
};
In order to enable step-through debugging, calls to userEvent.*
, fireEvent
, findBy*
, waitFor*
and expect
have to
be await
-ed. While debugging, these functions return a Promise that won't resolve until you continue to the next step.
While you can technically use screen
, it's recommended to use within(canvasElement)
. Besides giving you a better error
message when a DOM element can't be found, it will also ensure your play function is compatible with Storybook Docs.
Any args
that are marked as an action
(typically via argTypes
or argTypesRegex
) will be automatically wrapped in
a Jest mock function so you can assert invocations. See
addon-actions for how to setup actions.
FAQs
Automate, test and debug user interactions
The npm package @junk-temporary-prototypes/addon-interactions receives a total of 1 weekly downloads. As such, @junk-temporary-prototypes/addon-interactions popularity was classified as not popular.
We found that @junk-temporary-prototypes/addon-interactions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.