-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
chromatic
parameter in stories instead of separate viewpo…
…rt stories (#302) This PR includes several updates to the Storybook configuration and related files to improve the development and testing workflow in the Studio application. ### What changed? 1. **Storybook Configuration**: Significant updates have been made to `.storybook/main.ts` and `.storybook/preview.tsx`, including the addition of `mswLoader` and `withChromaticModes` for improved addon integration and testing. 2. **Package Updates**: New packages have been added to `package.json`, including `@isomer/storybook-config`, and corresponding updates have been made to `package-lock.json`. 3. **Component and Story Updates**: Updates to various components and stories, such as `DashboardTable.tsx` and `LandingPage.stories.ts`, to align with the new Storybook and Chromatic configurations. 4. **Tooling**: Added a new `@isomer/storybook-config` package under the `tooling/` directory to centralize Storybook configurations. ### How to test? 1. Checkout this branch. 2. Install the new dependencies: `npm install`. 3. Run Storybook: `npm run storybook`. 4. Verify that all stories load correctly and that Chromatic snapshots are taken as expected. ### Why make this change? To enhance the developer experience by centralizing Storybook configurations, improving Chromatic integration, and ensuring consistent testing and linting across the project. ---
- Loading branch information
Showing
20 changed files
with
361 additions
and
493 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ import { expect, userEvent, within } from "@storybook/test" | |
import { authEmailHandlers } from "tests/msw/handlers/auth/email" | ||
import { meHandlers } from "tests/msw/handlers/me" | ||
|
||
import { withChromaticModes } from "@isomer/storybook-config" | ||
|
||
import SignInPage from "~/pages/sign-in" | ||
import { getMobileViewParameters } from "../utils/viewports" | ||
|
||
const VALID_AUTH_EMAIL = "[email protected]" | ||
|
||
|
@@ -14,6 +15,7 @@ const meta: Meta<typeof SignInPage> = { | |
parameters: { | ||
// More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: "fullscreen", | ||
loginState: false, | ||
msw: { | ||
handlers: [ | ||
meHandlers.unauthorized(), | ||
|
@@ -29,27 +31,21 @@ const meta: Meta<typeof SignInPage> = { | |
export default meta | ||
type Story = StoryObj<typeof SignInPage> | ||
|
||
export const Default: Story = {} | ||
export const Default: Story = { | ||
parameters: { | ||
chromatic: withChromaticModes(["gsib", "mobile"]), | ||
}, | ||
} | ||
|
||
export const WithSgidLogin: Story = { | ||
parameters: { | ||
chromatic: withChromaticModes(["gsib", "mobile"]), | ||
features: { | ||
sgid: true, | ||
}, | ||
}, | ||
} | ||
|
||
export const Mobile: Story = { | ||
parameters: getMobileViewParameters(), | ||
} | ||
|
||
export const MobileWithSgid: Story = { | ||
parameters: { | ||
...WithSgidLogin.parameters, | ||
...Mobile.parameters, | ||
}, | ||
} | ||
|
||
export const InputValidation: Story = { | ||
play: async ({ canvasElement, step }) => { | ||
const canvas = within(canvasElement) | ||
|
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,20 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
|
||
import SitePage from "~/pages/sites/[siteId]" | ||
import { AdminLayout } from "~/templates/layouts/AdminLayout" | ||
|
||
const meta: Meta<typeof SitePage> = { | ||
title: "pages/site/[siteId]", | ||
component: SitePage, | ||
parameters: { | ||
getLayout: AdminLayout, | ||
}, | ||
decorators: [], | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.