Skip to content

Commit f849ba7

Browse files
try distribution by tests
1 parent 58d0914 commit f849ba7

File tree

2 files changed

+34
-45
lines changed

2 files changed

+34
-45
lines changed

.github/workflows/testcafe_tests.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
shell: bash
5555
run: |
5656
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
57-
pnpm config set network-concurrency 16
5857
5958
- uses: actions/cache@v4
6059
name: Setup pnpm cache
@@ -73,7 +72,7 @@ jobs:
7372
shell: bash
7473
env:
7574
NODE_OPTIONS: --max-old-space-size=8192
76-
run: pnpx nx build devextreme
75+
run: pnpx nx build devextreme --uglify
7776

7877
- name: Zip artifacts
7978
working-directory: ./packages/devextreme
@@ -105,11 +104,12 @@ jobs:
105104
{ componentFolder: "cardView", name: "cardView" },
106105

107106
# Scheduler tests need to be reworked to work in fluent theme
108-
{ componentFolder: "scheduler/common", name: "scheduler / common (1/5)", indices: "1/5", theme: 'generic.light' },
109-
{ componentFolder: "scheduler/common", name: "scheduler / common (2/5)", indices: "2/5", theme: 'generic.light' },
110-
{ componentFolder: "scheduler/common", name: "scheduler / common (3/5)", indices: "3/5", theme: 'generic.light' },
111-
{ componentFolder: "scheduler/common", name: "scheduler / common (4/5)", indices: "4/5", theme: 'generic.light' },
112-
{ componentFolder: "scheduler/common", name: "scheduler / common (5/5)", indices: "5/5", theme: 'generic.light' },
107+
{ componentFolder: "scheduler/common", name: "scheduler / common (1/6)", indices: "1/6", theme: 'generic.light' },
108+
{ componentFolder: "scheduler/common", name: "scheduler / common (2/6)", indices: "2/6", theme: 'generic.light' },
109+
{ componentFolder: "scheduler/common", name: "scheduler / common (3/6)", indices: "3/6", theme: 'generic.light' },
110+
{ componentFolder: "scheduler/common", name: "scheduler / common (4/6)", indices: "4/6", theme: 'generic.light' },
111+
{ componentFolder: "scheduler/common", name: "scheduler / common (5/6)", indices: "5/6", theme: 'generic.light' },
112+
{ componentFolder: "scheduler/common", name: "scheduler / common (6/6)", indices: "6/6", theme: 'generic.light' },
113113
{ componentFolder: "scheduler/viewOffset/common", name: "scheduler / offset", theme: 'generic.light' },
114114
{ componentFolder: "scheduler/viewOffset/markup", name: "scheduler / offset markups", theme: 'generic.light' },
115115
{ componentFolder: "scheduler/timezones", name: "scheduler / timezones (Europe/Berlin)", timezone: "Europe/Berlin", theme: 'generic.light' },
@@ -158,10 +158,9 @@ jobs:
158158
shell: bash
159159
run: |
160160
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
161-
pnpm config set network-concurrency 16
162161
163-
- uses: actions/cache@v4
164-
name: Setup pnpm cache
162+
- uses: actions/cache/restore@v4
163+
name: Restore pnpm cache
165164
with:
166165
path: |
167166
${{ env.STORE_PATH }}

e2e/testcafe-devextreme/runner.ts

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import createTestCafe, { ClientFunction } from 'testcafe';
33
import * as fs from 'fs';
44
import * as process from 'process';
55
import parseArgs from 'minimist';
6-
import { globSync } from 'glob';
76
import { DEFAULT_BROWSER_SIZE } from './helpers/const';
87
import {
98
addShadowRootTree,
@@ -119,18 +118,6 @@ function getArgs(): ParsedArgs {
119118
}) as ParsedArgs;
120119
}
121120

122-
const split = <T>(array: T[], chunkCount: number): T[][] => {
123-
const fixturesInChunkCount = Math.ceil(array.length / chunkCount);
124-
const arr = [...array];
125-
const res: T[][] = [];
126-
127-
while (arr.length) {
128-
res.push(arr.splice(0, fixturesInChunkCount));
129-
}
130-
131-
return res;
132-
};
133-
134121
async function main() {
135122
let testCafe: Awaited<ReturnType<typeof createTestCafe>> | null = null;
136123

@@ -175,34 +162,26 @@ async function main() {
175162
},
176163
});
177164

178-
runner.concurrency(filterByFailedTests ? 1 : (args.concurrency || 4));
165+
runner.concurrency(filterByFailedTests ? 1 : (args.concurrency || 5));
179166

180167
const filters: FilterFunction[] = [];
181168

182-
if (indices) {
169+
if (indices && !filterByFailedTests) {
183170
const [current, total] = indices.split(/_|of|\\|\//ig).map((x) => +x);
184-
const fixtures = globSync([`./tests/${componentFolder}/*.ts`]);
185-
const fixtureChunks = split(fixtures, total);
186-
const targetFixtureChunk = fixtureChunks[current - 1] ?? [];
187-
const targetFixtureChunkSet = new Set(targetFixtureChunk);
188171

189-
if (!filterByFailedTests) {
190-
/* eslint-disable no-console */
191-
console.info(' === test run config ===');
192-
console.info(` > indices: current = ${current} | total = ${total}`);
193-
console.info(' > glob: ', [`./tests/${componentFolder}/*.ts`]);
194-
console.info(' > all fixtures: ', fixtureChunks);
195-
console.info(' > fixtures: ', targetFixtureChunk, '\n');
196-
/* eslint-enable no-console */
197-
}
172+
/* eslint-disable no-console */
173+
console.info(' === test run config ===');
174+
console.info(` > indices: current = ${current} | total = ${total}`);
175+
console.info(' > strategy: round-robin by test (not by file)');
176+
console.info(' > glob: ', [`./tests/${componentFolder}/*.ts`]);
177+
console.info('\n');
178+
/* eslint-enable no-console */
198179

199-
filters.push((
200-
_testName: string,
201-
_fixtureName: string,
202-
fixturePath: string,
203-
) => {
204-
const testPath = fixturePath.split('/testcafe-devextreme/')[1];
205-
return targetFixtureChunkSet.has(testPath);
180+
let globalTestIndex = 0;
181+
filters.push(() => {
182+
globalTestIndex += 1;
183+
const testChunk = ((globalTestIndex - 1) % total) + 1;
184+
return testChunk === current;
206185
});
207186
}
208187

@@ -211,6 +190,16 @@ async function main() {
211190
}
212191

213192
if (filterByFailedTests && failedTests.size > 0) {
193+
/* eslint-disable no-console */
194+
console.info('='.repeat(60));
195+
console.info('RETRY FILTER CONFIGURATION');
196+
console.info(`Failed tests to retry: ${failedTests.size}`);
197+
console.info('Test names:');
198+
failedTests.forEach((name) => console.info(` - ${name}`));
199+
console.info('='.repeat(60));
200+
console.info('\n');
201+
/* eslint-enable no-console */
202+
214203
filters.push((name: string) => failedTests.has(name));
215204
}
216205

@@ -328,6 +317,7 @@ async function main() {
328317

329318
isRetryRun = true;
330319
const retryRunner = createRunner(true);
320+
331321
failedCount = await retry(
332322
() => retryRunner.run(runOptions),
333323
LAUNCH_RETRY_ATTEMPTS,

0 commit comments

Comments
 (0)