Skip to content
Snippets Groups Projects

feat(Bootstrap): Remove color variable settings in _reboot.scss

All threads resolved!
Files
205
+ 32
1
import { TestRunnerConfig, waitForPageReady } from '@storybook/test-runner';
import { getStoryContext, TestRunnerConfig, waitForPageReady } from '@storybook/test-runner';
import { checkA11y, configureAxe, injectAxe } from 'axe-playwright';
import { toMatchImageSnapshot } from 'jest-image-snapshot';
import { getResetAnimationsCSS } from '../src/utils/test_utils';
import { join, relative } from 'node:path';
@@ -27,6 +28,8 @@ const chartsFailureThreshold = 0.0018;
const isChart = ({ title }) => title.startsWith('charts/');
const isBaseComponent = ({ title }) => title.startsWith('base/');
const getMatchOptions = (context) => {
const failureThresholdType: Threshold = isChart(context)
? chartsFailureThresholdType
@@ -41,6 +44,29 @@ const getMatchOptions = (context) => {
const fileExists = async (path) => !!(await stat(path).catch((e) => false));
const runA11y = async (page, context) => {
const storyContext = await getStoryContext(page, context);
if (isBaseComponent(context) && !storyContext.parameters?.a11y?.disable) {
await configureAxe(page, {
rules: storyContext.parameters?.a11y?.config?.rules,
});
await checkA11y(
page,
'#storybook-root',
{
detailedReport: true,
detailedReportOptions: {
html: true,
},
},
false,
'v2'
);
}
};
// For now, we generate identifiers that match legacy storyshots-generated files so that Git
// understands we are moving files, not creating new ones.
const getSnapshotIdentified = (context) =>
@@ -57,6 +83,8 @@ const config: TestRunnerConfig = {
async preVisit(page) {
page.setViewportSize(DEFAULT_VIEWPORT_SIZE);
await injectAxe(page);
// Wait until assets have finished loading. It is worth noting that we ran into several timing
// issues while setting up Test Runner that were eventually addressed by the addition of an
// arbitrary timeout below in the `postVisit` hook. That works around the fact that
@@ -111,6 +139,9 @@ const config: TestRunnerConfig = {
storeReceivedOnFailure: true,
...getMatchOptions(context),
});
// run accessibility tests
await runA11y(page, context);
},
tags: {
skip: ['skip-visual-test'],
Loading