diff --git a/code/e2e-tests/addon-backgrounds.spec.ts b/code/e2e-tests/addon-backgrounds.spec.ts index fd577bf432cb..8aeb162d58c1 100644 --- a/code/e2e-tests/addon-backgrounds.spec.ts +++ b/code/e2e-tests/addon-backgrounds.spec.ts @@ -40,13 +40,6 @@ test.describe('addon-backgrounds', () => { }); test.describe('docs pages', () => { - // eslint-disable-next-line jest/no-disabled-tests - test.skip( - // eslint-disable-next-line jest/valid-title - templateName.includes('ssv6'), - 'Only run this test for Sandboxes with StoryStoreV7 enabled' - ); - test('button should appear for attached docs pages', async ({ page }) => { const sbPage = new SbPage(page); @@ -54,7 +47,18 @@ test.describe('addon-backgrounds', () => { await expect(sbPage.page.locator(backgroundToolbarSelector)).toBeVisible(); }); - test('button should appear for unattached docs pages', async ({ page }) => { + test('button should appear for unattached .mdx files', async ({ page }) => { + // SSv6 does not support .mdx files. There is a unattached stories.mdx file + // at /docs/addons-docs-stories-mdx-unattached--docs, but these are functionally + // really attached + + // eslint-disable-next-line jest/no-disabled-tests + test.skip( + // eslint-disable-next-line jest/valid-title + templateName.includes('ssv6'), + 'Only run this test for Sandboxes with StoryStoreV7 enabled' + ); + const sbPage = new SbPage(page); // We start on the introduction page by default. diff --git a/code/lib/preview-api/src/modules/core-client/start.test.ts b/code/lib/preview-api/src/modules/core-client/start.test.ts index 83084e7d8fcd..21fe956a7ad2 100644 --- a/code/lib/preview-api/src/modules/core-client/start.test.ts +++ b/code/lib/preview-api/src/modules/core-client/start.test.ts @@ -986,6 +986,10 @@ describe('start', () => { "id": "introduction", "importPath": "./Introduction.stories.mdx", "name": undefined, + "parameters": Object { + "fileName": "./Introduction.stories.mdx", + "renderer": "test", + }, "storiesImports": Array [], "tags": Array [ "stories-mdx", @@ -1244,6 +1248,10 @@ describe('start', () => { "id": "component-b--docs", "importPath": "file2", "name": "Docs", + "parameters": Object { + "fileName": "file2", + "renderer": "test", + }, "storiesImports": Array [], "tags": Array [ "autodocs", @@ -1277,6 +1285,10 @@ describe('start', () => { "id": "component-c--docs", "importPath": "exports-map-0", "name": "Docs", + "parameters": Object { + "fileName": "exports-map-0", + "renderer": "test", + }, "storiesImports": Array [], "tags": Array [ "component-tag", diff --git a/code/lib/preview-api/src/modules/store/StoryStore.ts b/code/lib/preview-api/src/modules/store/StoryStore.ts index e007c06c1a43..9a6fbf4543f1 100644 --- a/code/lib/preview-api/src/modules/store/StoryStore.ts +++ b/code/lib/preview-api/src/modules/store/StoryStore.ts @@ -388,6 +388,9 @@ export class StoryStore { getSetIndexPayload(): API_PreparedStoryIndex { if (!this.storyIndex) throw new Error('getSetIndexPayload called before initialization'); + if (!this.cachedCSFFiles) + throw new Error('Cannot call getSetIndexPayload() unless you call cacheAllCSFFiles() first'); + const { cachedCSFFiles } = this; const stories = this.extract({ includeDocsOnly: true }); @@ -404,7 +407,12 @@ export class StoryStore { argTypes: stories[id].argTypes, parameters: stories[id].parameters, } - : entry, + : { + ...entry, + parameters: this.preparedMetaFromCSFFile({ + csfFile: cachedCSFFiles[entry.importPath], + }).parameters, + }, ]) ), };