From ec95867ef7da8b4bfe077f07c04b78a87adc1883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 9 Aug 2024 15:22:16 +0200 Subject: [PATCH] fix(#1703): fix storybook tests --- govtool/frontend/.storybook/preview.tsx | 51 ++++++++++--------- .../GovernanceActionDetailsCard.stories.ts | 11 ++-- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/govtool/frontend/.storybook/preview.tsx b/govtool/frontend/.storybook/preview.tsx index 9ee56bf7b..24de697e5 100644 --- a/govtool/frontend/.storybook/preview.tsx +++ b/govtool/frontend/.storybook/preview.tsx @@ -5,6 +5,7 @@ import { I18nextProvider } from "react-i18next"; import { QueryClient, QueryClientProvider } from "react-query"; import { MemoryRouter, Route, Routes } from "react-router-dom"; +import { FeatureFlagProvider } from "../src/context/featureFlag"; import { AppContextProvider } from "../src/context/appContext"; import { ModalProvider } from "../src/context/modal"; import i18n from "../src/i18n"; @@ -26,30 +27,32 @@ const preview: Preview = { (Story) => ( - - - - - - - - - } - /> - - - - - + + + + + + + + + + } + /> + + + + + + ), diff --git a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts index 81cbf7366..9f60c502e 100644 --- a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts +++ b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts @@ -21,8 +21,8 @@ type Story = StoryObj; const commonArgs = { abstainVotes: 1000000, - createdDate: new Date().toLocaleDateString(), - expiryDate: new Date().toLocaleDateString(), + createdDate: new Date().toISOString(), + expiryDate: new Date().toISOString(), noVotes: 1000000, label: "Info Action", type: GovernanceActionType.InfoAction, @@ -52,7 +52,7 @@ async function assertGovActionDetails( await expect(canvas.getAllByText(todayDate)).toHaveLength(2); await expect( canvas.getByTestId(`${getProposalTypeNoEmptySpaces(args.type)}-type`), - ).toHaveTextContent(args.type); + ).toHaveTextContent(args.label); await expect(canvas.getByTestId(`${args.govActionId}-id`)).toHaveTextContent( args.govActionId, ); @@ -102,11 +102,6 @@ export const GovernanceActionDetailsDrep: Story = { await assertTooltip(tooltip1, /Submission Date/i); await assertTooltip(tooltip2, /Expiry Date/i); - - const yesRadio = canvas.getByTestId("yes-radio"); - await userEvent.click(yesRadio); - - await expect(canvas.getByTestId("vote-button")).toBeEnabled(); }, };