Skip to content

Commit 4c27b16

Browse files
e2e tests: move Treelist, PivotGrid, Gantt to common folder
1 parent 0c417f3 commit 4c27b16

File tree

394 files changed

+490
-245
lines changed

Some content is hidden

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

394 files changed

+490
-245
lines changed

.github/workflows/testcafe_tests.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282
{ componentFolder: "common", name: "common" },
8383
{ componentFolder: "common", name: "common - material", theme: 'material.blue.light' },
8484
{ componentFolder: "common", name: "common - fluent", theme: 'fluent.blue.light' },
85-
{ componentFolder: "treeList", name: "treeList", concurrency: 1 },
8685
{ componentFolder: "dataGrid/common", name: "dataGrid / common (1/5)", indices: "1/5" },
8786
{ componentFolder: "dataGrid/common", name: "dataGrid / common (2/5)", indices: "2/5" },
8887
{ componentFolder: "dataGrid/common", name: "dataGrid / common (3/5)", indices: "3/5" },
@@ -95,9 +94,9 @@ jobs:
9594
{ componentFolder: "cardView", name: "cardView" },
9695
{ componentFolder: "cardView", name: "cardView - material", theme: 'material.blue.light' },
9796
{ componentFolder: "cardView", name: "cardView - fluent", theme: 'fluent.blue.light' },
98-
{ componentFolder: "pivotGrid", name: "pivotGrid", concurrency: 1 },
99-
{ componentFolder: "pivotGrid", name: "pivotGrid - material", theme: 'material.blue.light', concurrency: 1 },
100-
{ componentFolder: "pivotGrid", name: "pivotGrid - fluent", theme: 'fluent.blue.light', concurrency: 1 },
97+
# { componentFolder: "pivotGrid", name: "pivotGrid" },
98+
# { componentFolder: "pivotGrid", name: "pivotGrid - material", theme: 'material.blue.light' },
99+
# { componentFolder: "pivotGrid", name: "pivotGrid - fluent", theme: 'fluent.blue.light' },
101100
{ componentFolder: "scheduler/common", name: "scheduler / common (1/6)", indices: "1/6" },
102101
{ componentFolder: "scheduler/common", name: "scheduler / common (2/6)", indices: "2/6" },
103102
{ componentFolder: "scheduler/common", name: "scheduler / common (3/6)", indices: "3/6" },
@@ -123,14 +122,6 @@ jobs:
123122
{ componentFolder: "navigation", name: "navigation" },
124123
{ componentFolder: "navigation", name: "navigation - material", theme: 'material.blue.light' },
125124
{ componentFolder: "navigation", name: "navigation - fluent", theme: 'fluent.blue.light' },
126-
{ componentFolder: "filterBuilder", name: "filterBuilder" },
127-
{ componentFolder: "filterBuilder", name: "filterBuilder - material", theme: 'material.blue.light' },
128-
{ componentFolder: "filterBuilder", name: "filterBuilder - fluent", theme: 'fluent.blue.light' },
129-
{ componentFolder: "pagination", name: "pagination" },
130-
# TODO Chrome133: skipped during chrome update
131-
# { componentFolder: "pagination", name: "pagination - material", theme: 'material.blue.light' },
132-
{ componentFolder: "pagination", name: "pagination - fluent", theme: 'fluent.blue.light' },
133-
{ componentFolder: "gantt", name: "gantt" },
134125
]
135126
runs-on: devextreme-shr2
136127
timeout-minutes: 45

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
"editor.codeActionsOnSave": {
66
"source.fixAll.eslint": "explicit"
77
},
8-
"typescript.tsdk": "packages/devextreme/node_modules/typescript/lib"
8+
"typescript.tsdk": "packages/devextreme/node_modules/typescript/lib",
9+
"testcafeTestRunner.workspaceRoot": "/Users/eugeniy/Documents/GitHub/DevExtreme/e2e/testcafe-devextreme/"
10+
911
}

e2e/testcafe-devextreme/helpers/accessibility/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface Configuration<TComponentOptions = unknown> {
1111
a11yCheckConfig?: A11yCheckOptions;
1212
selector?: ElementContext;
1313
created?: (t: TestController, optionConfiguration?: TComponentOptions) => Promise<void>;
14+
meta?: Record<string, unknown>;
1415
}
1516

1617
export const defaultSelector = '#container';
@@ -39,12 +40,15 @@ export const testAccessibility = <TComponentOptions = unknown>(
3940
selector = defaultSelector,
4041
a11yCheckConfig = defaultA11yCheckConfig,
4142
created = defaultCreated,
43+
meta: testMeta,
4244
} = configuration;
4345

4446
const optionConfigurations = getOptionConfigurations(options);
4547

4648
optionConfigurations.forEach((optionConfiguration, index) => {
47-
test(`${component}: test with axe #${index}`, async (t) => {
49+
const testFn = testMeta ? test.meta(testMeta) : test;
50+
51+
testFn(`${component}: test with axe #${index}`, async (t) => {
4852
await a11yCheck(t, a11yCheckConfig, selector, optionConfiguration);
4953
}).before(async (t) => {
5054
await createWidget(

e2e/testcafe-devextreme/helpers/safeSizeTest.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ const decorateTestCafeAfter = (
5353
});
5454
};
5555

56+
interface SafeSizeTestOptions {
57+
meta?: Record<string, string | boolean>;
58+
}
59+
5660
const safeSizeTest = (
5761
name: string,
5862
testFunction: TestCafeFn,
5963
size: BrowserSizeType = DEFAULT_BROWSER_SIZE as BrowserSizeType,
64+
options?: SafeSizeTestOptions,
6065
): TestFn => {
61-
const testCafeTest = test(name, testFunction);
66+
const testCafeTest = options?.meta
67+
? test.meta(options.meta)(name, testFunction)
68+
: test(name, testFunction);
6269

6370
decorateTestCafeBefore(testCafeTest, size);
6471
decorateTestCafeAfter(testCafeTest);

e2e/testcafe-devextreme/helpers/testPageUtils.ts

Lines changed: 204 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function clearTestPage(testController: TestController): Promise<voi
1616
const widgetNames = $widgetElement.data().dxComponents;
1717
widgetNames?.forEach((name) => {
1818
if ($widgetElement.hasClass('dx-widget')) {
19-
// @ts-expect-error ts-erroe
19+
// @ts-expect-error ts-error
2020
$widgetElement[name]?.('dispose');
2121
}
2222
});
@@ -66,3 +66,206 @@ export async function loadAxeCore(t: TestController): Promise<void> {
6666
document.head.appendChild(script);
6767
}));
6868
}
69+
70+
export async function loadQuill(t: TestController): Promise<void> {
71+
await t.eval(() => new Promise<void>((resolve, reject) => {
72+
// @ts-expect-error ts-error
73+
if (window.Quill) {
74+
resolve();
75+
return;
76+
}
77+
78+
const script = document.createElement('script');
79+
script.src = '../../../packages/devextreme/artifacts/js/dx-quill.min.js';
80+
// @ts-expect-error ts-error
81+
script.onload = resolve;
82+
script.onerror = reject;
83+
document.head.appendChild(script);
84+
}));
85+
}
86+
87+
export async function loadGantt(t: TestController): Promise<void> {
88+
await t.eval(() => new Promise<void>((resolve, reject) => {
89+
// @ts-expect-error ts-error
90+
if (window.DevExpress?.ui?.dxGantt) {
91+
resolve();
92+
return;
93+
}
94+
95+
const script = document.createElement('script');
96+
script.src = '../../../packages/devextreme/artifacts/js/dx-gantt.min.js';
97+
// @ts-expect-error ts-error
98+
script.onload = resolve;
99+
script.onerror = reject;
100+
document.head.appendChild(script);
101+
}));
102+
}
103+
104+
export async function loadAspNetData(t: TestController): Promise<void> {
105+
await t.eval(() => new Promise<void>((resolve, reject) => {
106+
// @ts-expect-error ts-error
107+
if (window.DevExpress?.data?.AspNet) {
108+
resolve();
109+
return;
110+
}
111+
112+
const script = document.createElement('script');
113+
script.src = '../../../packages/devextreme/artifacts/js/dx.aspnet.data.js';
114+
// @ts-expect-error ts-error
115+
script.onload = resolve;
116+
script.onerror = reject;
117+
document.head.appendChild(script);
118+
}));
119+
}
120+
121+
// interface LoadOptions {
122+
// basePath?: string;
123+
// checkExists?: string;
124+
// }
125+
126+
// // async function loadResources(
127+
// // t: TestController,
128+
// // urls: string[],
129+
// // type: 'script' | 'style',
130+
// // options?: LoadOptions,
131+
// // ): Promise<void> {
132+
// // await t.eval(
133+
// // ({
134+
// // urls: urlList, type: resourceType, basePath, checkExists,
135+
// // }) => new Promise<void>((resolve, reject) => {
136+
// // if (!urlList.length) {
137+
// // resolve();
138+
// // return;
139+
// // }
140+
141+
// // let remaining = urlList.length;
142+
143+
// // const handleLoad = () => {
144+
// // remaining -= 1;
145+
// // if (remaining === 0) resolve();
146+
// // };
147+
148+
// // const handleError = (err: Event) => reject(err);
149+
150+
// // const createResource = (url: string): void => {
151+
// // const fullUrl = basePath ? `${basePath}${url}` : url;
152+
153+
// // if (resourceType === 'script') {
154+
// // if (document.querySelector(`script[src*="${fullUrl}"]`) || (checkExists && (window as any)[checkExists])) {
155+
// // handleLoad();
156+
// // return;
157+
// // }
158+
159+
// // if (document.querySelector(`script[src*="${fullUrl}"]`)) {
160+
// // handleLoad();
161+
// // return;
162+
// // }
163+
// // const el = document.createElement('script');
164+
// // el.src = fullUrl;
165+
// // el.async = true;
166+
// // el.onload = () => setTimeout(handleLoad, 0);
167+
// // el.onerror = handleError;
168+
// // document.head.appendChild(el);
169+
// // } else {
170+
// // if (document.querySelector(`link[href*="${fullUrl}"]`)) {
171+
// // handleLoad();
172+
// // return;
173+
// // }
174+
// // const el = document.createElement('link');
175+
// // el.rel = 'stylesheet';
176+
// // el.type = 'text/css';
177+
// // el.href = fullUrl;
178+
// // el.onload = () => setTimeout(handleLoad, 0);
179+
// // el.onerror = handleError;
180+
// // document.head.appendChild(el);
181+
// // }
182+
// // };
183+
184+
// // urls.forEach(createResource);
185+
// // }),
186+
// // {
187+
// // dependencies: {
188+
// // urls,
189+
// // type,
190+
// // basePath: options?.basePath,
191+
// // checkExists: options?.checkExists,
192+
// // },
193+
// // },
194+
// // );
195+
// // }
196+
197+
// async function loadResource(
198+
// t: TestController,
199+
// url: string,
200+
// type: 'script' | 'style',
201+
// options?: LoadOptions,
202+
// ): Promise<void> {
203+
// await t.eval(
204+
// ({
205+
// // eslint-disable-next-line @typescript-eslint/no-shadow
206+
// url, type, basePath, checkExists,
207+
// }) => new Promise<void>((resolve, reject) => {
208+
// const fullUrl = basePath ? `${basePath}${url}` : url;
209+
210+
// if (type === 'script') {
211+
// if (document.querySelector(`script[src*="${fullUrl}"]`) || (checkExists && (window as any)[checkExists])) {
212+
// resolve();
213+
// return;
214+
// }
215+
216+
// const el = document.createElement('script');
217+
// el.src = fullUrl;
218+
// el.async = true;
219+
// el.onload = () => {
220+
// if (checkExists) {
221+
// const interval = setInterval(() => {
222+
// if ((window as any)[checkExists]) {
223+
// clearInterval(interval);
224+
// resolve();
225+
// }
226+
// }, 10);
227+
// } else {
228+
// resolve();
229+
// }
230+
// };
231+
// el.onerror = reject;
232+
// document.head.appendChild(el);
233+
// } else {
234+
// if (document.querySelector(`link[href*="${fullUrl}"]`)) {
235+
// resolve();
236+
// return;
237+
// }
238+
239+
// const el = document.createElement('link');
240+
// el.rel = 'stylesheet';
241+
// el.type = 'text/css';
242+
// el.href = fullUrl;
243+
// // @ts-expect-error ts-error
244+
// el.onload = resolve;
245+
// el.onerror = reject;
246+
// document.head.appendChild(el);
247+
// }
248+
// }),
249+
// {
250+
// dependencies: {
251+
// url, type, basePath: options?.basePath, checkExists: options?.checkExists,
252+
// },
253+
// },
254+
// );
255+
// }
256+
257+
// export async function loadScripts(
258+
// t: TestController,
259+
// script: string,
260+
// options?: LoadOptions,
261+
// ): Promise<void> {
262+
// await loadResource(t, script, 'script', options);
263+
// }
264+
265+
// export async function loadStyles(
266+
// t: TestController,
267+
// style: string,
268+
// options?: LoadOptions,
269+
// ): Promise<void> {
270+
// await loadResource(t, style, 'style', options);
271+
// }

e2e/testcafe-devextreme/runner.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { globSync } from 'glob';
77
import { DEFAULT_BROWSER_SIZE } from './helpers/const';
88
import {
99
clearTestPage,
10+
loadAspNetData,
1011
loadAxeCore,
12+
loadGantt,
13+
loadQuill,
1114
} from './helpers/testPageUtils';
1215
import 'nconf';
1316

@@ -255,6 +258,21 @@ createTestCafe(TESTCAFE_CONFIG)
255258
test: {
256259
before: async (t: TestController) => {
257260
if (!componentFolder.includes('accessibility')) {
261+
// @ts-expect-error ts-errors
262+
const { meta } = t.testRun.test;
263+
264+
if (meta?.loadQuill) {
265+
await loadQuill(t);
266+
}
267+
268+
if (meta?.loadGantt) {
269+
await loadGantt(t);
270+
}
271+
272+
if (meta?.loadAspNetData) {
273+
await loadAspNetData(t);
274+
}
275+
258276
await ClientFunction(() => {
259277
if (document.activeElement && document.activeElement !== document.body) {
260278
(document.activeElement as HTMLElement).blur();
@@ -269,6 +287,10 @@ createTestCafe(TESTCAFE_CONFIG)
269287
await t.resizeWindow(width, height);
270288
} else {
271289
await loadAxeCore(t);
290+
// await loadScripts(t, 'axe.min.js', {
291+
// basePath: '../../../node_modules/axe-core/',
292+
// checkExists: 'axe',
293+
// });
272294
}
273295

274296
if (args.shadowDom) {

e2e/testcafe-devextreme/tests/accessibility/filterBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import FilterBuilder from 'devextreme-testcafe-models/filterBuilder';
22
import { createWidget } from '../../helpers/createWidget';
33
import url from '../../helpers/getPageUrl';
4-
import { fields, filter } from '../filterBuilder/data';
4+
import { fields, filter } from '../common/filterBuilder/data';
55
import { a11yCheck } from '../../helpers/accessibility/utils';
66

77
fixture.disablePageReloads`Filter Builder`

e2e/testcafe-devextreme/tests/accessibility/htmlEditor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const configuration: Configuration = {
4242
a11yCheckConfig,
4343
options,
4444
created,
45+
meta: { loadQuill: true },
4546
};
4647

4748
testAccessibility(configuration);
@@ -77,6 +78,7 @@ const aiConfiguration: Configuration = {
7778
a11yCheckConfig,
7879
options: aiOptions,
7980
created: aiCreated,
81+
meta: { loadQuill: true },
8082
};
8183

8284
testAccessibility(aiConfiguration);

0 commit comments

Comments
 (0)