Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
env:
NODE_ENV: production
REACT_VERSION: ${{ matrix.react }}
INCLUDE_ONE_THEME: 'true'

- name: Bundle dev pages
run: node_modules/.bin/webpack --config pages/webpack.config.integ.cjs --output-path pages/lib/static-default
Expand Down
5 changes: 5 additions & 0 deletions src/__a11y__/a11y-onetheme-dark.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import runA11yTests from './run-a11y-tests';

runA11yTests('one-theme', 'dark');
5 changes: 5 additions & 0 deletions src/__a11y__/a11y-onetheme-light.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import runA11yTests from './run-a11y-tests';

runA11yTests('one-theme', 'light');
9 changes: 5 additions & 4 deletions src/__a11y__/run-a11y-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';
import { findAllPages } from '../__integ__/utils';
import A11yPageObject from './a11y-page-object';

type Theme = 'visual-refresh';
type Theme = 'visual-refresh' | 'one-theme';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this will work right now, as one theme is gated behind INCLUDE_ONE_THEME=true... I'll have a look too.

type Mode = 'light' | 'dark';

function setupTest(url: string, testFn: (page: A11yPageObject) => Promise<void>) {
Expand All @@ -18,8 +18,9 @@ function setupTest(url: string, testFn: (page: A11yPageObject) => Promise<void>)
});
}

function urlFormatter(inputUrl: string, mode: Mode) {
return `#/${mode}/${inputUrl}`;
function urlFormatter(inputUrl: string, mode: Mode, theme: Theme) {
const params = theme === 'one-theme' ? '?oneTheme=true' : '';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a param like this instead: theme=one-theme or theme=visual-refresh?

return `#/${mode}/${inputUrl}${params}`;
}

export default function runA11yTests(theme: Theme, mode: Mode, skip: string[] = []) {
Expand All @@ -36,7 +37,7 @@ export default function runA11yTests(theme: Theme, mode: Mode, skip: string[] =
'app-layout-toolbar/without-toolbar-nested',
];
const testFunction = skipPages.includes(inputUrl) ? test.skip : test;
const url = urlFormatter(inputUrl, mode);
const url = urlFormatter(inputUrl, mode, theme);
testFunction(
url,
setupTest(url, page => page.assertNoAxeViolations())
Expand Down
Loading