Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 9.0.17

- Addon Vitest: Fix support for plain `stories.tsx` files - [#32041](https://github.com/storybookjs/storybook/pull/32041), thanks @ghengeveld!
- Onboarding: Intent survey - [#31944](https://github.com/storybookjs/storybook/pull/31944), thanks @ghengeveld!
- UI: Fix text color for failing stories in sidebar - [#32042](https://github.com/storybookjs/storybook/pull/32042), thanks @ghengeveld!

## 9.0.16

- Automigration: Fail with non-zero exit code on migration failure - [#31923](https://github.com/storybookjs/storybook/pull/31923), thanks @mrginglymus!
Expand Down
5 changes: 5 additions & 0 deletions code/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ const config = defineMain({
directory: '../addons/vitest/template/stories',
titlePrefix: 'addons/vitest',
},
{
directory: '../addons/vitest/src',
titlePrefix: 'addons/vitest',
files: 'stories.tsx',
},
],
addons: [
'@storybook/addon-themes',
Expand Down
32 changes: 22 additions & 10 deletions code/addons/onboarding/src/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { HighlightElement } from './components/HighlightElement/HighlightElement
import type { STORYBOOK_ADDON_ONBOARDING_STEPS } from './constants';
import { STORYBOOK_ADDON_ONBOARDING_CHANNEL } from './constants';
import { GuidedTour } from './features/GuidedTour/GuidedTour';
import { IntentSurvey } from './features/IntentSurvey/IntentSurvey';
import { SplashScreen } from './features/SplashScreen/SplashScreen';

const SpanHighlight = styled.span(({ theme }) => ({
Expand Down Expand Up @@ -106,14 +107,21 @@ export default function Onboarding({ api }: { api: API }) {
setEnabled(false);
}, [api, setEnabled]);

const completeOnboarding = useCallback(() => {
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, {
step: '6:FinishedOnboarding' satisfies StepKey,
type: 'telemetry',
});
selectStory('configure-your-project--docs');
disableOnboarding();
}, [api, selectStory, disableOnboarding]);
const completeOnboarding = useCallback(
(answers: Record<string, unknown>) => {
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, {
step: '7:FinishedOnboarding' satisfies StepKey,
type: 'telemetry',
});
api.emit(STORYBOOK_ADDON_ONBOARDING_CHANNEL, {
answers,
type: 'survey',
});
selectStory('configure-your-project--docs');
disableOnboarding();
},
[api, selectStory, disableOnboarding]
);

useEffect(() => {
api.setQueryParams({ onboarding: 'true' });
Expand All @@ -136,7 +144,9 @@ export default function Onboarding({ api }: { api: API }) {

useEffect(() => {
setStep((current) => {
if (['1:Intro', '5:StoryCreated', '6:FinishedOnboarding'].includes(current)) {
if (
['1:Intro', '5:StoryCreated', '6:IntentSurvey', '7:FinishedOnboarding'].includes(current)
) {
return current;
}

Expand Down Expand Up @@ -272,12 +282,14 @@ export default function Onboarding({ api }: { api: API }) {
{showConfetti && <Confetti />}
{step === '1:Intro' ? (
<SplashScreen onDismiss={() => setStep('2:Controls')} />
) : step === '6:IntentSurvey' ? (
<IntentSurvey onComplete={completeOnboarding} onDismiss={disableOnboarding} />
) : (
<GuidedTour
step={step}
steps={steps}
onClose={disableOnboarding}
onComplete={completeOnboarding}
onComplete={() => setStep('6:IntentSurvey')}
/>
)}
</ThemeProvider>
Expand Down
3 changes: 2 additions & 1 deletion code/addons/onboarding/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const STORYBOOK_ADDON_ONBOARDING_STEPS = [
'3:SaveFromControls',
'4:CreateStory',
'5:StoryCreated',
'6:FinishedOnboarding',
'6:IntentSurvey',
'7:FinishedOnboarding',
] as const;
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import type { Meta, StoryObj } from '@storybook/react-vite';

import { expect, fn, screen, userEvent, waitFor } from 'storybook/test';

import { IntentSurvey } from './IntentSurvey';

const meta = {
component: IntentSurvey,
args: {
onComplete: fn(),
onDismiss: fn(),
},
} as Meta<typeof IntentSurvey>;

type Story = StoryObj<typeof meta>;
export default meta;

export const Default: Story = {};

export const Submitting: Story = {
play: async ({ args }) => {
const button = await screen.findByRole('button', { name: 'Submit' });
await expect(button).toBeDisabled();

await userEvent.click(await screen.findByText('Design system'));
await expect(button).toBeDisabled();

await userEvent.click(await screen.findByText('Functional testing'));
await userEvent.click(await screen.findByText('Accessibility testing'));
await userEvent.click(await screen.findByText('Visual testing'));
await expect(button).toBeDisabled();

await userEvent.selectOptions(screen.getByRole('combobox'), ['We use it at work']);
await expect(button).not.toBeDisabled();

await userEvent.click(button);

await waitFor(async () => {
await expect(button).toBeDisabled();
await expect(args.onComplete).toHaveBeenCalledWith({
building: {
'application-ui': false,
'design-system': true,
},
interest: {
'accessibility-testing': true,
'ai-augmented-development': false,
'design-handoff': false,
'functional-testing': true,
'team-collaboration': false,
'ui-documentation': false,
'visual-testing': true,
},
referrer: {
'ai-agent': false,
'via-friend-or-colleague': false,
'via-social-media': false,
'we-use-it-at-work': true,
'web-search': false,
youtube: false,
},
});
});
},
};
Loading