wrap interactor's actions to show them in storybook interactions debugger#126
wrap interactor's actions to show them in storybook interactions debugger#126
Conversation
|
|
✔️ Deploy Preview for interactors canceled. 🔨 Explore the source changes: 4a0ae0f 🔍 Inspect the deploy log: https://app.netlify.com/sites/interactors/deploys/61aefbbe98d7200007df999b |
|
Dropping this here to track changes to storybook required to implement this storybookjs/storybook#16667 |
packages/globals/src/globals.ts
Outdated
| wrapper: ( | ||
| description: string, | ||
| action: () => Promise<T>, | ||
| type: ActionType, | ||
| options: InteractorOptions | ||
| ) => () => Promise<T> | ||
| ): () => boolean { |
There was a problem hiding this comment.
It looks like this wrapper should be a type:
export interface InteractionEvent<T> {
description: string;
action: () => Promise<T> ;
type: ActionType;
options: InteractionOptions;
}
export type InteractionHook<T> = (event: InteractionEvent<T>) => Promise<T>;
export function addActionWrapper<T>(hook: InteractionHook<T>): () => boolean {
// add it
}There was a problem hiding this comment.
Done. That was a little bit tricky to not break things
Motivation
Storybook announced new feature interactive stories.
Approach
This spike shows how we can use that feature with our interactors.
trackmethod isn't exported for public usage.