Skip to content

Commit 8b37695

Browse files
wdevfxalexslavr
authored andcommitted
tests(CI): configure testcafe runner and pipelines
1 parent 8c77f3e commit 8b37695

File tree

11 files changed

+177
-64
lines changed

11 files changed

+177
-64
lines changed

.github/actions/run-qunit-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ runs:
5454
if: ${{ inputs.browser == 'chrome' }}
5555
uses: ./.github/actions/setup-chrome
5656
with:
57-
chrome-version: '121.0.6167.184'
57+
chrome-version: '133.0.6943.53'
5858

5959
- name: Setup Firefox profile
6060
if: ${{ inputs.browser == 'firefox' }}

.github/actions/setup-chrome/action.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,10 @@ runs:
3131
if [ -n "$CHROME_VERSION" ]; then
3232
sudo apt-get update
3333
sudo apt-get -y install libu2f-udev
34-
35-
mkdir google-chrome-setup
36-
pushd google-chrome-setup
37-
npm init -y
38-
npm set //npm.pkg.github.com/:_authToken="${{ github.token }}"
39-
npm i @devexpress/[email protected] --registry=https://npm.pkg.github.com
40-
sudo dpkg -i node_modules/@devexpress/devextreme-google-chrome-image/google-chrome-stable_121.0.6167.184-1_amd64.deb
34+
curl -L "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb" > /tmp/chrome.deb
35+
sudo dpkg -i /tmp/chrome.deb
36+
unlink /tmp/chrome.deb
4137
google-chrome-stable --version
42-
popd
43-
44-
rm -rf google-chrome-setup
4538
else
4639
echo "Skip Chrome upgrade"
47-
fi
40+
fi

.github/workflows/demos_visual_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Setup Chrome
6767
uses: ./.github/actions/setup-chrome
6868
with:
69-
chrome-version: '121.0.6167.184'
69+
chrome-version: '133.0.6943.53'
7070

7171
- name: Use Node.js
7272
uses: actions/setup-node@v4
@@ -124,7 +124,7 @@ jobs:
124124
125125
- name: Sanitize job name
126126
if: ${{ failure() }}
127-
run: echo "JOB_NAME=$(echo "${{ matrix.ARGS.name }}" | tr '/' '-')" >> $GITHUB_ENV
127+
run: echo "JOB_NAME=$(echo "${{ matrix.CONSTEL }}-${{ matrix.THEME }}" | tr '/' '-')" >> $GITHUB_ENV
128128

129129
- name: Copy screenshots artifacts
130130
if: failure() && matrix.STRATEGY == 'screenshots'

.github/workflows/demos_visual_tests_frameworks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ jobs:
303303
- name: Setup Chrome
304304
uses: ./.github/actions/setup-chrome
305305
with:
306-
chrome-version: '121.0.6167.184'
306+
chrome-version: '133.0.6943.53'
307307

308308
- name: Restore npm cache
309309
uses: actions/cache@v4
@@ -385,7 +385,7 @@ jobs:
385385

386386
- name: Sanitize job name
387387
if: ${{ failure() }}
388-
run: echo "JOB_NAME=$(echo "${{ matrix.ARGS.name }}" | tr '/' '-')" >> $GITHUB_ENV
388+
run: echo "JOB_NAME=$(echo "${{ matrix.CONSTEL }}-${{ matrix.THEME }}" | tr '/' '-')" >> $GITHUB_ENV
389389

390390
- name: Copy screenshots artifacts
391391
if: ${{ failure() }}

.github/workflows/playgrounds_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121

2222
runs-on: devextreme-shr2
23-
timeout-minutes: 15
23+
timeout-minutes: 30
2424

2525
steps:
2626
- name: Get sources
@@ -77,7 +77,7 @@ jobs:
7777
- name: Setup Chrome
7878
uses: ./.github/actions/setup-chrome
7979
with:
80-
chrome-version: '121.0.6167.184'
80+
chrome-version: '133.0.6943.53'
8181

8282
- name: Use Node.js
8383
uses: actions/setup-node@v4

.github/workflows/run-testcafe-on-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
- name: Setup Chrome
5151
uses: ./devextreme/.github/actions/setup-chrome
5252
with:
53-
chrome-version: '121.0.6167.184'
53+
chrome-version: '133.0.6943.53'
5454

5555
- name: DevExtreme - Install packages
5656
working-directory: devextreme

.github/workflows/testcafe_tests.yml

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ jobs:
6464
fail-fast: false
6565
matrix:
6666
ARGS: [
67-
{ componentFolder: "accessibility", name: "accessibility (1/5)", indices: "1/5" },
68-
{ componentFolder: "accessibility", name: "accessibility (2/5)", indices: "2/5" },
69-
{ componentFolder: "accessibility", name: "accessibility (3/5)", indices: "3/5" },
70-
{ componentFolder: "accessibility", name: "accessibility (4/5)", indices: "4/5" },
71-
{ componentFolder: "accessibility", name: "accessibility (5/5)", indices: "5/5" },
67+
{ componentFolder: "accessibility", name: "accessibility (1/7)", indices: "1/7" },
68+
{ componentFolder: "accessibility", name: "accessibility (2/7)", indices: "2/7" },
69+
{ componentFolder: "accessibility", name: "accessibility (3/7)", indices: "3/7" },
70+
{ componentFolder: "accessibility", name: "accessibility (4/7)", indices: "4/7" },
71+
{ componentFolder: "accessibility", name: "accessibility (5/7)", indices: "5/7" },
72+
{ componentFolder: "accessibility", name: "accessibility (6/7)", indices: "6/7" },
73+
{ componentFolder: "accessibility", name: "accessibility (7/7)", indices: "7/7" },
7274
{ componentFolder: "accessibility", name: "accessibility - material (1/7)", theme: "material.blue.light", indices: "1/7" },
7375
{ componentFolder: "accessibility", name: "accessibility - material (2/7)", theme: "material.blue.light", indices: "2/7" },
7476
{ componentFolder: "accessibility", name: "accessibility - material (3/7)", theme: "material.blue.light", indices: "3/7" },
@@ -87,32 +89,39 @@ jobs:
8789
{ componentFolder: "common", name: "common - material", theme: 'material.blue.light' },
8890
{ componentFolder: "common", name: "common - fluent", theme: 'fluent.blue.light' },
8991
{ componentFolder: "treeList", name: "treeList", concurrency: 1 },
90-
{ componentFolder: "dataGrid", name: "dataGrid (1/2)", indices: "1/2" },
91-
{ componentFolder: "dataGrid", name: "dataGrid (2/2)", indices: "2/2" },
92+
{ componentFolder: "dataGrid", name: "dataGrid (1/5)", indices: "1/5" },
93+
{ componentFolder: "dataGrid", name: "dataGrid (2/5)", indices: "2/5" },
94+
{ componentFolder: "dataGrid", name: "dataGrid (3/5)", indices: "3/5" },
95+
{ componentFolder: "dataGrid", name: "dataGrid (4/5)", indices: "4/5" },
96+
{ componentFolder: "dataGrid", name: "dataGrid (5/5)", indices: "5/5" },
9297
{ componentFolder: "pivotGrid", name: "pivotGrid", concurrency: 1 },
9398
{ componentFolder: "pivotGrid", name: "pivotGrid - material", theme: 'material.blue.light', concurrency: 1 },
9499
{ componentFolder: "pivotGrid", name: "pivotGrid - fluent", theme: 'fluent.blue.light', concurrency: 1 },
95-
{ componentFolder: "scheduler", name: "scheduler (1/5)", indices: "1/5" },
96-
{ componentFolder: "scheduler", name: "scheduler (2/5)", indices: "2/5" },
97-
{ componentFolder: "scheduler", name: "scheduler (3/5)", indices: "3/5" },
98-
{ componentFolder: "scheduler", name: "scheduler (4/5)", indices: "4/5" },
99-
{ componentFolder: "scheduler", name: "scheduler (5/5)", indices: "5/5" },
100-
{ componentFolder: "scheduler/timezones", name: "scheduler (Europe/Berlin)", timezone: "Europe/Berlin" },
101-
{ componentFolder: "scheduler/timezones", name: "scheduler (America/Los_Angeles)", timezone: "America/Los_Angeles" },
100+
{ componentFolder: "scheduler/common", name: "scheduler / common (1/6)", indices: "1/6" },
101+
{ componentFolder: "scheduler/common", name: "scheduler / common (2/6)", indices: "2/6" },
102+
{ componentFolder: "scheduler/common", name: "scheduler / common (3/6)", indices: "3/6" },
103+
{ componentFolder: "scheduler/common", name: "scheduler / common (4/6)", indices: "4/6" },
104+
{ componentFolder: "scheduler/common", name: "scheduler / common (5/6)", indices: "5/6" },
105+
{ componentFolder: "scheduler/common", name: "scheduler / common (6/6)", indices: "6/6" },
106+
{ componentFolder: "scheduler/viewOffset/common", name: "scheduler / offset" },
107+
{ componentFolder: "scheduler/viewOffset/markup", name: "scheduler / offset markups" },
108+
{ componentFolder: "scheduler/timezones", name: "scheduler / timezones (Europe/Berlin)", timezone: "Europe/Berlin" },
109+
{ componentFolder: "scheduler/timezones", name: "scheduler / timezones (America/Los_Angeles)", timezone: "America/Los_Angeles" },
102110
{ componentFolder: "form", name: "form (1/2)", indices: "1/2" },
103111
{ componentFolder: "form", name: "form (2/2)", indices: "2/2" },
104-
{ componentFolder: "form", name: "form - material (1/4)", theme: 'material.blue.light', indices: "1/4" },
105-
{ componentFolder: "form", name: "form - material (2/4)", theme: 'material.blue.light', indices: "2/4" },
106-
{ componentFolder: "form", name: "form - material (3/4)", theme: 'material.blue.light', indices: "3/4" },
107-
{ componentFolder: "form", name: "form - material (4/4)", theme: 'material.blue.light', indices: "4/4" },
112+
{ componentFolder: "form", name: "form - material (1/2)", theme: 'material.blue.light', indices: "1/2" },
113+
{ componentFolder: "form", name: "form - material (2/2)", theme: 'material.blue.light', indices: "2/2" },
108114
{ componentFolder: "form", name: "form - fluent (1/2)", theme: 'fluent.blue.light', indices: "1/2" },
109115
{ componentFolder: "form", name: "form - fluent (2/2)", theme: 'fluent.blue.light', indices: "2/2" },
110-
{ componentFolder: "editors", name: "editors (1/2)", indices: "1/2" },
111-
{ componentFolder: "editors", name: "editors (2/2)", indices: "2/2" },
112-
{ componentFolder: "editors", name: "editors - material (1/2)", theme: 'material.blue.light', indices: "1/2" },
113-
{ componentFolder: "editors", name: "editors - material (2/2)", theme: 'material.blue.light', indices: "2/2" },
114-
{ componentFolder: "editors", name: "editors - fluent (1/2)", theme: 'fluent.blue.light', indices: "1/2" },
115-
{ componentFolder: "editors", name: "editors - fluent (2/2)", theme: 'fluent.blue.light', indices: "2/2" },
116+
{ componentFolder: "editors", name: "editors (1/3)", indices: "1/3" },
117+
{ componentFolder: "editors", name: "editors (2/3)", indices: "2/3" },
118+
{ componentFolder: "editors", name: "editors (3/3)", indices: "3/3" },
119+
{ componentFolder: "editors", name: "editors - material (1/3)", indices: "1/3", theme: 'material.blue.light' },
120+
{ componentFolder: "editors", name: "editors - material (2/3)", indices: "2/3", theme: 'material.blue.light' },
121+
{ componentFolder: "editors", name: "editors - material (3/3)", indices: "3/3", theme: 'material.blue.light' },
122+
{ componentFolder: "editors", name: "editors - fluent (1/3)", indices: "1/3", theme: 'fluent.blue.light' },
123+
{ componentFolder: "editors", name: "editors - fluent (2/3)", indices: "2/3", theme: 'fluent.blue.light' },
124+
{ componentFolder: "editors", name: "editors - fluent (3/3)", indices: "3/3", theme: 'fluent.blue.light' },
116125
{ componentFolder: "htmlEditor", name: "htmlEditor", concurrency: 1 },
117126
{ componentFolder: "htmlEditor", name: "htmlEditor - material", theme: 'material.blue.light', concurrency: 1 },
118127
{ componentFolder: "htmlEditor", name: "htmlEditor - fluent", theme: 'fluent.blue.light', concurrency: 1 },
@@ -141,7 +150,7 @@ jobs:
141150
- name: Setup Chrome
142151
uses: ./.github/actions/setup-chrome
143152
with:
144-
chrome-version: '121.0.6167.184'
153+
chrome-version: '133.0.6943.53'
145154

146155
- name: Use Node.js
147156
uses: actions/setup-node@v4

.github/workflows/wrapper_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
jobs:
1414
test:
1515
runs-on: devextreme-shr2
16-
timeout-minutes: 30
16+
timeout-minutes: 60
1717

1818
steps:
1919
- name: Get sources

e2e/testcafe-devextreme/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"devDependencies": {
1010
"devextreme": "~24.1.10",
11+
"glob": "^10.4.5",
1112
"testcafe": "2.5.0"
1213
}
1314
}

e2e/testcafe-devextreme/runner.js

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ const createTestCafe = require('testcafe');
55
const fs = require('fs');
66
const process = require('process');
77
const parseArgs = require('minimist');
8+
const { globSync } = require('glob');
89
const testPageUtils = require('./helpers/clearPage');
910
require('nconf').argv();
1011

11-
const changeTheme = async(themeName) => createTestCafe.ClientFunction(() => new Promise((resolve) => {
12+
const changeTheme = async(t, themeName) => createTestCafe.ClientFunction(() => new Promise((resolve) => {
1213
// eslint-disable-next-line no-undef
1314
window.DevExpress.ui.themes.ready(resolve);
1415
// eslint-disable-next-line no-undef
1516
window.DevExpress.ui.themes.current(themeName);
1617
}),
17-
{ dependencies: { themeName } })();
18+
{ dependencies: { themeName } }).with({ boundTestRun: t })();
1819

19-
const addShadowRootTree = async function() {
20+
const addShadowRootTree = async(t) => {
2021
await createTestCafe.ClientFunction(() => {
2122
const root = document.querySelector('#parentContainer');
2223
const childNodes = root.childNodes;
@@ -29,7 +30,7 @@ const addShadowRootTree = async function() {
2930
shadowContainer.append.apply(shadowContainer, Array.from(childNodes));
3031

3132
root.shadowRoot.appendChild(shadowContainer);
32-
})();
33+
}).with({ boundTestRun: t })();
3334
};
3435

3536
let testCafe;
@@ -62,8 +63,9 @@ createTestCafe({
6263
const browsers = args.browsers
6364
.split(' ')
6465
.map((browser) => expandBrowserAlias(browser, args.componentFolder.trim()));
66+
6567
// eslint-disable-next-line no-console
66-
console.log('Browsers:', browsers);
68+
console.info('Browsers:', browsers);
6769

6870
const runner = testCafe.createRunner()
6971
.browsers(browsers)
@@ -78,17 +80,40 @@ createTestCafe({
7880

7981
runner.concurrency(args.concurrency || 3);
8082

83+
const split = (array, chunkCount) => {
84+
const fixturesInChunkCount = Math.ceil(array.length / chunkCount);
85+
const [...arr] = array;
86+
const res = [];
87+
88+
while(arr.length) {
89+
res.push(arr.splice(0, fixturesInChunkCount));
90+
}
91+
92+
return res;
93+
};
94+
8195
const filters = [];
96+
8297
if(indices) {
8398
const [current, total] = indices.split(/_|of|\\|\//ig).map(x => +x);
84-
let testIndex = 0;
85-
filters.push(() => {
86-
const result = (testIndex % total) === (current - 1);
87-
testIndex += 1;
88-
return result;
89-
99+
const fixtures = globSync([`./tests/${componentFolder}/*.ts`]);
100+
const fixtureChunks = split(fixtures, total);
101+
const targetFixtureChunk = fixtureChunks[current - 1] ?? [];
102+
103+
/* eslint-disable no-console */
104+
console.info(' === test run config ===');
105+
console.info(` > indices: current = ${current} | total = ${total}`);
106+
console.info(' > glob: ', [`./tests/${componentFolder}/*.ts`]);
107+
console.info(' > all fixtures: ', fixtureChunks);
108+
console.info(' > fixtures: ', targetFixtureChunk, '\n');
109+
/* eslint-enable no-console */
110+
111+
filters.push((testName, fixtureName, fixturePath) => {
112+
// TODO: improve performance
113+
return targetFixtureChunk.some((path) => fixturePath.includes(path));
90114
});
91115
}
116+
92117
if(testName) {
93118
filters.push(name => name === testName);
94119
}
@@ -117,13 +142,16 @@ createTestCafe({
117142

118143
runOptions.hooks = {
119144
test: {
120-
before: async() => {
145+
before: async(t) => {
146+
// TODO: Move to a single const (look at restoreBrowserSize helper module)
147+
await t.resizeWindow(1200, 800);
148+
121149
if(args.shadowDom) {
122-
await addShadowRootTree();
150+
await addShadowRootTree(t);
123151
}
124152

125153
if(args.theme) {
126-
await changeTheme(args.theme);
154+
await changeTheme(t, args.theme);
127155
}
128156
},
129157
after: async() => {
@@ -158,7 +186,7 @@ function setShadowDom(args) {
158186
function expandBrowserAlias(browser, componentFolder) {
159187
switch(browser) {
160188
case 'chrome:devextreme-shr2':
161-
return 'chrome:headless --disable-gpu --window-size=1200,800';
189+
return 'chrome:headless --no-sandbox --disable-gpu --window-size=1200,800 --disable-partial-raster --disable-skia-runtime-opts --run-all-compositor-stages-before-draw --disable-new-content-rendering-timeout --disable-threaded-animation --disable-threaded-scrolling --disable-checker-imaging --disable-image-animation-resync --use-gl="swiftshader" --disable-features=PaintHolding --js-flags=--random-seed=2147483647 --font-render-hinting=none --disable-font-subpixel-positioning';
162190
case 'chrome:docker':
163191
return 'chromium:headless --no-sandbox --disable-gpu --window-size=1200,800';
164192
}

0 commit comments

Comments
 (0)