Skip to content

Commit 74a3f38

Browse files
update etalons
1 parent 038a201 commit 74a3f38

20 files changed

Lines changed: 84 additions & 33 deletions

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
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/"
910
}

e2e/testcafe-devextreme/helpers/clearPage.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const testCafe = require('testcafe');
22

33
module.exports = {
4-
clearTestPage: async function() {
4+
clearTestPage: async function(testController) {
55
const shadowDom = process.env.shadowDom === 'true';
66

7-
await testCafe.ClientFunction(() => {
7+
const clearTestPageFn = testCafe.ClientFunction(() => {
88
const widgetSelector = '.dx-widget';
99
const $elements = $(widgetSelector)
1010
.filter((_, element) => $(element).parents(widgetSelector).length === 0);
@@ -45,6 +45,8 @@ module.exports = {
4545
dependencies: {
4646
shadowDom,
4747
}
48-
})();
48+
});
49+
50+
await clearTestPageFn.with({ boundTestRun: testController })();
4951
}
5052
};

e2e/testcafe-devextreme/runner.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ const TESTCAFE_CONFIG: Partial<TestCafeConfigurationOptions> = {
3131
port2: 1438,
3232
};
3333

34+
const getCurrentTheme = async (t: TestController): Promise<string> => {
35+
const currentTheme = await ClientFunction(() => {
36+
return (window as any).DevExpress.ui.themes.current();
37+
}).with({ boundTestRun: t })();
38+
39+
return currentTheme;
40+
};
41+
3442
const changeTheme = async (t: TestController, themeName: string): Promise<void> => {
3543
const changeThemeClientFn = ClientFunction(() => new Promise<void>((resolve) => {
3644
(window as any).DevExpress.ui.themes.ready(resolve);
@@ -252,12 +260,16 @@ createTestCafe(TESTCAFE_CONFIG)
252260
await addShadowRootTree(t);
253261
}
254262

255-
if (args.theme) {
256-
await changeTheme(t, args.theme);
263+
264+
const currentTheme = await getCurrentTheme(t) || 'generic.light';
265+
const newTheme = args.theme || 'generic.light';
266+
267+
if (currentTheme !== newTheme) {
268+
await changeTheme(t, newTheme);
257269
}
258270
},
259-
after: async () => {
260-
await testPageUtils.clearTestPage();
271+
after: async (t: TestController) => {
272+
await testPageUtils.clearTestPage(t);
261273
},
262274
},
263275
},
31 Bytes
Loading
Loading
-5.18 KB
Loading
Loading
Loading
-133 Bytes
Loading
4 Bytes
Loading

0 commit comments

Comments
 (0)