Skip to content

Commit c2377ea

Browse files
authored
CI optimization: optimize TestCafe accessibility tests (Navigation) (#31272)
1 parent 7649c17 commit c2377ea

File tree

85 files changed

+46
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+46
-138
lines changed

e2e/testcafe-devextreme/tests/accessibility/common/form.ts renamed to e2e/testcafe-devextreme/tests/accessibility/common/form/common.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
import { Properties } from 'devextreme/ui/form.d';
2-
import url from '../../../helpers/getPageUrl';
3-
import { testAccessibility, Configuration } from '../../../helpers/accessibility/test';
4-
import { Options } from '../../../helpers/generateOptionMatrix';
1+
import { Properties } from 'devextreme/ui/form';
2+
import url from '../../../../helpers/getPageUrl';
3+
import { testAccessibility, Configuration } from '../../../../helpers/accessibility/test';
4+
import { Options } from '../../../../helpers/generateOptionMatrix';
55

66
fixture.disablePageReloads`Accessibility`
7-
.page(url(__dirname, '../../container.html'));
7+
.page(url(__dirname, '../../../container.html'));
88

99
const formData = {
1010
ID: 1,
1111
FirstName: 'John',
1212
LastName: 'Heart',
1313
Position: 'CEO',
14+
Active: true,
1415
};
1516

1617
const options: Options<Properties> = {
1718
height: [200],
1819
hint: [undefined, 'hint'],
19-
requiredMark: [undefined, '#'],
2020
alignItemLabels: [true, false],
21-
showRequiredMark: [true, false],
2221
showOptionalMark: [true, false],
23-
showValidationSummary: [true, false],
24-
showColonAfterLabel: [true, false],
25-
formData: [undefined, formData],
22+
formData: [formData],
2623
};
2724

2825
const a11yCheckConfig = {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { Properties } from 'devextreme/ui/form';
2+
import url from '../../../../helpers/getPageUrl';
3+
import { testAccessibility, Configuration } from '../../../../helpers/accessibility/test';
4+
import { Options } from '../../../../helpers/generateOptionMatrix';
5+
6+
fixture.disablePageReloads`Accessibility`
7+
.page(url(__dirname, '../../../container.html'));
8+
9+
const items: Properties['items'] = [{
10+
itemType: 'simple',
11+
dataField: 'Email',
12+
validationRules: [{
13+
type: 'required',
14+
message: 'Email is required',
15+
}],
16+
}];
17+
18+
const options: Options<Properties> = {
19+
height: [200],
20+
showRequiredMark: [true, false],
21+
showValidationSummary: [true, false],
22+
items: [items],
23+
};
24+
25+
const a11yCheckConfig = {
26+
// NOTE: color-contrast issues
27+
rules: { 'color-contrast': { enabled: false } },
28+
};
29+
30+
const configuration: Configuration = {
31+
component: 'dxForm',
32+
a11yCheckConfig,
33+
options,
34+
};
35+
36+
testAccessibility(configuration);

e2e/testcafe-devextreme/tests/accessibility/common/gallery.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Properties } from 'devextreme/ui/gallery.d';
1+
import { Properties } from 'devextreme/ui/gallery';
22
import url from '../../../helpers/getPageUrl';
33
import { testAccessibility, Configuration } from '../../../helpers/accessibility/test';
44
import { Options } from '../../../helpers/generateOptionMatrix';
@@ -25,7 +25,6 @@ const options: Options<Properties> = {
2525
height: [300],
2626
width: [300],
2727
dataSource: [gallery],
28-
loop: [true, false],
2928
swipeEnabled: [true, false],
3029
showIndicator: [true, false],
3130
showNavButtons: [true, false],

e2e/testcafe-devextreme/tests/accessibility/common/list/simpleItems.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ fixture.disablePageReloads`Accessibility`
77
.page(url(__dirname, '../../../container.html'));
88

99
const simpleItems = ['Item_1', 'Item_2', 'Item_3'];
10+
const simpleItemsPaged = { store: simpleItems, pageSize: 2 };
1011

1112
const optionsWithSimpleItems: Options<Properties> = {
12-
dataSource: [[], simpleItems],
13+
dataSource: [[], simpleItems, simpleItemsPaged],
1314
height: [400],
1415
grouped: [false],
1516
searchEnabled: [true, false],
Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +0,0 @@
1-
/* eslint-disable no-restricted-syntax */
2-
import url from '../../../helpers/getPageUrl';
3-
import { createWidget } from '../../../helpers/createWidget';
4-
import { a11yCheck } from '../../../helpers/accessibility/utils';
5-
6-
fixture`Gallery`
7-
.page(url(__dirname, '../../container.html'));
8-
9-
interface GalleryItem {
10-
ID: string;
11-
Name: string;
12-
}
13-
14-
interface GallerySettings {
15-
items?: GalleryItem[];
16-
itemTemplate?: (item: GalleryItem) => HTMLDivElement;
17-
width?: string;
18-
loop?: boolean;
19-
showIndicator?: boolean;
20-
}
21-
22-
const defaultItems: GalleryItem[] = [{
23-
ID: '1',
24-
Name: 'First',
25-
},
26-
{
27-
ID: '2',
28-
Name: 'Second',
29-
}];
30-
31-
function defaultItemTemplate(item: GalleryItem) {
32-
const result = document.createElement('div');
33-
const span = document.createElement('span');
34-
35-
span.innerText = item.Name;
36-
result.appendChild(span);
37-
38-
return result;
39-
}
40-
41-
const allGallerySettings: GallerySettings = {
42-
items: defaultItems,
43-
itemTemplate: defaultItemTemplate,
44-
width: '100%',
45-
loop: true,
46-
showIndicator: false,
47-
};
48-
49-
function getTestName(gallerySettings: GallerySettings) {
50-
const fields = Object.keys(gallerySettings);
51-
52-
const messageParts = fields.map((field) => {
53-
const fieldSkipped = gallerySettings[field] === undefined;
54-
55-
return `${field} was ${fieldSkipped ? 'not' : ''} set`;
56-
});
57-
58-
return `Checking Gallery via aXe. Settings: ${messageParts.join(', ')}`;
59-
}
60-
61-
function generateCombinations(allSettings: GallerySettings): GallerySettings[] {
62-
const keys = Object.keys(allSettings);
63-
const combinations: GallerySettings[] = [];
64-
65-
const generate = (index: number, currentCombination: GallerySettings) => {
66-
if (index === keys.length) {
67-
combinations.push(currentCombination);
68-
return;
69-
}
70-
71-
const key = keys[index];
72-
const value = allSettings[key];
73-
74-
generate(index + 1, currentCombination);
75-
76-
const newCombination = { ...currentCombination, [key]: value };
77-
generate(index + 1, newCombination);
78-
};
79-
80-
generate(0, {});
81-
return combinations;
82-
}
83-
84-
const settingsCombinations = generateCombinations(allGallerySettings);
85-
86-
settingsCombinations.forEach((settings) => {
87-
const testName = getTestName(settings);
88-
test(testName, async (t) => {
89-
const a11yCheckConfig = {
90-
rules: {
91-
'image-alt': { enabled: false },
92-
},
93-
};
94-
95-
await a11yCheck(t, a11yCheckConfig);
96-
}).before(async () => createWidget(
97-
'dxGallery',
98-
settings,
99-
));
100-
});

e2e/testcafe-devextreme/tests/editors/list/common.ts renamed to e2e/testcafe-devextreme/tests/navigation/list/common.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import List from 'devextreme-testcafe-models/list';
44
import { isMaterialBased, isFluent, testScreenshot } from '../../../helpers/themeUtils';
55
import url from '../../../helpers/getPageUrl';
66
import { createWidget } from '../../../helpers/createWidget';
7-
import { a11yCheck } from '../../../helpers/accessibility/utils';
87

98
fixture`List`
109
.page(url(__dirname, '../../container.html'));
@@ -366,27 +365,3 @@ test('The button icon in custom template should be displayed correctly after the
366365
element.append(button);
367366
},
368367
}));
369-
370-
test('Checking simple list with selectAll and "more" button via aXe', async (t) => {
371-
await a11yCheck(t);
372-
}).before(async () => createWidget('dxList', {
373-
dataSource: {
374-
store: ['item 1', 'item 2', 'item 3'],
375-
pageSize: 2,
376-
},
377-
selectionMode: 'all',
378-
showSelectionControls: true,
379-
}));
380-
381-
test('Checking group list via aXe', async (t) => {
382-
await a11yCheck(t);
383-
}).before(async () => createWidget('dxList', {
384-
dataSource: [{
385-
key: 'Group 1',
386-
items: ['item 1', 'item 2', 'item 3'],
387-
}, {
388-
key: 'Group 2',
389-
items: ['item 1', 'item 2', 'item 3'],
390-
}],
391-
grouped: true,
392-
}));

e2e/testcafe-devextreme/tests/editors/list/etalons/First item should be focused when deleted (fluent-blue-light).png renamed to e2e/testcafe-devextreme/tests/navigation/list/etalons/First item should be focused when deleted (fluent-blue-light).png

File renamed without changes.

e2e/testcafe-devextreme/tests/editors/list/etalons/First item should be focused when deleted (generic-light).png renamed to e2e/testcafe-devextreme/tests/navigation/list/etalons/First item should be focused when deleted (generic-light).png

File renamed without changes.

e2e/testcafe-devextreme/tests/editors/list/etalons/First item should be focused when deleted (material-blue-light).png renamed to e2e/testcafe-devextreme/tests/navigation/list/etalons/First item should be focused when deleted (material-blue-light).png

File renamed without changes.

e2e/testcafe-devextreme/tests/editors/list/etalons/First item should not be focused when deleted (fluent-blue-light).png renamed to e2e/testcafe-devextreme/tests/navigation/list/etalons/First item should not be focused when deleted (fluent-blue-light).png

File renamed without changes.

0 commit comments

Comments
 (0)