stories: fix storybook interaction test for add button
This commit is contained in:
parent
449a9a701a
commit
2d5c154e2a
2 changed files with 8 additions and 11 deletions
|
@ -48,11 +48,12 @@ const interactionTest: PlayFunction<ReactFramework, PropsType> = async ({
|
|||
canvasElement,
|
||||
}) => {
|
||||
const canvas = within(canvasElement);
|
||||
const [btnAddStory] = canvas.getAllByLabelText('Add a story');
|
||||
const btnAddStory = canvas.getByLabelText('Add a story');
|
||||
await userEvent.click(btnAddStory);
|
||||
const textStory = canvas.getByText('Text story');
|
||||
await userEvent.click(textStory);
|
||||
await expect(args.onAddStory).toHaveBeenCalled();
|
||||
|
||||
const [btnStory] = canvas.getAllByText('My Stories');
|
||||
const btnStory = canvas.getByText('My Stories');
|
||||
await userEvent.click(btnStory);
|
||||
await expect(args.onClick).toHaveBeenCalled();
|
||||
};
|
||||
|
@ -98,6 +99,7 @@ SendingStory.args = {
|
|||
],
|
||||
},
|
||||
};
|
||||
SendingStory.play = interactionTest;
|
||||
|
||||
export const FailedSendStory = Template.bind({});
|
||||
FailedSendStory.story = {
|
||||
|
@ -114,3 +116,4 @@ FailedSendStory.args = {
|
|||
],
|
||||
},
|
||||
};
|
||||
FailedSendStory.play = interactionTest;
|
||||
|
|
|
@ -95,10 +95,7 @@ export const MyStoriesButton = ({
|
|||
size={AvatarSize.FORTY_EIGHT}
|
||||
title={title}
|
||||
/>
|
||||
<div
|
||||
aria-label={i18n('Stories__add')}
|
||||
className="MyStories__avatar__add-story"
|
||||
/>
|
||||
<div className="MyStories__avatar__add-story" />
|
||||
</div>
|
||||
<div className="StoryListItem__info">
|
||||
<>
|
||||
|
@ -141,10 +138,7 @@ export const MyStoriesButton = ({
|
|||
storyRing={HasStories.Read}
|
||||
title={title}
|
||||
/>
|
||||
<div
|
||||
aria-label={i18n('Stories__add')}
|
||||
className="MyStories__avatar__add-story"
|
||||
/>
|
||||
<div className="MyStories__avatar__add-story" />
|
||||
</StoriesAddStoryButton>
|
||||
</div>
|
||||
<div
|
||||
|
|
Loading…
Reference in a new issue