Skip to content

Commit

Permalink
add default exclusion syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Nov 5, 2019
1 parent dd5a12e commit ed10982
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/accessibility/services/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { analyzeWithAxe, analyzeWithAxeWithClient } from './analyze_with_axe';

interface AxeContext {
include?: string[];
exclude?: string[];
exclude?: string[][];
}

interface TestOptions {
Expand All @@ -45,6 +45,7 @@ export const normalizeResult = (report: any) => {
export function A11yProvider({ getService }: FtrProviderContext) {
const browser = getService('browser');
const Wd = getService('__webdriver__');
const log = getService('log');

/**
* Accessibility testing service using the Axe (https://www.deque.com/axe/)
Expand All @@ -67,15 +68,19 @@ export function A11yProvider({ getService }: FtrProviderContext) {
private getAxeContext(global: boolean, excludeTestSubj?: string | string[]): AxeContext {
return {
include: global ? undefined : [testSubjectToCss('appA11yRoot')],
exclude: ([] as string[]).concat(excludeTestSubj || []).map(ts => testSubjectToCss(ts)),
exclude: ([] as string[])
.concat(excludeTestSubj || [])
.map(ts => [testSubjectToCss(ts)])
.concat([['.ace_scrollbar']]),
};
}

private testAxeReport(report: AxeReport) {
const errorMsgs = [];

for (const result of report.incomplete) {
errorMsgs.push(printResult(chalk.yellow('UNABLE TO VALIDATE'), result));
// these items require human review and can't be definitively validated
log.warning(printResult(chalk.yellow('UNABLE TO VALIDATE'), result));
}

for (const result of report.violations) {
Expand All @@ -91,7 +96,6 @@ export function A11yProvider({ getService }: FtrProviderContext) {
const axeOptions = {
reporter: 'v2',
runOnly: ['wcag2a', 'wcag2aa'],
exclude: ['.ace_scrollbar'],
rules: {
'color-contrast': {
enabled: false,
Expand Down

0 comments on commit ed10982

Please sign in to comment.