Skip to content

Commit

Permalink
feat(metadata-sidebar): storybook tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karolinaru authored and jankowiakdawid committed Sep 26, 2024
1 parent 7afd2ce commit 35a9a98
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,37 @@ export const MetadataInstanceEditorCancelChanges: StoryObj<typeof MetadataSideba
);
},
};

export const DeleteButtonIsDisabledWhenAddingNewMetadataTemplate: StoryObj<typeof MetadataSidebarRedesign> = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

const addTemplateButton = await canvas.findByRole('button', { name: 'Add template' }, { timeout: 5000 });
expect(addTemplateButton).toBeInTheDocument();
await userEvent.click(addTemplateButton);

const customMetadataOption = canvas.getByRole('option', { name: 'Virus Scan' });
expect(customMetadataOption).toBeInTheDocument();
await userEvent.click(customMetadataOption);

const deleteButton = await canvas.findByRole('button', { name: 'Delete' });
expect(deleteButton).toBeDisabled();
},
};

export const DeleteButtonIsEnabledWhenEditingMetadataTemplateInstance: StoryObj<typeof MetadataSidebarRedesign> = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

const editMetadataInstanceButton = await canvas.findByRole(
'button',
{ name: 'Edit My Template' },
{ timeout: 5000 },
);
expect(editMetadataInstanceButton).toBeInTheDocument();
await userEvent.click(editMetadataInstanceButton);

const deleteButton = await canvas.findByRole('button', { name: 'Delete' });
expect(deleteButton).toBeEnabled();
},
};

0 comments on commit 35a9a98

Please sign in to comment.