diff --git a/.github/workflows/storybook-a11y.yml b/.github/workflows/storybook-a11y.yml index 92aa47c8783..9a36f7aefdf 100644 --- a/.github/workflows/storybook-a11y.yml +++ b/.github/workflows/storybook-a11y.yml @@ -27,7 +27,7 @@ jobs: with: self: .github/workflows/storybook-a11y.yml - test-storybook-a11y: + test-storybook-a11y-light: runs-on: ubuntu-latest-8-cores permissions: contents: read @@ -46,7 +46,36 @@ jobs: - name: Install Playwright browsers run: npx playwright install --with-deps - name: Start Storybook - run: yarn storybook & + run: STORYBOOK_THEME=light yarn storybook & + - name: Run tests + # the chromium browser used by Playwright sets its locale to "en_US@posix" by default + # this is not a valid language code, and causes some stories to fail to load! + # instead, we set the LANG environment variable to en_US to override this + # see https://github.com/microsoft/playwright/issues/34046 + env: + LANG: en_US + run: npx wait-on --timeout 120000 http://localhost:9001 && yarn test:storybook + + test-storybook-a11y-dark: + runs-on: ubuntu-latest-8-cores + permissions: + contents: read + id-token: write + needs: detect-changes + if: needs.detect-changes.outputs.changed == 'true' + name: "Run Storybook a11y tests" + steps: + - uses: actions/checkout@v5 + with: + persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - run: yarn install --immutable --check-cache + - name: Install Playwright browsers + run: npx playwright install --with-deps + - name: Start Storybook + run: STORYBOOK_THEME=dark yarn storybook & - name: Run tests # the chromium browser used by Playwright sets its locale to "en_US@posix" by default # this is not a valid language code, and causes some stories to fail to load! diff --git a/packages/grafana-data/src/themes/createColors.ts b/packages/grafana-data/src/themes/createColors.ts index 706f87d280e..09b94fd3b3e 100644 --- a/packages/grafana-data/src/themes/createColors.ts +++ b/packages/grafana-data/src/themes/createColors.ts @@ -107,7 +107,7 @@ class DarkColors implements ThemeColorsBase> { text = { primary: `rgb(${this.whiteBase})`, secondary: `rgba(${this.whiteBase}, 0.65)`, - disabled: `rgba(${this.whiteBase}, 0.6)`, + disabled: `rgba(${this.whiteBase}, 0.61)`, link: palette.blueDarkText, maxContrast: palette.white, }; diff --git a/packages/grafana-ui/.storybook/preview.ts b/packages/grafana-ui/.storybook/preview.ts index 39542016eab..124981e1434 100644 --- a/packages/grafana-ui/.storybook/preview.ts +++ b/packages/grafana-ui/.storybook/preview.ts @@ -183,6 +183,9 @@ const preview: Preview = { }, tags: ['autodocs'], loaders: [mswLoader], + initialGlobals: { + theme: process.env.STORYBOOK_THEME || 'system', + }, }; export default preview; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx index d2c681f2e4a..8b0cc8c9398 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx @@ -21,7 +21,7 @@ const meta: Meta = { }, args: { enableNamedColors: false, - color: '#0000ff', + color: '#ee0000', }, }; @@ -60,7 +60,7 @@ export const CustomTrigger: StoryFn = ({ color, enableNamedC ref={ref} onMouseLeave={hideColorPicker} onClick={showColorPicker} - style={{ color }} + style={{ color: 'white', backgroundColor: color, padding: '8px' }} className={clearButton} > Open color picker diff --git a/packages/grafana-ui/src/components/Tabs/Counter.tsx b/packages/grafana-ui/src/components/Tabs/Counter.tsx index f126852b5b5..f69bd306457 100644 --- a/packages/grafana-ui/src/components/Tabs/Counter.tsx +++ b/packages/grafana-ui/src/components/Tabs/Counter.tsx @@ -21,7 +21,7 @@ const getStyles = (theme: GrafanaTheme2, variant: CounterVariant) => ({ label: 'counter', marginLeft: theme.spacing(1), borderRadius: theme.spacing(3), - backgroundColor: variant === 'primary' ? theme.colors.primary.main : theme.colors.action.hover, + backgroundColor: variant === 'primary' ? theme.colors.primary.main : theme.colors.secondary.main, padding: theme.spacing(0.25, 1), color: theme.colors.text.secondary, fontWeight: theme.typography.fontWeightMedium, diff --git a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx index c9209304743..6128326b5e8 100644 --- a/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx +++ b/packages/grafana-ui/src/components/ThemeDemos/ThemeDemo.tsx @@ -316,7 +316,7 @@ export function RichColorDemo({ theme, color }: RichColorDemoProps) {
{ const legend = ( {items.map((_, index) => ( -
+
Legend item {index}
))} @@ -65,7 +68,13 @@ export const RightLegend: StoryFn = ({ height, width, legendItems, legendWidth } {items.map((_, index) => (
Legend item {index} diff --git a/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.test.tsx b/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.test.tsx index 69c8b23f771..7cea33b8642 100644 --- a/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.test.tsx +++ b/public/app/features/explore/TraceView/components/TracePageHeader/TracePageHeader.test.tsx @@ -299,7 +299,6 @@ describe('TracePageHeader test', () => { const button = screen.getByRole('button', { name: /Test Extension/i }); expect(button).toBeInTheDocument(); - expect(button).toHaveClass('css-7byezq-button'); // Grafana button primary class }); it('should render extension icons when provided', () => { @@ -485,7 +484,6 @@ describe('TracePageHeader test', () => { const buttonElement = feedbackButton.closest('a'); expect(buttonElement).toBeInTheDocument(); - expect(buttonElement).toHaveClass('css-125ehy6-button'); // Secondary variant class // Check for icon const iconElement = buttonElement?.querySelector('svg'); diff --git a/public/app/plugins/datasource/cloud-monitoring/components/__snapshots__/VariableQueryEditor.test.tsx.snap b/public/app/plugins/datasource/cloud-monitoring/components/__snapshots__/VariableQueryEditor.test.tsx.snap index d5bc9d4376c..16c464e795d 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/__snapshots__/VariableQueryEditor.test.tsx.snap +++ b/public/app/plugins/datasource/cloud-monitoring/components/__snapshots__/VariableQueryEditor.test.tsx.snap @@ -19,7 +19,7 @@ exports[`VariableQueryEditor renders correctly 1`] = `