Increase storybook pages code coverage

This commit is contained in:
Charles Bochet
2024-08-31 12:09:52 +02:00
parent 56f8091a42
commit e903ce398e
9 changed files with 99 additions and 23 deletions

View File

@ -7,7 +7,6 @@ import {
PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { sleep } from '~/utils/sleep';
const meta: Meta<PageDecoratorArgs> = {
title: 'Pages/Settings/Developers/SettingsDevelopers',
@ -26,8 +25,9 @@ export type Story = StoryObj<typeof SettingsDevelopers>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await sleep(100);
await canvas.findByText('API keys');
await canvas.findByText('API keys', undefined, {
timeout: 3000,
});
},
};

View File

@ -50,17 +50,14 @@ export type Story = StoryObj<typeof SettingsDevelopersApiKeyDetail>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await canvas.findByText('Developers');
await canvas.findByText('sfsfdsf API Key');
await canvas.findByText('sfsfdsf API Key', undefined, { timeout: 3000 });
},
};
export const RegenerateApiKey: Story = {
play: async ({ step }) => {
const canvas = within(document.body);
await canvas.findByText('sfsfdsf API Key', undefined, { timeout: 10000 });
// userEvent.dblClick(await canvas.findByDisplayValue('sfsfdsf'));
await canvas.findByText('sfsfdsf API Key', undefined, { timeout: 3000 });
await userEvent.click(await canvas.findByText('Regenerate Key'));
@ -88,7 +85,7 @@ export const RegenerateApiKey: Story = {
export const DeleteApiKey: Story = {
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
await canvas.findByText('sfsfdsf API Key');
await canvas.findByText('sfsfdsf API Key', undefined, { timeout: 3000 });
await userEvent.click(await canvas.findByText('Delete'));