@@ -301,7 +301,9 @@ export function composeStories<TModule extends Store_CSFExports>(
301
301
return composedStories ;
302
302
}
303
303
304
- type WrappedStoryRef = { __pw_type : 'jsx' | 'importRef' } ;
304
+ type WrappedStoryRef =
305
+ | { __pw_type : 'jsx' ; props : Record < string , any > }
306
+ | { __pw_type : 'importRef' } ;
305
307
type UnwrappedJSXStoryRef = {
306
308
__pw_type : 'jsx' ;
307
309
type : UnwrappedImportStoryRef ;
@@ -341,12 +343,16 @@ export function createPlaywrightTest<TFixture extends { extend: any }>(
341
343
` ) ;
342
344
}
343
345
346
+ // Props are not necessarily serialisable and so can't be passed to browser via
347
+ // `page.evaluate`. Regardless they are not needed for storybook load/play steps.
348
+ const { props, ...storyRefWithoutProps } = storyRef ;
349
+
344
350
await page . evaluate ( async ( wrappedStoryRef : WrappedStoryRef ) => {
345
351
const unwrappedStoryRef = await globalThis . __pwUnwrapObject ?.( wrappedStoryRef ) ;
346
352
const story =
347
353
'__pw_type' in unwrappedStoryRef ? unwrappedStoryRef . type : unwrappedStoryRef ;
348
354
return story ?. load ?.( ) ;
349
- } , storyRef ) ;
355
+ } , storyRefWithoutProps ) ;
350
356
351
357
// mount the story
352
358
const mountResult = await mount ( storyRef , ...restArgs ) ;
@@ -358,7 +364,7 @@ export function createPlaywrightTest<TFixture extends { extend: any }>(
358
364
'__pw_type' in unwrappedStoryRef ? unwrappedStoryRef . type : unwrappedStoryRef ;
359
365
const canvasElement = document . querySelector ( '#root' ) ;
360
366
return story ?. play ?.( { canvasElement } ) ;
361
- } , storyRef ) ;
367
+ } , storyRefWithoutProps ) ;
362
368
363
369
return mountResult ;
364
370
} ) ;
0 commit comments