diff --git a/e2e/test-helpers/storybook.ts b/e2e/test-helpers/storybook.ts index fb869eaa78f..4ad1e629816 100644 --- a/e2e/test-helpers/storybook.ts +++ b/e2e/test-helpers/storybook.ts @@ -1,9 +1,12 @@ import fs from 'node:fs' +import path from 'node:path' import {parseSync, traverse, types as t} from '@babel/core' import type {Page} from '@playwright/test' import {kebabCase} from 'change-case' import {waitForImages} from './waitForImages' +const AVATAR_IMAGE_PATH = path.join(__dirname, '../../packages/react/static/mock-avatar.png') + type Value = | string | boolean @@ -61,7 +64,7 @@ async function visit(page: Page, options: Options) { /** Mock live avatar urls to make them stable for visual diffing (vrt) */ await page.route('https://github.com/*.png', async route => { - await route.continue({url: 'https://github.com/primer.png'}) + await route.fulfill({path: AVATAR_IMAGE_PATH}) }) await page.goto(url.toString()) diff --git a/packages/react/.storybook/main.ts b/packages/react/.storybook/main.ts index 50a3e3788e8..e17120beed1 100644 --- a/packages/react/.storybook/main.ts +++ b/packages/react/.storybook/main.ts @@ -17,6 +17,8 @@ const config: StorybookConfig = { : // Don't include dev stories in production ['../src/**/*.mdx', '../src/**/!(*.dev).stories.@(js|jsx|ts|tsx)'], + staticDirs: ['../static'], + addons: [ getAbsolutePath('@storybook/addon-a11y'), getAbsolutePath('@storybook/addon-links'), diff --git a/packages/react/static/mock-avatar.png b/packages/react/static/mock-avatar.png new file mode 100644 index 00000000000..943f77c6749 Binary files /dev/null and b/packages/react/static/mock-avatar.png differ