Skip to content

Commit

Permalink
Merge pull request #462 from storybookjs/yann/story-context-type
Browse files Browse the repository at this point in the history
Fix getStoryContext type
  • Loading branch information
yannbf committed May 17, 2024
2 parents a038ece + 54e66ce commit e14700d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/playwright/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BrowserContext, Page } from 'playwright';
import type { StoryContext } from '@storybook/csf';
import type { StoryContextForEnhancers } from '@storybook/csf';

export type TestContext = {
id: string;
Expand Down Expand Up @@ -73,7 +73,10 @@ export const setPostVisit = (postVisit: TestHook) => {
globalThis.__sbPostVisit = postVisit;
};

export const getStoryContext = async (page: Page, context: TestContext): Promise<StoryContext> => {
export const getStoryContext = async (
page: Page,
context: TestContext
): Promise<StoryContextForEnhancers> => {
return page.evaluate(({ storyId }) => globalThis.__getContext(storyId), {
storyId: context.id,
});
Expand Down

0 comments on commit e14700d

Please sign in to comment.