Lazy load Nivo (#14454)

oops :p
This commit is contained in:
nitin
2025-09-13 18:52:43 +05:30
committed by GitHub
parent da5ecf35fa
commit b5809096f8
5 changed files with 135 additions and 81 deletions
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { expect, within } from '@storybook/test';
import { expect, waitFor, within } from '@storybook/test';
import { MemoryRouter } from 'react-router-dom';
import { PageLayoutRenderer } from '@/page-layout/components/PageLayoutRenderer';
@@ -13,18 +13,21 @@ import { type PageLayoutWidgetWithData } from '../../types/pageLayoutTypes';
const validatePageLayoutContent = async (canvasElement: HTMLElement) => {
const canvas = within(canvasElement);
const revenueElements = await canvas.findAllByText('Revenue');
await expect(revenueElements).toHaveLength(2);
const goalProgressElements = await canvas.findAllByText('Goal Progress');
await expect(goalProgressElements).toHaveLength(2);
await waitFor(async () => {
const revenueElements = canvas.getAllByText('Revenue');
expect(revenueElements).toHaveLength(2);
const goalProgressElements = canvas.getAllByText('Goal Progress');
expect(goalProgressElements).toHaveLength(2);
expect(canvas.getByText('Product Sales')).toBeInTheDocument();
expect(canvas.getByText('Services')).toBeInTheDocument();
expect(canvas.getByText('Support')).toBeInTheDocument();
});
await expect(await canvas.findByText('Revenue Sources')).toBeVisible();
await expect(await canvas.findByText('Quarterly Comparison')).toBeVisible();
await expect(await canvas.findByText('$125,000')).toBeVisible();
await expect(await canvas.findByText('Product Sales')).toBeVisible();
await expect(await canvas.findByText('Services')).toBeVisible();
await expect(await canvas.findByText('Support')).toBeVisible();
};
const mixedGraphsPageLayout = {