Skip to content

Commit 69711f7

Browse files
Map - unskip accessibility tests (#28533)
Co-authored-by: EugeniyKiyashko <[email protected]>
1 parent 4d538cf commit 69711f7

22 files changed

+77
-48
lines changed

apps/demos/testing/common.test.js

Lines changed: 68 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121

2222
import { createMdReport, createTestCafeReport } from '../utils/axe-reporter/reporter';
2323
import knownWarnings from './known-warnings.json';
24+
import skipJsErrorsComponents from './skip-js-errors-components.json';
2425

2526
const execCode = ClientFunction((code) => {
2627
// eslint-disable-next-line no-eval
@@ -52,6 +53,9 @@ const getTestSpecificSkipRules = (testName) => {
5253
return ['empty-table-header'];
5354
case 'Localization-UsingGlobalize':
5455
return ['label'];
56+
case 'Map-Markers':
57+
case 'Map-Routes':
58+
return ['aria-hidden-focus', 'image-alt', 'image-redundant-alt'];
5559
default:
5660
return [];
5761
}
@@ -66,6 +70,11 @@ const SKIPPED_TESTS = {
6670
{ demo: 'TaskTemplate', themes: [THEME.generic, THEME.material, THEME.fluent] },
6771
{ demo: 'Validation', themes: [THEME.generic, THEME.material, THEME.fluent] },
6872
],
73+
Map: [
74+
{ demo: 'ProvidersAndTypes', themes: [THEME.generic, THEME.material, THEME.fluent] },
75+
{ demo: 'Markers', themes: [THEME.generic, THEME.material, THEME.fluent] },
76+
{ demo: 'Routes', themes: [THEME.generic, THEME.material, THEME.fluent] },
77+
],
6978
},
7079
Angular: {
7180
DataGrid: [
@@ -93,6 +102,11 @@ const SKIPPED_TESTS = {
93102
{ demo: 'DiscreteAxisZoomingAndScrolling', themes: [THEME.material] },
94103
{ demo: 'APISelectAPoint', themes: [THEME.material] },
95104
],
105+
Map: [
106+
{ demo: 'ProvidersAndTypes', themes: [THEME.generic, THEME.material, THEME.fluent] },
107+
{ demo: 'Markers', themes: [THEME.generic, THEME.material, THEME.fluent] },
108+
{ demo: 'Routes', themes: [THEME.generic, THEME.material, THEME.fluent] },
109+
],
96110
Scheduler: [
97111
{ demo: 'Overview', themes: [THEME.fluent, THEME.material] },
98112
],
@@ -161,6 +175,11 @@ const SKIPPED_TESTS = {
161175
{ demo: 'ListWithSearchBar', themes: [THEME.material] },
162176
{ demo: 'ItemDragging', themes: [THEME.fluent, THEME.material] },
163177
],
178+
Map: [
179+
{ demo: 'ProvidersAndTypes', themes: [THEME.generic, THEME.material, THEME.fluent] },
180+
{ demo: 'Markers', themes: [THEME.generic, THEME.material, THEME.fluent] },
181+
{ demo: 'Routes', themes: [THEME.generic, THEME.material, THEME.fluent] },
182+
],
164183
VectorMap: [
165184
{ demo: 'Overview', themes: [THEME.material] },
166185
{ demo: 'PieMarkers', themes: [THEME.material] },
@@ -239,6 +258,11 @@ const SKIPPED_TESTS = {
239258
List: [
240259
{ demo: 'ListWithSearchBar', themes: [THEME.material] },
241260
],
261+
Map: [
262+
{ demo: 'ProvidersAndTypes', themes: [THEME.generic, THEME.material, THEME.fluent] },
263+
{ demo: 'Markers', themes: [THEME.generic, THEME.material, THEME.fluent] },
264+
{ demo: 'Routes', themes: [THEME.generic, THEME.material, THEME.fluent] },
265+
],
242266
Gauges: [
243267
{ demo: 'Overview', themes: [THEME.material] },
244268
{ demo: 'VariableNumberOfSubvalueIndicators', themes: [THEME.material] },
@@ -310,9 +334,6 @@ const SKIPPED_TESTS = {
310334
'Scheduler',
311335
'PivotGrid',
312336
];
313-
const BROKEN_THIRD_PARTY_SCRIPTS_COMPONENT = [
314-
'Map',
315-
];
316337

317338
getDemoPaths(approach).forEach((demoPath, index) => {
318339
if (!shouldRunTestAtIndex(index + 1) || !existsSync(demoPath)) { return; }
@@ -341,9 +362,6 @@ const SKIPPED_TESTS = {
341362
if (process.env.STRATEGY === 'accessibility' && ACCESSIBILITY_UNSUPPORTED_COMPONENTS.indexOf(widgetName) > -1) {
342363
return;
343364
}
344-
if (BROKEN_THIRD_PARTY_SCRIPTS_COMPONENT.indexOf(widgetName) > -1) {
345-
return;
346-
}
347365
if (process.env.CI_ENV && process.env.DISABLE_DEMO_TEST_SETTINGS !== 'ignore') {
348366
if (mergedTestSettings.ignore) { return; }
349367
}
@@ -354,60 +372,63 @@ const SKIPPED_TESTS = {
354372

355373
changeTheme(__dirname, `../${demoPath}/index.html`, process.env.THEME);
356374

357-
runTestAtPage(test, `http://127.0.0.1:808${getPortByIndex(index)}/apps/demos/Demos/${widgetName}/${demoName}/${approach}/`)
358-
.clientScripts(clientScriptSource)(testName, async (t) => {
359-
if (visualTestStyles) {
360-
await execCode(visualTestStyles);
361-
}
375+
runTestAtPage(
376+
test,
377+
`http://127.0.0.1:808${getPortByIndex(index)}/apps/demos/Demos/${widgetName}/${demoName}/${approach}/`,
378+
skipJsErrorsComponents.includes(widgetName),
379+
).clientScripts(clientScriptSource)(testName, async (t) => {
380+
if (visualTestStyles) {
381+
await execCode(visualTestStyles);
382+
}
362383

363-
if (approach === 'Angular') {
364-
await waitForAngularLoading();
365-
}
384+
if (approach === 'Angular') {
385+
await waitForAngularLoading();
386+
}
366387

367-
if (testCodeSource) {
368-
await execCode(testCodeSource);
369-
}
388+
if (testCodeSource) {
389+
await execCode(testCodeSource);
390+
}
370391

371-
if (testCafeCodeSource) {
372-
await execTestCafeCode(t, testCafeCodeSource);
373-
}
392+
if (testCafeCodeSource) {
393+
await execTestCafeCode(t, testCafeCodeSource);
394+
}
374395

375-
if (process.env.STRATEGY === 'accessibility') {
376-
const specificSkipRules = getTestSpecificSkipRules(testName);
377-
const options = { rules: { } };
396+
if (process.env.STRATEGY === 'accessibility') {
397+
const specificSkipRules = getTestSpecificSkipRules(testName);
398+
const options = { rules: { } };
378399

379-
[...COMMON_SKIP_RULES, ...specificSkipRules].forEach((ruleName) => {
380-
options.rules[ruleName] = { enabled: false };
381-
});
400+
[...COMMON_SKIP_RULES, ...specificSkipRules].forEach((ruleName) => {
401+
options.rules[ruleName] = { enabled: false };
402+
});
382403

383-
const axeResult = await axeCheck(t, '.demo-container', options);
384-
const { error, results } = axeResult;
404+
const axeResult = await axeCheck(t, '.demo-container', options);
405+
const { error, results } = axeResult;
385406

386-
if (results.violations.length > 0) {
387-
createMdReport({ testName, results });
388-
await t.report(createTestCafeReport(results.violations));
389-
}
407+
if (results.violations.length > 0) {
408+
createMdReport({ testName, results });
409+
await t.report(createTestCafeReport(results.violations));
410+
}
390411

391-
await t.expect(error).notOk();
392-
await t.expect(results.violations.length === 0).ok(createReport(results.violations));
393-
} else {
394-
const testTheme = process.env.THEME;
412+
await t.expect(error).notOk();
413+
await t.expect(results.violations.length === 0).ok(createReport(results.violations));
414+
} else {
415+
const testTheme = process.env.THEME;
395416

396-
if (shouldSkipDemo(approach, widgetName, demoName, SKIPPED_TESTS)) {
397-
return;
398-
}
417+
if (shouldSkipDemo(approach, widgetName, demoName, SKIPPED_TESTS)) {
418+
return;
419+
}
399420

400-
const comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, comparisonOptions);
421+
const comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, comparisonOptions);
401422

402-
const consoleMessages = await t.getBrowserConsoleMessages();
423+
const consoleMessages = await t.getBrowserConsoleMessages();
403424

404-
const errors = [...consoleMessages.error, ...consoleMessages.warn]
405-
.filter((e) => !knownWarnings.some((kw) => e.startsWith(kw)));
425+
const errors = [...consoleMessages.error, ...consoleMessages.warn]
426+
.filter((e) => !knownWarnings.some((kw) => e.startsWith(kw)));
406427

407-
await t.expect(errors).eql([]);
428+
await t.expect(errors).eql([]);
408429

409-
await t.expect(comparisonResult).ok('INVALID_SCREENSHOT');
410-
}
411-
});
430+
await t.expect(comparisonResult).ok('INVALID_SCREENSHOT');
431+
}
432+
});
412433
});
413434
});
16.3 KB
Loading
16.3 KB
Loading
18.6 KB
Loading
19.2 KB
Loading
-18.3 KB
Loading
-13 Bytes
Loading
16.4 KB
Loading
16 KB
Loading
18.1 KB
Loading

0 commit comments

Comments
 (0)