-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing Module functionality and stories
- Loading branch information
1 parent
fc01f69
commit f254412
Showing
16 changed files
with
279 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
code/core/src/manager/components/sidebar/TestingModule.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import React from 'react'; | ||
|
||
import { ContrastIcon, MarkupIcon, PointerHandIcon } from '@storybook/icons'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { fn, userEvent } from '@storybook/test'; | ||
|
||
import { TestingModule } from './TestingModule'; | ||
|
||
const testProviders = [ | ||
{ | ||
id: 'component-tests', | ||
title: 'Component tests', | ||
description: 'Ran 2 seconds ago', | ||
icon: <PointerHandIcon />, | ||
runnable: true, | ||
watchable: true, | ||
}, | ||
{ | ||
id: 'visual-tests', | ||
title: 'Visual tests', | ||
description: 'Not run', | ||
icon: <ContrastIcon />, | ||
runnable: true, | ||
}, | ||
{ | ||
id: 'linting', | ||
title: 'Linting', | ||
description: 'Watching for changes', | ||
icon: <MarkupIcon />, | ||
watching: true, | ||
}, | ||
]; | ||
|
||
const meta = { | ||
component: TestingModule, | ||
args: { | ||
testProviders, | ||
errorCount: 0, | ||
warningCount: 0, | ||
errorsActive: false, | ||
warningsActive: false, | ||
toggleErrors: fn(), | ||
toggleWarnings: fn(), | ||
onRunTests: fn(), | ||
onSetWatchMode: fn(), | ||
}, | ||
} satisfies Meta<typeof TestingModule>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const Collapsed: Story = { | ||
play: async ({ canvas }) => { | ||
const button = await canvas.findByRole('button', { name: /Collapse/ }); | ||
await userEvent.click(button); | ||
}, | ||
}; | ||
|
||
export const Statuses: Story = { | ||
args: { | ||
errorCount: 14, | ||
warningCount: 42, | ||
}, | ||
}; | ||
|
||
export const ErrorsActive: Story = { | ||
args: { | ||
...Statuses.args, | ||
errorsActive: true, | ||
}, | ||
}; | ||
|
||
export const WarningsActive: Story = { | ||
args: { | ||
...Statuses.args, | ||
warningsActive: true, | ||
}, | ||
}; | ||
|
||
export const BothActive: Story = { | ||
args: { | ||
...Statuses.args, | ||
errorsActive: true, | ||
warningsActive: true, | ||
}, | ||
}; | ||
|
||
export const CollapsedStatuses: Story = { | ||
args: Statuses.args, | ||
play: Collapsed.play, | ||
}; | ||
|
||
export const Running: Story = { | ||
args: { | ||
testProviders: testProviders.map((tp) => ({ ...tp, running: true })), | ||
}, | ||
}; | ||
|
||
export const CollapsedRunning: Story = { | ||
args: Running.args, | ||
play: Collapsed.play, | ||
}; | ||
|
||
export const Watching: Story = { | ||
args: { | ||
testProviders: testProviders.map((tp) => ({ ...tp, watching: true })), | ||
}, | ||
}; |
Oops, something went wrong.