@playwright/test 1.32.0 → 1.32.1-beta-1679716636000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/isomorphic/teleReceiver.js +24 -14
- package/lib/reporters/base.js +1 -0
- package/lib/reporters/list.js +5 -2
- package/lib/runner/uiMode.js +64 -57
- package/package.json +2 -2
|
@@ -70,7 +70,6 @@ class TeleReporterReceiver {
|
|
|
70
70
|
}
|
|
71
71
|
_onBegin(config, projects) {
|
|
72
72
|
var _this$_reporter$onBeg, _this$_reporter;
|
|
73
|
-
const removeMissing = config.listOnly;
|
|
74
73
|
for (const project of projects) {
|
|
75
74
|
let projectSuite = this._rootSuite.suites.find(suite => suite.project().id === project.id);
|
|
76
75
|
if (!projectSuite) {
|
|
@@ -80,7 +79,23 @@ class TeleReporterReceiver {
|
|
|
80
79
|
}
|
|
81
80
|
const p = this._parseProject(project);
|
|
82
81
|
projectSuite.project = () => p;
|
|
83
|
-
this._mergeSuitesInto(project.suites, projectSuite
|
|
82
|
+
this._mergeSuitesInto(project.suites, projectSuite);
|
|
83
|
+
|
|
84
|
+
// Remove deleted tests when listing. Empty suites will be auto-filtered
|
|
85
|
+
// in the UI layer.
|
|
86
|
+
if (config.listOnly) {
|
|
87
|
+
const testIds = new Set();
|
|
88
|
+
const collectIds = suite => {
|
|
89
|
+
suite.tests.map(t => t.testId).forEach(testId => testIds.add(testId));
|
|
90
|
+
suite.suites.forEach(collectIds);
|
|
91
|
+
};
|
|
92
|
+
project.suites.forEach(collectIds);
|
|
93
|
+
const filterTests = suite => {
|
|
94
|
+
suite.tests = suite.tests.filter(t => testIds.has(t.id));
|
|
95
|
+
suite.suites.forEach(filterTests);
|
|
96
|
+
};
|
|
97
|
+
filterTests(projectSuite);
|
|
98
|
+
}
|
|
84
99
|
}
|
|
85
100
|
(_this$_reporter$onBeg = (_this$_reporter = this._reporter).onBegin) === null || _this$_reporter$onBeg === void 0 ? void 0 : _this$_reporter$onBeg.call(_this$_reporter, this._parseConfig(config), this._rootSuite);
|
|
86
101
|
}
|
|
@@ -92,6 +107,7 @@ class TeleReporterReceiver {
|
|
|
92
107
|
testResult.workerIndex = payload.workerIndex;
|
|
93
108
|
testResult.parallelIndex = payload.parallelIndex;
|
|
94
109
|
testResult.startTime = new Date(payload.startTime);
|
|
110
|
+
testResult.statusEx = 'running';
|
|
95
111
|
(_this$_reporter$onTes = (_this$_reporter2 = this._reporter).onTestBegin) === null || _this$_reporter$onTes === void 0 ? void 0 : _this$_reporter$onTes.call(_this$_reporter2, test, testResult);
|
|
96
112
|
}
|
|
97
113
|
_onTestEnd(testId, payload) {
|
|
@@ -100,6 +116,7 @@ class TeleReporterReceiver {
|
|
|
100
116
|
const result = test.resultsMap.get(payload.id);
|
|
101
117
|
result.duration = payload.duration;
|
|
102
118
|
result.status = payload.status;
|
|
119
|
+
result.statusEx = payload.status;
|
|
103
120
|
result.errors = payload.errors;
|
|
104
121
|
result.attachments = payload.attachments;
|
|
105
122
|
(_this$_reporter$onTes2 = (_this$_reporter3 = this._reporter).onTestEnd) === null || _this$_reporter$onTes2 === void 0 ? void 0 : _this$_reporter$onTes2.call(_this$_reporter3, test, result);
|
|
@@ -174,7 +191,7 @@ class TeleReporterReceiver {
|
|
|
174
191
|
use: {}
|
|
175
192
|
};
|
|
176
193
|
}
|
|
177
|
-
_mergeSuitesInto(jsonSuites, parent
|
|
194
|
+
_mergeSuitesInto(jsonSuites, parent) {
|
|
178
195
|
for (const jsonSuite of jsonSuites) {
|
|
179
196
|
let targetSuite = parent.suites.find(s => s.title === jsonSuite.title);
|
|
180
197
|
if (!targetSuite) {
|
|
@@ -185,15 +202,11 @@ class TeleReporterReceiver {
|
|
|
185
202
|
targetSuite.location = jsonSuite.location;
|
|
186
203
|
targetSuite._fileId = jsonSuite.fileId;
|
|
187
204
|
targetSuite._parallelMode = jsonSuite.parallelMode;
|
|
188
|
-
this._mergeSuitesInto(jsonSuite.suites, targetSuite
|
|
189
|
-
this._mergeTestsInto(jsonSuite.tests, targetSuite
|
|
190
|
-
}
|
|
191
|
-
if (removeMissing) {
|
|
192
|
-
const suiteMap = new Map(parent.suites.map(p => [p.title, p]));
|
|
193
|
-
parent.suites = jsonSuites.map(s => suiteMap.get(s.title)).filter(Boolean);
|
|
205
|
+
this._mergeSuitesInto(jsonSuite.suites, targetSuite);
|
|
206
|
+
this._mergeTestsInto(jsonSuite.tests, targetSuite);
|
|
194
207
|
}
|
|
195
208
|
}
|
|
196
|
-
_mergeTestsInto(jsonTests, parent
|
|
209
|
+
_mergeTestsInto(jsonTests, parent) {
|
|
197
210
|
for (const jsonTest of jsonTests) {
|
|
198
211
|
let targetTest = parent.tests.find(s => s.title === jsonTest.title);
|
|
199
212
|
if (!targetTest) {
|
|
@@ -204,10 +217,6 @@ class TeleReporterReceiver {
|
|
|
204
217
|
}
|
|
205
218
|
this._updateTest(jsonTest, targetTest);
|
|
206
219
|
}
|
|
207
|
-
if (removeMissing) {
|
|
208
|
-
const testMap = new Map(parent.tests.map(p => [p.title, p]));
|
|
209
|
-
parent.tests = jsonTests.map(s => testMap.get(s.title)).filter(Boolean);
|
|
210
|
-
}
|
|
211
220
|
}
|
|
212
221
|
_updateTest(payload, test) {
|
|
213
222
|
test.id = payload.testId;
|
|
@@ -307,6 +316,7 @@ class TeleTestCase {
|
|
|
307
316
|
stderr: [],
|
|
308
317
|
attachments: [],
|
|
309
318
|
status: 'skipped',
|
|
319
|
+
statusEx: 'scheduled',
|
|
310
320
|
steps: [],
|
|
311
321
|
errors: [],
|
|
312
322
|
stepMap: new Map(),
|
package/lib/reporters/base.js
CHANGED
|
@@ -108,6 +108,7 @@ class BaseReporter {
|
|
|
108
108
|
generateStartingMessage() {
|
|
109
109
|
const jobs = Math.min(this.config.workers, this.config._internal.maxConcurrentTestGroups);
|
|
110
110
|
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
|
|
111
|
+
if (!this.totalTestCount) return '';
|
|
111
112
|
return '\n' + _utilsBundle.colors.dim('Running ') + this.totalTestCount + _utilsBundle.colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + _utilsBundle.colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
|
|
112
113
|
}
|
|
113
114
|
getSlowTests() {
|
package/lib/reporters/list.js
CHANGED
|
@@ -48,8 +48,11 @@ class ListReporter extends _base.BaseReporter {
|
|
|
48
48
|
}
|
|
49
49
|
onBegin(config, suite) {
|
|
50
50
|
super.onBegin(config, suite);
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const startingMessage = this.generateStartingMessage();
|
|
52
|
+
if (startingMessage) {
|
|
53
|
+
console.log(startingMessage);
|
|
54
|
+
console.log();
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
onTestBegin(test, result) {
|
|
55
58
|
if (this._liveTerminal) this._maybeWriteNewLine();
|
package/lib/runner/uiMode.js
CHANGED
|
@@ -12,6 +12,8 @@ var _teleEmitter = require("../reporters/teleEmitter");
|
|
|
12
12
|
var _reporters = require("./reporters");
|
|
13
13
|
var _tasks = require("./tasks");
|
|
14
14
|
var _utilsBundle = require("../utilsBundle");
|
|
15
|
+
var _list = _interopRequireDefault(require("../reporters/list"));
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
/**
|
|
16
18
|
* Copyright Microsoft Corporation. All rights reserved.
|
|
17
19
|
*
|
|
@@ -34,6 +36,7 @@ class UIMode {
|
|
|
34
36
|
this._page = void 0;
|
|
35
37
|
this._testRun = void 0;
|
|
36
38
|
this.globalCleanup = void 0;
|
|
39
|
+
this._globalWatcher = void 0;
|
|
37
40
|
this._testWatcher = void 0;
|
|
38
41
|
this._originalStderr = void 0;
|
|
39
42
|
this._config = config;
|
|
@@ -53,28 +56,22 @@ class UIMode {
|
|
|
53
56
|
sources: false
|
|
54
57
|
};
|
|
55
58
|
this._originalStderr = process.stderr.write.bind(process.stderr);
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
coalescingTimer = setTimeout(() => {
|
|
69
|
-
this._dispatchEvent({
|
|
70
|
-
method: 'listChanged'
|
|
71
|
-
});
|
|
72
|
-
}, 200);
|
|
59
|
+
this._globalWatcher = new Watcher('deep', () => this._dispatchEvent({
|
|
60
|
+
method: 'listChanged'
|
|
61
|
+
}));
|
|
62
|
+
this._testWatcher = new Watcher('flat', events => {
|
|
63
|
+
const collector = new Set();
|
|
64
|
+
events.forEach(f => (0, _compilationCache.collectAffectedTestFiles)(f.file, collector));
|
|
65
|
+
this._dispatchEvent({
|
|
66
|
+
method: 'testFilesChanged',
|
|
67
|
+
params: {
|
|
68
|
+
testFileNames: [...collector]
|
|
69
|
+
}
|
|
70
|
+
});
|
|
73
71
|
});
|
|
74
|
-
return watcher;
|
|
75
72
|
}
|
|
76
73
|
async runGlobalSetup() {
|
|
77
|
-
const reporter =
|
|
74
|
+
const reporter = new _multiplexer.Multiplexer([new _list.default()]);
|
|
78
75
|
const taskRunner = (0, _tasks.createTaskRunnerForWatchSetup)(this._config, reporter);
|
|
79
76
|
reporter.onConfigure(this._config);
|
|
80
77
|
const context = {
|
|
@@ -86,6 +83,9 @@ class UIMode {
|
|
|
86
83
|
status,
|
|
87
84
|
cleanup: globalCleanup
|
|
88
85
|
} = await taskRunner.runDeferCleanup(context, 0);
|
|
86
|
+
await reporter.onExit({
|
|
87
|
+
status
|
|
88
|
+
});
|
|
89
89
|
if (status !== 'passed') {
|
|
90
90
|
await globalCleanup();
|
|
91
91
|
return status;
|
|
@@ -172,9 +172,12 @@ class UIMode {
|
|
|
172
172
|
(0, _compilationCache.clearCompilationCache)();
|
|
173
173
|
reporter.onConfigure(this._config);
|
|
174
174
|
const status = await taskRunner.run(context, 0);
|
|
175
|
-
reporter.onExit({
|
|
175
|
+
await reporter.onExit({
|
|
176
176
|
status
|
|
177
177
|
});
|
|
178
|
+
const projectDirs = new Set();
|
|
179
|
+
for (const p of this._config.projects) projectDirs.add(p.testDir);
|
|
180
|
+
this._globalWatcher.update([...projectDirs], false);
|
|
178
181
|
}
|
|
179
182
|
async _runTests(testIds) {
|
|
180
183
|
await this._stopTests();
|
|
@@ -212,43 +215,7 @@ class UIMode {
|
|
|
212
215
|
files.add(fileName);
|
|
213
216
|
(0, _compilationCache.dependenciesForTestFile)(fileName).forEach(file => files.add(file));
|
|
214
217
|
}
|
|
215
|
-
|
|
216
|
-
if (this._testWatcher && JSON.stringify(this._testWatcher.watchedFiles) === JSON.stringify(watchedFiles)) return;
|
|
217
|
-
if (this._testWatcher) {
|
|
218
|
-
if (this._testWatcher.collector.size) this._dispatchEvent({
|
|
219
|
-
method: 'filesChanged',
|
|
220
|
-
params: {
|
|
221
|
-
fileNames: [...this._testWatcher.collector]
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
clearTimeout(this._testWatcher.timer);
|
|
225
|
-
this._testWatcher.watcher.close().then(() => {});
|
|
226
|
-
this._testWatcher = undefined;
|
|
227
|
-
}
|
|
228
|
-
if (!watchedFiles.length) return;
|
|
229
|
-
const collector = new Set();
|
|
230
|
-
const watcher = _utilsBundle.chokidar.watch(watchedFiles, {
|
|
231
|
-
ignoreInitial: true
|
|
232
|
-
}).on('all', async (event, file) => {
|
|
233
|
-
if (event !== 'add' && event !== 'change') return;
|
|
234
|
-
(0, _compilationCache.collectAffectedTestFiles)(file, collector);
|
|
235
|
-
if (this._testWatcher.timer) clearTimeout(this._testWatcher.timer);
|
|
236
|
-
this._testWatcher.timer = setTimeout(() => {
|
|
237
|
-
const fileNames = [...collector];
|
|
238
|
-
collector.clear();
|
|
239
|
-
this._dispatchEvent({
|
|
240
|
-
method: 'filesChanged',
|
|
241
|
-
params: {
|
|
242
|
-
fileNames
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}, 250);
|
|
246
|
-
});
|
|
247
|
-
this._testWatcher = {
|
|
248
|
-
watcher,
|
|
249
|
-
watchedFiles,
|
|
250
|
-
collector
|
|
251
|
-
};
|
|
218
|
+
this._testWatcher.update([...files], true);
|
|
252
219
|
}
|
|
253
220
|
async _stopTests() {
|
|
254
221
|
var _this$_testRun, _this$_testRun$stop, _this$_testRun2;
|
|
@@ -276,4 +243,44 @@ function chunkToPayload(type, chunk) {
|
|
|
276
243
|
type,
|
|
277
244
|
text: chunk
|
|
278
245
|
};
|
|
246
|
+
}
|
|
247
|
+
class Watcher {
|
|
248
|
+
constructor(mode, onChange) {
|
|
249
|
+
this._onChange = void 0;
|
|
250
|
+
this._watchedFiles = [];
|
|
251
|
+
this._collector = [];
|
|
252
|
+
this._fsWatcher = void 0;
|
|
253
|
+
this._throttleTimer = void 0;
|
|
254
|
+
this._mode = void 0;
|
|
255
|
+
this._mode = mode;
|
|
256
|
+
this._onChange = onChange;
|
|
257
|
+
}
|
|
258
|
+
update(watchedFiles, reportPending) {
|
|
259
|
+
var _this$_fsWatcher;
|
|
260
|
+
if (JSON.stringify(this._watchedFiles) === JSON.stringify(watchedFiles)) return;
|
|
261
|
+
if (reportPending) this._reportEventsIfAny();
|
|
262
|
+
this._watchedFiles = watchedFiles;
|
|
263
|
+
(_this$_fsWatcher = this._fsWatcher) === null || _this$_fsWatcher === void 0 ? void 0 : _this$_fsWatcher.close().then(() => {});
|
|
264
|
+
this._fsWatcher = undefined;
|
|
265
|
+
this._collector.length = 0;
|
|
266
|
+
clearTimeout(this._throttleTimer);
|
|
267
|
+
this._throttleTimer = undefined;
|
|
268
|
+
if (!this._watchedFiles.length) return;
|
|
269
|
+
this._fsWatcher = _utilsBundle.chokidar.watch(watchedFiles, {
|
|
270
|
+
ignoreInitial: true
|
|
271
|
+
}).on('all', async (event, file) => {
|
|
272
|
+
if (this._throttleTimer) clearTimeout(this._throttleTimer);
|
|
273
|
+
if (this._mode === 'flat' && event !== 'add' && event !== 'change') return;
|
|
274
|
+
if (this._mode === 'deep' && event !== 'add' && event !== 'change' && event !== 'unlink' && event !== 'addDir' && event !== 'unlinkDir') return;
|
|
275
|
+
this._collector.push({
|
|
276
|
+
event,
|
|
277
|
+
file
|
|
278
|
+
});
|
|
279
|
+
this._throttleTimer = setTimeout(() => this._reportEventsIfAny(), 250);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
_reportEventsIfAny() {
|
|
283
|
+
if (this._collector.length) this._onChange(this._collector.slice());
|
|
284
|
+
this._collector.length = 0;
|
|
285
|
+
}
|
|
279
286
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.1-beta-1679716636000",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@types/node": "*",
|
|
37
|
-
"playwright-core": "1.32.
|
|
37
|
+
"playwright-core": "1.32.1-beta-1679716636000"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
40
|
"fsevents": "2.3.2"
|