Fix chromatic tests (#12551)
This commit is contained in:
committed by
GitHub
parent
ecbc116f8b
commit
10b97d56d4
@ -1,14 +1,15 @@
|
|||||||
import { Meta, StoryObj } from '@storybook/react';
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
|
|
||||||
import { TaskList } from '@/activities/tasks/components/TaskList';
|
import { TaskList } from '@/activities/tasks/components/TaskList';
|
||||||
|
import { ComponentDecorator } from 'twenty-ui/testing';
|
||||||
import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';
|
import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';
|
||||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||||
import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
|
import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
|
||||||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
|
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
|
||||||
|
import { RightDrawerDecorator } from '~/testing/decorators/RightDrawerDecorator';
|
||||||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
||||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||||
import { mockedTasks } from '~/testing/mock-data/tasks';
|
import { mockedTasks } from '~/testing/mock-data/tasks';
|
||||||
import { ComponentDecorator } from 'twenty-ui/testing';
|
|
||||||
|
|
||||||
const meta: Meta<typeof TaskList> = {
|
const meta: Meta<typeof TaskList> = {
|
||||||
title: 'Modules/Activity/TaskList',
|
title: 'Modules/Activity/TaskList',
|
||||||
@ -20,6 +21,7 @@ const meta: Meta<typeof TaskList> = {
|
|||||||
MemoryRouterDecorator,
|
MemoryRouterDecorator,
|
||||||
ObjectMetadataItemsDecorator,
|
ObjectMetadataItemsDecorator,
|
||||||
SnackBarDecorator,
|
SnackBarDecorator,
|
||||||
|
RightDrawerDecorator,
|
||||||
],
|
],
|
||||||
args: {
|
args: {
|
||||||
title: 'Tasks',
|
title: 'Tasks',
|
||||||
|
|||||||
@ -198,12 +198,22 @@ export const ResetsDateByErasingInputContent: Story = {
|
|||||||
new RegExp(`12/09/${currentYear} \\d{2}:\\d{2}`),
|
new RegExp(`12/09/${currentYear} \\d{2}:\\d{2}`),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await userEvent.click(input);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(canvas.getByRole('dialog')).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
await userEvent.clear(input);
|
await userEvent.clear(input);
|
||||||
|
|
||||||
|
const waitForDialogToBeRemoved = waitForElementToBeRemoved(() =>
|
||||||
|
canvas.queryByRole('dialog'),
|
||||||
|
);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
userEvent.type(input, '{Enter}'),
|
userEvent.type(input, '{Enter}'),
|
||||||
|
|
||||||
waitForElementToBeRemoved(() => canvas.queryByRole('dialog')),
|
waitForDialogToBeRemoved,
|
||||||
waitFor(() => {
|
waitFor(() => {
|
||||||
expect(args.onChange).toHaveBeenCalledWith(null);
|
expect(args.onChange).toHaveBeenCalledWith(null);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext';
|
||||||
|
import { Decorator } from '@storybook/react';
|
||||||
|
|
||||||
|
export const RightDrawerDecorator: Decorator = (Story) => (
|
||||||
|
<RightDrawerProvider value={{ isInRightDrawer: false }}>
|
||||||
|
<Story />
|
||||||
|
</RightDrawerProvider>
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user