Skip to content

Commit

Permalink
fix(metadata-sidebar): Fix storybook test
Browse files Browse the repository at this point in the history
  • Loading branch information
jankowiakdawid committed Sep 26, 2024
1 parent 85bd154 commit 45852eb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,17 @@ export const MetadataInstanceEditorCancelChanges: StoryObj<typeof MetadataSideba
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

const editButtons = await canvas.findAllByRole('button', { name: 'Edit' }, { timeout: 5000 });
// Edit buttons contains also template name
const editButtons = await canvas.findAllByRole('button', { name: /^edit/i }, { timeout: 5000 });
expect(editButtons).toHaveLength(3);

let headlines = await canvas.findAllByRole('heading', { level: 1 });
expect(headlines).toHaveLength(3);
expect(headlines.map(heading => heading.textContent)).toEqual(
expect.arrayContaining(['My Template', 'Select Dropdowns', 'Custom Metadata']),
);

expect(editButtons[0].ariaLabel).toBe('Edit My Template');
// go to edit mode - only edited template is visible
await userEvent.click(editButtons[0]);

Expand Down

0 comments on commit 45852eb

Please sign in to comment.