Fix storybook tests (#6150)
The PRs merged on Friday introduced regressions on our storybook tests suite
This commit is contained in:
@ -37,8 +37,8 @@ type Story = StoryObj<typeof IconPicker>;
|
||||
export const Default: Story = {};
|
||||
|
||||
export const WithOpen: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const iconPickerButton = await canvas.findByRole('button', {
|
||||
name: 'Click to select icon (no icon selected)',
|
||||
@ -54,8 +54,8 @@ export const WithSelectedIcon: Story = {
|
||||
|
||||
export const WithOpenAndSelectedIcon: Story = {
|
||||
...WithSelectedIcon,
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const iconPickerButton = await canvas.findByRole('button', {
|
||||
name: 'Click to select icon (selected: IconCalendarEvent)',
|
||||
@ -67,8 +67,8 @@ export const WithOpenAndSelectedIcon: Story = {
|
||||
|
||||
export const WithSearch: Story = {
|
||||
...WithSelectedIcon,
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const iconPickerButton = await canvas.findByRole('button', {
|
||||
name: 'Click to select icon (selected: IconCalendarEvent)',
|
||||
@ -92,8 +92,8 @@ export const WithSearch: Story = {
|
||||
|
||||
export const WithSearchAndClose: Story = {
|
||||
...WithSelectedIcon,
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
let iconPickerButton = await canvas.findByRole('button', {
|
||||
name: 'Click to select icon (selected: IconCalendarEvent)',
|
||||
|
||||
@ -20,8 +20,8 @@ type Story = StoryObj<typeof InternalDatePicker>;
|
||||
export const Default: Story = {};
|
||||
|
||||
export const WithOpenMonthSelect: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const monthSelect = await canvas.findByText('January');
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
import { Decorator, Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||
import { PlayFunction } from '@storybook/types';
|
||||
import { useState } from 'react';
|
||||
import { Avatar, ComponentDecorator } from 'twenty-ui';
|
||||
|
||||
import { Button } from '@/ui/input/button/components/Button';
|
||||
@ -76,8 +76,8 @@ export const Empty: Story = {
|
||||
<StyledEmptyDropdownContent data-testid="dropdown-content" />
|
||||
),
|
||||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const button = await canvas.findByRole('button');
|
||||
userEvent.click(button);
|
||||
@ -199,8 +199,8 @@ const FakeCheckableMenuItemList = ({ hasAvatar }: { hasAvatar?: boolean }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const playInteraction: PlayFunction<any, any> = async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
const playInteraction: PlayFunction<any, any> = async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const button = await canvas.findByRole('button');
|
||||
userEvent.click(button);
|
||||
@ -251,8 +251,8 @@ export const SearchWithLoadingMenu: Story = {
|
||||
</>
|
||||
),
|
||||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
play: async () => {
|
||||
const canvas = within(document.body);
|
||||
|
||||
const button = await canvas.findByRole('button');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user