@playwright/test 1.37.0-alpha-aug-5-2023 → 1.37.0-alpha-aug-6-2023
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StringInternPool = void 0;
|
|
6
|
+
exports.StringInternPool = exports.JsonStringInternalizer = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Copyright (c) Microsoft Corporation.
|
|
9
9
|
*
|
|
@@ -33,4 +33,26 @@ class StringInternPool {
|
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
exports.StringInternPool = StringInternPool;
|
|
36
|
+
exports.StringInternPool = StringInternPool;
|
|
37
|
+
class JsonStringInternalizer {
|
|
38
|
+
constructor(pool) {
|
|
39
|
+
this._pool = void 0;
|
|
40
|
+
this._pool = pool;
|
|
41
|
+
}
|
|
42
|
+
traverse(value) {
|
|
43
|
+
if (typeof value !== 'object') return;
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
for (let i = 0; i < value.length; i++) {
|
|
46
|
+
if (typeof value[i] === 'string') value[i] = this.intern(value[i]);else this.traverse(value[i]);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
for (const name in value) {
|
|
50
|
+
if (typeof value[name] === 'string') value[name] = this.intern(value[name]);else this.traverse(value[name]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
intern(value) {
|
|
55
|
+
return this._pool.internString(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.JsonStringInternalizer = JsonStringInternalizer;
|
|
@@ -27,9 +27,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const DEFAULT_ENVIRONMENT_VARIABLES = {
|
|
30
|
-
'BROWSER': 'none'
|
|
30
|
+
'BROWSER': 'none',
|
|
31
|
+
// Disable that create-react-app will open the page in the browser
|
|
32
|
+
'FORCE_COLOR': '1',
|
|
33
|
+
'DEBUG_COLORS': '1'
|
|
31
34
|
};
|
|
32
|
-
|
|
33
35
|
const debugWebServer = (0, _utilsBundle.debug)('pw:webserver');
|
|
34
36
|
class WebServerPlugin {
|
|
35
37
|
constructor(options, checkPortOnly) {
|
|
@@ -97,11 +99,12 @@ class WebServerPlugin {
|
|
|
97
99
|
debugWebServer(`Process started`);
|
|
98
100
|
launchedProcess.stderr.on('data', line => {
|
|
99
101
|
var _onStdErr, _ref;
|
|
100
|
-
if (debugWebServer.enabled || this._options.stderr === 'pipe' || !this._options.stderr) (_onStdErr = (_ref = this._reporter).onStdErr) === null || _onStdErr === void 0 ? void 0 : _onStdErr.call(_ref, '[WebServer] ' + line.toString());
|
|
102
|
+
if (debugWebServer.enabled || this._options.stderr === 'pipe' || !this._options.stderr) (_onStdErr = (_ref = this._reporter).onStdErr) === null || _onStdErr === void 0 ? void 0 : _onStdErr.call(_ref, _utilsBundle.colors.dim('[WebServer] ') + line.toString());
|
|
101
103
|
});
|
|
102
104
|
launchedProcess.stdout.on('data', line => {
|
|
103
105
|
var _onStdOut, _ref2;
|
|
104
|
-
|
|
106
|
+
process.stdout.write(line);
|
|
107
|
+
if (debugWebServer.enabled || this._options.stdout === 'pipe') (_onStdOut = (_ref2 = this._reporter).onStdOut) === null || _onStdOut === void 0 ? void 0 : _onStdOut.call(_ref2, _utilsBundle.colors.dim('[WebServer] ') + line.toString());
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
async _waitForProcess() {
|
package/lib/reporters/merge.js
CHANGED
|
@@ -62,11 +62,12 @@ function patchAttachmentPaths(events, resourceDir) {
|
|
|
62
62
|
function parseEvents(reportJsonl) {
|
|
63
63
|
return reportJsonl.toString().split('\n').filter(line => line.length).map(line => JSON.parse(line));
|
|
64
64
|
}
|
|
65
|
-
async function extractAndParseReports(dir, shardFiles, printStatus) {
|
|
65
|
+
async function extractAndParseReports(dir, shardFiles, stringPool, printStatus) {
|
|
66
66
|
const shardEvents = [];
|
|
67
67
|
await _fs.default.promises.mkdir(_path.default.join(dir, 'resources'), {
|
|
68
68
|
recursive: true
|
|
69
69
|
});
|
|
70
|
+
const internalizer = new _stringInternPool.JsonStringInternalizer(stringPool);
|
|
70
71
|
for (const file of shardFiles) {
|
|
71
72
|
const absolutePath = _path.default.join(dir, file);
|
|
72
73
|
printStatus(`extracting: ${(0, _util.relativeFilePath)(absolutePath)}`);
|
|
@@ -76,6 +77,10 @@ async function extractAndParseReports(dir, shardFiles, printStatus) {
|
|
|
76
77
|
const content = await zipFile.read(entryName);
|
|
77
78
|
if (entryName.endsWith('.jsonl')) {
|
|
78
79
|
const parsedEvents = parseEvents(content);
|
|
80
|
+
// Passing reviver to JSON.parse doesn't work, as the original strings
|
|
81
|
+
// keep beeing used. To work around that we traverse the parsed events
|
|
82
|
+
// as a post-processing step.
|
|
83
|
+
internalizer.traverse(parsedEvents);
|
|
79
84
|
shardEvents.push({
|
|
80
85
|
metadata: findMetadata(parsedEvents, file),
|
|
81
86
|
parsedEvents
|
|
@@ -101,7 +106,8 @@ async function mergeEvents(dir, shardReportFiles, printStatus) {
|
|
|
101
106
|
const configureEvents = [];
|
|
102
107
|
const beginEvents = [];
|
|
103
108
|
const endEvents = [];
|
|
104
|
-
const
|
|
109
|
+
const stringPool = new _stringInternPool.StringInternPool();
|
|
110
|
+
const shardEvents = await extractAndParseReports(dir, shardReportFiles, stringPool, printStatus);
|
|
105
111
|
shardEvents.sort((a, b) => {
|
|
106
112
|
var _a$metadata$shard$cur, _a$metadata$shard, _b$metadata$shard$cur, _b$metadata$shard;
|
|
107
113
|
const shardA = (_a$metadata$shard$cur = (_a$metadata$shard = a.metadata.shard) === null || _a$metadata$shard === void 0 ? void 0 : _a$metadata$shard.current) !== null && _a$metadata$shard$cur !== void 0 ? _a$metadata$shard$cur : 0;
|
|
@@ -114,7 +120,7 @@ async function mergeEvents(dir, shardReportFiles, printStatus) {
|
|
|
114
120
|
parsedEvents
|
|
115
121
|
} of shardEvents) {
|
|
116
122
|
for (const event of parsedEvents) {
|
|
117
|
-
if (event.method === 'onConfigure') configureEvents.push(event);else if (event.method === 'onBegin') beginEvents.push(event);else if (event.method === 'onEnd') endEvents.push(event);else if (event.method === 'onBlobReportMetadata') new ProjectNamePatcher(allTestIds, event.params.projectSuffix || '').patchEvents(parsedEvents);else events.push(event);
|
|
123
|
+
if (event.method === 'onConfigure') configureEvents.push(event);else if (event.method === 'onBegin') beginEvents.push(event);else if (event.method === 'onEnd') endEvents.push(event);else if (event.method === 'onBlobReportMetadata') new ProjectNamePatcher(allTestIds, stringPool, event.params.projectSuffix || '').patchEvents(parsedEvents);else events.push(event);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
return [mergeConfigureEvents(configureEvents), mergeBeginEvents(beginEvents), ...events, mergeEndEvents(endEvents), {
|
|
@@ -208,10 +214,10 @@ function printStatusToStdout(message) {
|
|
|
208
214
|
process.stdout.write(`${message}\n`);
|
|
209
215
|
}
|
|
210
216
|
class ProjectNamePatcher {
|
|
211
|
-
constructor(_allTestIds, _projectNameSuffix) {
|
|
217
|
+
constructor(_allTestIds, _stringPool, _projectNameSuffix) {
|
|
212
218
|
this._testIds = new Set();
|
|
213
|
-
this._stringPool = new _stringInternPool.StringInternPool();
|
|
214
219
|
this._allTestIds = _allTestIds;
|
|
220
|
+
this._stringPool = _stringPool;
|
|
215
221
|
this._projectNameSuffix = _projectNameSuffix;
|
|
216
222
|
}
|
|
217
223
|
patchEvents(events) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.37.0-alpha-aug-
|
|
3
|
+
"version": "1.37.0-alpha-aug-6-2023",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node": "*",
|
|
44
|
-
"playwright-core": "1.37.0-alpha-aug-
|
|
44
|
+
"playwright-core": "1.37.0-alpha-aug-6-2023"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"fsevents": "2.3.2"
|