fix: fix storybook pages tests coverage (#5319)

This commit is contained in:
Thaïs
2024-05-07 21:05:45 +02:00
committed by GitHub
parent ce4e78aa85
commit b7a2e72c32
10 changed files with 129 additions and 47 deletions

View File

@ -1,4 +1,5 @@
import { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/test';
import {
PageDecorator,
@ -37,3 +38,38 @@ export const CustomObject: Story = {
routeParams: { ':objectSlug': 'workspaces' },
},
};
export const ObjectDropdownMenu: Story = {
play: async ({ canvasElement }) => {
await sleep(100);
const canvas = within(canvasElement);
const objectSummaryVerticalDotsIconButton = await canvas.findByRole(
'button',
{
name: 'Object Options',
},
);
await userEvent.click(objectSummaryVerticalDotsIconButton);
await canvas.findByText('Edit');
await canvas.findByText('Deactivate');
},
};
export const FieldDropdownMenu: Story = {
play: async ({ canvasElement }) => {
await sleep(100);
const canvas = within(canvasElement);
const [fieldVerticalDotsIconButton] = await canvas.findAllByRole('button', {
name: 'Active Field Options',
});
await userEvent.click(fieldVerticalDotsIconButton);
await canvas.findByText('View');
await canvas.findByText('Deactivate');
},
};