diff --git a/code/e2e-tests/json-files.spec.ts b/code/e2e-tests/json-files.spec.ts new file mode 100644 index 000000000000..aeda08401486 --- /dev/null +++ b/code/e2e-tests/json-files.spec.ts @@ -0,0 +1,27 @@ +import { test, expect } from '@playwright/test'; +import process from 'process'; + +const storybookUrl = process.env.STORYBOOK_URL || 'http://localhost:8001'; + +test.describe('JSON files', () => { + test.beforeEach(async ({ page }) => { + await page.goto(storybookUrl); + }); + + test('should have index.json', async ({ page }) => { + const json = await page.evaluate(() => fetch('/index.json').then((res) => res.json())); + + expect(json).toEqual({ + v: expect.any(Number), + entries: expect.objectContaining({ + 'example-button--primary': expect.objectContaining({ + id: 'example-button--primary', + importPath: expect.stringContaining('Button.stories'), + name: 'Primary', + title: 'Example/Button', + type: 'story', + }), + }), + }); + }); +});