Skip to content

Commit 4d333a1

Browse files
TreeView: remove excessive theme in screenshot tests (#31330)
1 parent 21cb7b3 commit 4d333a1

69 files changed

Lines changed: 101 additions & 118 deletions

File tree

Some content is hidden

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

e2e/testcafe-devextreme/tests/navigation/treeView/common.ts

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
22
import { Selector } from 'testcafe';
33
import TreeView from 'devextreme-testcafe-models/treeView';
4-
import { testScreenshot, isMaterialBased } from '../../../helpers/themeUtils';
4+
import { testScreenshot } from '../../../helpers/themeUtils';
55
import url from '../../../helpers/getPageUrl';
66
import { createWidget } from '../../../helpers/createWidget';
7-
// eslint-disable-next-line import/extensions
8-
import { employees } from './data.js';
7+
import { employees } from './data';
98
import { setAttribute } from '../../../helpers/domUtils';
109

1110
fixture.disablePageReloads`TreeView`
@@ -149,13 +148,7 @@ test('TreeView: height should be calculated correctly when searchEnabled is true
149148

150149
await scrollable.scrollTo({ top: 1000 });
151150

152-
await testScreenshot(t, takeScreenshot, 'TreeView scrollable has correct height.png', {
153-
element: '#container',
154-
shouldTestInCompact: true,
155-
compactCallBack: async () => {
156-
await scrollable.scrollTo({ top: 1000 });
157-
},
158-
});
151+
await testScreenshot(t, takeScreenshot, 'TreeView scrollable has correct height.png', { element: '#container' });
159152

160153
await t
161154
.expect(compareResults.isValid())
@@ -172,17 +165,11 @@ test('TreeView: height should be calculated correctly when searchEnabled is true
172165

173166
[true, false].forEach((rtlEnabled) => {
174167
['selectAll', 'normal', 'none'].forEach((showCheckBoxesMode) => {
175-
test(`TreeView-selectAll,showCheckBoxesMode=${showCheckBoxesMode}`, async (t) => {
168+
const testName = `TreeView selection showCheckBoxesMode=${showCheckBoxesMode},rtl=${rtlEnabled}`;
169+
test(testName, async (t) => {
176170
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
177171

178-
const screenshotName = `TreeView selection cbm=${showCheckBoxesMode},rtl=${rtlEnabled}.png`;
179-
180-
await testScreenshot(t, takeScreenshot, screenshotName, { element: '#container' });
181-
182-
if (!isMaterialBased()) {
183-
await testScreenshot(t, takeScreenshot, screenshotName, { element: '#container', theme: 'generic.dark' });
184-
await testScreenshot(t, takeScreenshot, screenshotName, { element: '#container', theme: 'generic.contrast' });
185-
}
172+
await testScreenshot(t, takeScreenshot, `${testName}.png`, { element: '#container' });
186173

187174
await t
188175
.expect(compareResults.isValid())
@@ -204,48 +191,44 @@ test('TreeView: height should be calculated correctly when searchEnabled is true
204191
});
205192
});
206193

207-
[true, false].forEach((rtlEnabled) => {
208-
['normal', 'none'].forEach((showCheckBoxesMode) => {
209-
test(`TreeView with custom expander icons,showCheckBoxesMode=${showCheckBoxesMode}`, async (t) => {
210-
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
211-
212-
const screenshotName = `Treeview with custom icons cbm=${showCheckBoxesMode},rtl=${rtlEnabled}.png`;
213-
214-
await t.click(Selector('.dx-treeview-item').nth(1));
215-
216-
await testScreenshot(t, takeScreenshot, screenshotName, { element: '#container', shouldTestInCompact: true });
217-
218-
await t
219-
.expect(compareResults.isValid())
220-
.ok(compareResults.errorMessages());
221-
}).before(async () => createWidget('dxTreeView', {
222-
items: employees,
223-
width: 300,
224-
showCheckBoxesMode,
225-
rtlEnabled,
226-
expandIcon: 'add',
227-
collapseIcon: 'minus',
228-
itemTemplate(item) {
229-
return `<div>${item.fullName} (${item.position})</div>`;
230-
},
231-
}));
232-
});
194+
['normal', 'none'].forEach((showCheckBoxesMode) => {
195+
const testName = `Treeview with custom icons showCheckBoxesMode=${showCheckBoxesMode}`;
196+
test(testName, async (t) => {
197+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
198+
199+
await t.click(Selector('.dx-treeview-item').nth(1));
200+
201+
await testScreenshot(t, takeScreenshot, `${testName}.png`, { element: '#container' });
202+
203+
await t
204+
.expect(compareResults.isValid())
205+
.ok(compareResults.errorMessages());
206+
}).before(async () => createWidget('dxTreeView', {
207+
items: employees,
208+
width: 300,
209+
showCheckBoxesMode,
210+
expandIcon: 'add',
211+
collapseIcon: 'minus',
212+
itemTemplate(item) {
213+
return `<div>${item.fullName} (${item.position})</div>`;
214+
},
215+
}));
233216
});
234217

235218
test('TreeView checkBox focus styles', async (t) => {
236219
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
237220

238221
await t.pressKey('tab');
239222

240-
await testScreenshot(t, takeScreenshot, 'Treeview indeterminate CheckBox focus.png', { element: '#container', shouldTestInCompact: true });
223+
await testScreenshot(t, takeScreenshot, 'Treeview indeterminate CheckBox focus.png', { element: '#container' });
241224

242225
await t.pressKey('down');
243226

244-
await testScreenshot(t, takeScreenshot, 'Treeview checked CheckBox focus.png', { element: '#container', shouldTestInCompact: true });
227+
await testScreenshot(t, takeScreenshot, 'Treeview checked CheckBox focus.png', { element: '#container' });
245228

246229
await t.pressKey('down');
247230

248-
await testScreenshot(t, takeScreenshot, 'Treeview unchecked CheckBox focus.png', { element: '#container', shouldTestInCompact: true });
231+
await testScreenshot(t, takeScreenshot, 'Treeview unchecked CheckBox focus.png', { element: '#container' });
249232

250233
await t
251234
.expect(compareResults.isValid())

e2e/testcafe-devextreme/tests/navigation/treeView/data.js

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
export const employees = [{
2+
id: 1,
3+
fullName: 'John Heart',
4+
prefix: 'Dr.',
5+
position: 'CEO',
6+
expanded: true,
7+
items: [{
8+
id: 2,
9+
fullName: 'Samantha Bright',
10+
prefix: 'Dr.',
11+
position: 'COO',
12+
expanded: true,
13+
items: [{
14+
id: 3,
15+
fullName: 'Kevin Carter',
16+
prefix: 'Mr.',
17+
position: 'Shipping Manager',
18+
}, {
19+
id: 14,
20+
fullName: 'Victor Norris',
21+
prefix: 'Mr.',
22+
selected: true,
23+
position: 'Shipping Assistant',
24+
}],
25+
}, {
26+
id: 4,
27+
fullName: 'Brett Wade',
28+
prefix: 'Mr.',
29+
position: 'IT Manager',
30+
expanded: true,
31+
items: [{
32+
id: 5,
33+
fullName: 'Amelia Harper',
34+
prefix: 'Mrs.',
35+
position: 'Network Admin',
36+
}, {
37+
id: 6,
38+
fullName: 'Wally Hobbs',
39+
prefix: 'Mr.',
40+
position: 'Programmer',
41+
}, {
42+
id: 7,
43+
fullName: 'Brad Jameson',
44+
prefix: 'Mr.',
45+
position: 'Programmer',
46+
}, {
47+
id: 8,
48+
fullName: 'Violet Bailey',
49+
prefix: 'Ms.',
50+
position: 'Jr Graphic Designer',
51+
}],
52+
}, {
53+
id: 9,
54+
fullName: 'Barb Banks',
55+
prefix: 'Mrs.',
56+
position: 'Support Manager',
57+
expanded: true,
58+
items: [{
59+
id: 10,
60+
fullName: 'Kelly Rodriguez',
61+
prefix: 'Ms.',
62+
position: 'Support Assistant',
63+
}, {
64+
id: 11,
65+
fullName: 'James Anderson',
66+
prefix: 'Mr.',
67+
position: 'Support Assistant',
68+
}],
69+
}],
70+
}];

0 commit comments

Comments
 (0)