What if we could see @storybookjs as "just" a visual extension on top of a testing-library unit test?
Well, in this RFC, I talk about how the play function in storybook could get very similar semantics as a normal jest/@vitest_dev based UI unit test!
github.com/storybookjs/story…
Update ✨ StorybookGPT now produces much better @storybookjs stories by asking you for additional details such as missing types, children components, and even fixtures.
I'm already impressed by the results, let me know what you think!
🧳 Portable stories for Playwright Component Tests
Easily reuse your stories inside of Playwright CT tests. This workflow combines Storybook’s component development and documentation with @playwrightweb's powerful test features.
Docs: storybook.js.org/docs/api/po…
💯 Hundreds more improvements
Some highlights:
- Experimental React 19 support
- @angular 18 support
- Support for Angular 17’s new input and output signals
- Tags to exclude stories from sidebar, autodocs, or test runs
- Read-only controls
This release was made possible by 93 contributions by 58 contributors from across the world.
We’re indebted to our global community. Thank you for your support! ❤️
⚛️ Unit testing React Server Components
If you’re using @nextjs, Storybook now mocks many of the modules used by RSCs, so you can unit test them! They're automatically spied and add helpful methods which you can use within your stories.
Docs: storybook.js.org/docs/get-st…
ALT A screenshot of the `noteDetail.stories.ts` file, containing the code: import { cookies } from '@storybook/nextjs/headers.mock'; import { createUserCookie, userCookieKey } from '#lib/cookie'; import Page from './noteDetail'; const meta = { component: Page, // Use an RSC component in Storybook! async beforeEach() { // Set a Next.js cookie before each story is rendered cookies().set(userCookieKey, await createUserCookie('alice')) }, parameters: { nextjs: { navigation: { pathname: '/note/[id]', query: { id: '1' } }, }, }, } satisfies Meta<typeof Page>
Storybook 8.1 is out now! 🥳
TL;DR:
🤖 Story auto-generation and save from controls
🥸 Type-safe, standards-based module mocking
⚛️ Unit testing React Server Components
🧳 Portable stories for Playwright Component Tests
💯 Hundreds more improvements
storybook.js.org/blog/storyb…
🥸 Type-safe, standards-based module mocking
Storybook now has built-in support and guidance for using subpath imports, a node standard for conditionally importing modules, which can be used to mock modules in your components and stories.
Docs: storybook.js.org/docs/writin…
ALT A screenshot of a portion of a `package.json` file containing the code: { "type": "module", "imports": { "#lib/db": { "storybook": "./lib/db.mock.ts", "default": "./lib/db.ts" }, "#*": [ "./*", "./*.ts", "./*.tsx" ] } }
🤖 Story auto-generation and save from controls
For the first time ever, edit or create a story from the Controls panel. And (for React projects, to start) generate a brand-new story file for a component by simply searching for its name.
Docs: storybook.js.org/docs/get-st…
Congratulations @angular on your v18 release!!!
The Storybook team is tickled pink (🩷) to be mentioned as collaborators and released a patch with v18 support here (h/t @vatcoop!)
github.com/storybookjs/story…
🔥 Angular v18 is now available
Excited to share the next milestone in the evolution of Angular:
‣ Experimental zoneless
‣ New home for developers on Angular.dev
‣ Material 3, deferrable views, built-in control flow are now stable
‣ More!
blog.angular.io/angular-v18-…
ALT An image showing the Angular logo and the label v18 is now available
Want to work in harmony with your designer?
Join Storybook maintainer @yannbf tomorrow at 10am PST to discuss what works (and what doesn't! 😬)
👉 zepl.ink/ZePanel
From our sponsor: Tired of broken layouts & janky UI? Chromatic automatically detects visual bugs, from misaligned elements to incorrect colors & z-index glitches. Tests run at lightning speed thanks to automatic parallelization—at no extra cost.
chromatic.com/features/visua…
Storybook Rsbuild is here! 🥳
It's built based on Rspack & Rsbuild, 5x faster than the webpack version.
See: github.com/rspack-contrib/st…
Made by @fi3ework ❤️
"You'd do well to remember that open source is first and foremost a method of collaboration between programmers who show up to do the work. Not an entitlement program for petulant users to get free stuff or a seat at the table where decisions are made." world.hey.com/dhh/open-sourc…
Test your components with stories in @playwrightweb Component Tests!
🧳 Introducing the portable stories API
✍️ Write stories in Component Story Format
♻️ Re-use those stories in Playwright CT
🤝 Storybook & Playwright work well together
Available for React 18+ and Vue 3.
👇
ALT Source code for file, RestaurantDetailPage.spec.tsx:
// For Vue3, import from '@storybook/vue3/experimental-playwright'
import { createTest } from '@storybook/react/experimental-playwright'
// For Vue3, import from '@playwright/experimental-ct-vue'
import { test as base, expect } from '@playwright/experimental-ct-react'
import stories from './RestaurantDetailPage.stories.portable'
const test = createTest(base)
test('Default', async ({ mount }) => {
// The mount function will execute all the necessary steps in the story,
// such as loaders, render, and play function
await mount(<stories.Default />)
})
test('WithItemsInTheCart', async ({ mount, page }) => {
await mount(<stories.Success />)
await page.getByLabel('menu item').first().click()
await page.getByLabel('increase quantity by one').click()
await page.getByLabel('confirm').click()
await expect(page.getByLabel('food cart')).toContainText('€25.50')
})