Files
2026-09-10 07:48:42 -04:00

13 lines
514 B
JavaScript

// Forces a narrow viewport for stories that specifically exercise mobile-only
// CSS breakpoints, since @storybook/addon-viewport does not affect the
// headless iframe size that @storybook/test-runner navigates to directly.
export default {
async preVisit(page, context) {
if (context.id?.includes('--enlarged')) {
await page.setViewportSize({ width: 640, height: 900 });
} else if (context.id?.includes('--mobile')) {
await page.setViewportSize({ width: 320, height: 900 });
}
},
};