Fix storybook tests (#6150)

The PRs merged on Friday introduced regressions on our storybook tests
suite
This commit is contained in:
Charles Bochet
2024-07-06 09:32:30 +02:00
committed by GitHub
parent 7b3a590f79
commit 46dac5a0ef
10 changed files with 44 additions and 47 deletions

View File

@ -1,8 +1,8 @@
import { zodResolver } from '@hookform/resolvers/zod';
import pick from 'lodash.pick';
import { useEffect } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { useNavigate, useParams } from 'react-router-dom';
import { zodResolver } from '@hookform/resolvers/zod';
import pick from 'lodash.pick';
import { H2Title, IconArchive, IconSettings } from 'twenty-ui';
import { z } from 'zod';
@ -81,7 +81,12 @@ export const SettingsObjectEdit = () => {
),
});
navigate(`${settingsObjectsPagePath}/${getObjectSlug(formValues)}`);
navigate(
`${settingsObjectsPagePath}/${getObjectSlug({
...formValues,
namePlural: formValues.labelPlural,
})}`,
);
} catch (error) {
enqueueSnackBar((error as Error).message, {
variant: SnackBarVariant.Error,

View File

@ -35,15 +35,13 @@ export const StandardObject: Story = {
export const CustomObject: Story = {
args: {
routeParams: { ':objectSlug': 'workspaces' },
routeParams: { ':objectSlug': 'my-customs' },
},
};
export const ObjectDropdownMenu: Story = {
play: async ({ canvasElement }) => {
await sleep(100);
const canvas = within(canvasElement);
play: async () => {
const canvas = within(document.body);
const objectSummaryVerticalDotsIconButton = await canvas.findByRole(
'button',
{
@ -59,10 +57,8 @@ export const ObjectDropdownMenu: Story = {
};
export const FieldDropdownMenu: Story = {
play: async ({ canvasElement }) => {
await sleep(100);
const canvas = within(canvasElement);
play: async () => {
const canvas = within(document.body);
const [fieldVerticalDotsIconButton] = await canvas.findAllByRole('button', {
name: 'Active Field Options',
});