screenshot/test_1
This commit is contained in:
72
node_modules/playwright/lib/isomorphic/events.js
generated
vendored
Normal file
72
node_modules/playwright/lib/isomorphic/events.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.EventEmitter = exports.Disposable = void 0;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
let Disposable = exports.Disposable = void 0;
|
||||
(function (_Disposable) {
|
||||
function disposeAll(disposables) {
|
||||
for (const disposable of disposables.splice(0)) disposable.dispose();
|
||||
}
|
||||
_Disposable.disposeAll = disposeAll;
|
||||
})(Disposable || (exports.Disposable = Disposable = {}));
|
||||
class EventEmitter {
|
||||
constructor() {
|
||||
this.event = void 0;
|
||||
this._deliveryQueue = void 0;
|
||||
this._listeners = new Set();
|
||||
this.event = (listener, disposables) => {
|
||||
this._listeners.add(listener);
|
||||
let disposed = false;
|
||||
const self = this;
|
||||
const result = {
|
||||
dispose() {
|
||||
if (!disposed) {
|
||||
disposed = true;
|
||||
self._listeners.delete(listener);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (disposables) disposables.push(result);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
fire(event) {
|
||||
const dispatch = !this._deliveryQueue;
|
||||
if (!this._deliveryQueue) this._deliveryQueue = [];
|
||||
for (const listener of this._listeners) this._deliveryQueue.push({
|
||||
listener,
|
||||
event
|
||||
});
|
||||
if (!dispatch) return;
|
||||
for (let index = 0; index < this._deliveryQueue.length; index++) {
|
||||
const {
|
||||
listener,
|
||||
event
|
||||
} = this._deliveryQueue[index];
|
||||
listener.call(null, event);
|
||||
}
|
||||
this._deliveryQueue = undefined;
|
||||
}
|
||||
dispose() {
|
||||
this._listeners.clear();
|
||||
if (this._deliveryQueue) this._deliveryQueue = [];
|
||||
}
|
||||
}
|
||||
exports.EventEmitter = EventEmitter;
|
||||
25
node_modules/playwright/lib/isomorphic/folders.js
generated
vendored
Normal file
25
node_modules/playwright/lib/isomorphic/folders.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.artifactsFolderName = artifactsFolderName;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function artifactsFolderName(workerIndex) {
|
||||
return `.playwright-artifacts-${workerIndex}`;
|
||||
}
|
||||
58
node_modules/playwright/lib/isomorphic/stringInternPool.js
generated
vendored
Normal file
58
node_modules/playwright/lib/isomorphic/stringInternPool.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.StringInternPool = exports.JsonStringInternalizer = void 0;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class StringInternPool {
|
||||
constructor() {
|
||||
this._stringCache = new Map();
|
||||
}
|
||||
internString(s) {
|
||||
let result = this._stringCache.get(s);
|
||||
if (!result) {
|
||||
this._stringCache.set(s, s);
|
||||
result = s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.StringInternPool = StringInternPool;
|
||||
class JsonStringInternalizer {
|
||||
constructor(pool) {
|
||||
this._pool = void 0;
|
||||
this._pool = pool;
|
||||
}
|
||||
traverse(value) {
|
||||
if (typeof value !== 'object') return;
|
||||
if (Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (typeof value[i] === 'string') value[i] = this.intern(value[i]);else this.traverse(value[i]);
|
||||
}
|
||||
} else {
|
||||
for (const name in value) {
|
||||
if (typeof value[name] === 'string') value[name] = this.intern(value[name]);else this.traverse(value[name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
intern(value) {
|
||||
return this._pool.internString(value);
|
||||
}
|
||||
}
|
||||
exports.JsonStringInternalizer = JsonStringInternalizer;
|
||||
518
node_modules/playwright/lib/isomorphic/teleReceiver.js
generated
vendored
Normal file
518
node_modules/playwright/lib/isomorphic/teleReceiver.js
generated
vendored
Normal file
@@ -0,0 +1,518 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.baseFullConfig = exports.TeleTestResult = exports.TeleTestCase = exports.TeleSuite = exports.TeleReporterReceiver = void 0;
|
||||
exports.computeTestCaseOutcome = computeTestCaseOutcome;
|
||||
exports.parseRegexPatterns = parseRegexPatterns;
|
||||
exports.serializeRegexPatterns = serializeRegexPatterns;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class TeleReporterReceiver {
|
||||
constructor(reporter, options = {}) {
|
||||
this.isListing = false;
|
||||
this._rootSuite = void 0;
|
||||
this._options = void 0;
|
||||
this._reporter = void 0;
|
||||
this._tests = new Map();
|
||||
this._rootDir = void 0;
|
||||
this._config = void 0;
|
||||
this._rootSuite = new TeleSuite('', 'root');
|
||||
this._options = options;
|
||||
this._reporter = reporter;
|
||||
}
|
||||
reset() {
|
||||
this._rootSuite._entries = [];
|
||||
this._tests.clear();
|
||||
}
|
||||
dispatch(message) {
|
||||
const {
|
||||
method,
|
||||
params
|
||||
} = message;
|
||||
if (method === 'onConfigure') {
|
||||
this._onConfigure(params.config);
|
||||
return;
|
||||
}
|
||||
if (method === 'onProject') {
|
||||
this._onProject(params.project);
|
||||
return;
|
||||
}
|
||||
if (method === 'onBegin') {
|
||||
this._onBegin();
|
||||
return;
|
||||
}
|
||||
if (method === 'onTestBegin') {
|
||||
this._onTestBegin(params.testId, params.result);
|
||||
return;
|
||||
}
|
||||
if (method === 'onTestEnd') {
|
||||
this._onTestEnd(params.test, params.result);
|
||||
return;
|
||||
}
|
||||
if (method === 'onStepBegin') {
|
||||
this._onStepBegin(params.testId, params.resultId, params.step);
|
||||
return;
|
||||
}
|
||||
if (method === 'onStepEnd') {
|
||||
this._onStepEnd(params.testId, params.resultId, params.step);
|
||||
return;
|
||||
}
|
||||
if (method === 'onError') {
|
||||
this._onError(params.error);
|
||||
return;
|
||||
}
|
||||
if (method === 'onStdIO') {
|
||||
this._onStdIO(params.type, params.testId, params.resultId, params.data, params.isBase64);
|
||||
return;
|
||||
}
|
||||
if (method === 'onEnd') return this._onEnd(params.result);
|
||||
if (method === 'onExit') return this._onExit();
|
||||
}
|
||||
_onConfigure(config) {
|
||||
var _this$_reporter$onCon, _this$_reporter;
|
||||
this._rootDir = config.rootDir;
|
||||
this._config = this._parseConfig(config);
|
||||
(_this$_reporter$onCon = (_this$_reporter = this._reporter).onConfigure) === null || _this$_reporter$onCon === void 0 || _this$_reporter$onCon.call(_this$_reporter, this._config);
|
||||
}
|
||||
_onProject(project) {
|
||||
let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find(suite => suite.project().name === project.name) : undefined;
|
||||
if (!projectSuite) {
|
||||
projectSuite = new TeleSuite(project.name, 'project');
|
||||
this._rootSuite._addSuite(projectSuite);
|
||||
}
|
||||
// Always update project in watch mode.
|
||||
projectSuite._project = this._parseProject(project);
|
||||
for (const suite of project.suites) this._mergeSuiteInto(suite, projectSuite);
|
||||
}
|
||||
_onBegin() {
|
||||
var _this$_reporter$onBeg, _this$_reporter2;
|
||||
(_this$_reporter$onBeg = (_this$_reporter2 = this._reporter).onBegin) === null || _this$_reporter$onBeg === void 0 || _this$_reporter$onBeg.call(_this$_reporter2, this._rootSuite);
|
||||
}
|
||||
_onTestBegin(testId, payload) {
|
||||
var _this$_reporter$onTes, _this$_reporter3;
|
||||
const test = this._tests.get(testId);
|
||||
if (this._options.clearPreviousResultsWhenTestBegins) test.results = [];
|
||||
const testResult = test._createTestResult(payload.id);
|
||||
testResult.retry = payload.retry;
|
||||
testResult.workerIndex = payload.workerIndex;
|
||||
testResult.parallelIndex = payload.parallelIndex;
|
||||
testResult.setStartTimeNumber(payload.startTime);
|
||||
(_this$_reporter$onTes = (_this$_reporter3 = this._reporter).onTestBegin) === null || _this$_reporter$onTes === void 0 || _this$_reporter$onTes.call(_this$_reporter3, test, testResult);
|
||||
}
|
||||
_onTestEnd(testEndPayload, payload) {
|
||||
var _result$errors, _this$_reporter$onTes2, _this$_reporter4;
|
||||
const test = this._tests.get(testEndPayload.testId);
|
||||
test.timeout = testEndPayload.timeout;
|
||||
test.expectedStatus = testEndPayload.expectedStatus;
|
||||
test.annotations = testEndPayload.annotations;
|
||||
const result = test.results.find(r => r._id === payload.id);
|
||||
result.duration = payload.duration;
|
||||
result.status = payload.status;
|
||||
result.errors = payload.errors;
|
||||
result.error = (_result$errors = result.errors) === null || _result$errors === void 0 ? void 0 : _result$errors[0];
|
||||
result.attachments = this._parseAttachments(payload.attachments);
|
||||
(_this$_reporter$onTes2 = (_this$_reporter4 = this._reporter).onTestEnd) === null || _this$_reporter$onTes2 === void 0 || _this$_reporter$onTes2.call(_this$_reporter4, test, result);
|
||||
// Free up the memory as won't see these step ids.
|
||||
result._stepMap = new Map();
|
||||
}
|
||||
_onStepBegin(testId, resultId, payload) {
|
||||
var _this$_reporter$onSte, _this$_reporter5;
|
||||
const test = this._tests.get(testId);
|
||||
const result = test.results.find(r => r._id === resultId);
|
||||
const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : undefined;
|
||||
const location = this._absoluteLocation(payload.location);
|
||||
const step = new TeleTestStep(payload, parentStep, location, result);
|
||||
if (parentStep) parentStep.steps.push(step);else result.steps.push(step);
|
||||
result._stepMap.set(payload.id, step);
|
||||
(_this$_reporter$onSte = (_this$_reporter5 = this._reporter).onStepBegin) === null || _this$_reporter$onSte === void 0 || _this$_reporter$onSte.call(_this$_reporter5, test, result, step);
|
||||
}
|
||||
_onStepEnd(testId, resultId, payload) {
|
||||
var _this$_reporter$onSte2, _this$_reporter6;
|
||||
const test = this._tests.get(testId);
|
||||
const result = test.results.find(r => r._id === resultId);
|
||||
const step = result._stepMap.get(payload.id);
|
||||
step._endPayload = payload;
|
||||
step.duration = payload.duration;
|
||||
step.error = payload.error;
|
||||
(_this$_reporter$onSte2 = (_this$_reporter6 = this._reporter).onStepEnd) === null || _this$_reporter$onSte2 === void 0 || _this$_reporter$onSte2.call(_this$_reporter6, test, result, step);
|
||||
}
|
||||
_onError(error) {
|
||||
var _this$_reporter$onErr, _this$_reporter7;
|
||||
(_this$_reporter$onErr = (_this$_reporter7 = this._reporter).onError) === null || _this$_reporter$onErr === void 0 || _this$_reporter$onErr.call(_this$_reporter7, error);
|
||||
}
|
||||
_onStdIO(type, testId, resultId, data, isBase64) {
|
||||
const chunk = isBase64 ? globalThis.Buffer ? Buffer.from(data, 'base64') : atob(data) : data;
|
||||
const test = testId ? this._tests.get(testId) : undefined;
|
||||
const result = test && resultId ? test.results.find(r => r._id === resultId) : undefined;
|
||||
if (type === 'stdout') {
|
||||
var _this$_reporter$onStd, _this$_reporter8;
|
||||
result === null || result === void 0 || result.stdout.push(chunk);
|
||||
(_this$_reporter$onStd = (_this$_reporter8 = this._reporter).onStdOut) === null || _this$_reporter$onStd === void 0 || _this$_reporter$onStd.call(_this$_reporter8, chunk, test, result);
|
||||
} else {
|
||||
var _this$_reporter$onStd2, _this$_reporter9;
|
||||
result === null || result === void 0 || result.stderr.push(chunk);
|
||||
(_this$_reporter$onStd2 = (_this$_reporter9 = this._reporter).onStdErr) === null || _this$_reporter$onStd2 === void 0 || _this$_reporter$onStd2.call(_this$_reporter9, chunk, test, result);
|
||||
}
|
||||
}
|
||||
async _onEnd(result) {
|
||||
var _this$_reporter$onEnd, _this$_reporter10;
|
||||
await ((_this$_reporter$onEnd = (_this$_reporter10 = this._reporter).onEnd) === null || _this$_reporter$onEnd === void 0 ? void 0 : _this$_reporter$onEnd.call(_this$_reporter10, {
|
||||
status: result.status,
|
||||
startTime: new Date(result.startTime),
|
||||
duration: result.duration
|
||||
}));
|
||||
}
|
||||
_onExit() {
|
||||
var _this$_reporter$onExi, _this$_reporter11;
|
||||
return (_this$_reporter$onExi = (_this$_reporter11 = this._reporter).onExit) === null || _this$_reporter$onExi === void 0 ? void 0 : _this$_reporter$onExi.call(_this$_reporter11);
|
||||
}
|
||||
_parseConfig(config) {
|
||||
const result = {
|
||||
...baseFullConfig,
|
||||
...config
|
||||
};
|
||||
if (this._options.configOverrides) {
|
||||
result.configFile = this._options.configOverrides.configFile;
|
||||
result.reportSlowTests = this._options.configOverrides.reportSlowTests;
|
||||
result.quiet = this._options.configOverrides.quiet;
|
||||
result.reporter = [...this._options.configOverrides.reporter];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
_parseProject(project) {
|
||||
return {
|
||||
metadata: project.metadata,
|
||||
name: project.name,
|
||||
outputDir: this._absolutePath(project.outputDir),
|
||||
repeatEach: project.repeatEach,
|
||||
retries: project.retries,
|
||||
testDir: this._absolutePath(project.testDir),
|
||||
testIgnore: parseRegexPatterns(project.testIgnore),
|
||||
testMatch: parseRegexPatterns(project.testMatch),
|
||||
timeout: project.timeout,
|
||||
grep: parseRegexPatterns(project.grep),
|
||||
grepInvert: parseRegexPatterns(project.grepInvert),
|
||||
dependencies: project.dependencies,
|
||||
teardown: project.teardown,
|
||||
snapshotDir: this._absolutePath(project.snapshotDir),
|
||||
use: project.use
|
||||
};
|
||||
}
|
||||
_parseAttachments(attachments) {
|
||||
return attachments.map(a => {
|
||||
return {
|
||||
...a,
|
||||
body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, 'base64') : undefined
|
||||
};
|
||||
});
|
||||
}
|
||||
_mergeSuiteInto(jsonSuite, parent) {
|
||||
let targetSuite = parent.suites.find(s => s.title === jsonSuite.title);
|
||||
if (!targetSuite) {
|
||||
targetSuite = new TeleSuite(jsonSuite.title, parent.type === 'project' ? 'file' : 'describe');
|
||||
parent._addSuite(targetSuite);
|
||||
}
|
||||
targetSuite.location = this._absoluteLocation(jsonSuite.location);
|
||||
jsonSuite.entries.forEach(e => {
|
||||
if ('testId' in e) this._mergeTestInto(e, targetSuite);else this._mergeSuiteInto(e, targetSuite);
|
||||
});
|
||||
}
|
||||
_mergeTestInto(jsonTest, parent) {
|
||||
let targetTest = this._options.mergeTestCases ? parent.tests.find(s => s.title === jsonTest.title && s.repeatEachIndex === jsonTest.repeatEachIndex) : undefined;
|
||||
if (!targetTest) {
|
||||
targetTest = new TeleTestCase(jsonTest.testId, jsonTest.title, this._absoluteLocation(jsonTest.location), jsonTest.repeatEachIndex);
|
||||
parent._addTest(targetTest);
|
||||
this._tests.set(targetTest.id, targetTest);
|
||||
}
|
||||
this._updateTest(jsonTest, targetTest);
|
||||
}
|
||||
_updateTest(payload, test) {
|
||||
var _payload$tags, _payload$annotations;
|
||||
test.id = payload.testId;
|
||||
test.location = this._absoluteLocation(payload.location);
|
||||
test.retries = payload.retries;
|
||||
test.tags = (_payload$tags = payload.tags) !== null && _payload$tags !== void 0 ? _payload$tags : [];
|
||||
test.annotations = (_payload$annotations = payload.annotations) !== null && _payload$annotations !== void 0 ? _payload$annotations : [];
|
||||
return test;
|
||||
}
|
||||
_absoluteLocation(location) {
|
||||
if (!location) return location;
|
||||
return {
|
||||
...location,
|
||||
file: this._absolutePath(location.file)
|
||||
};
|
||||
}
|
||||
_absolutePath(relativePath) {
|
||||
if (relativePath === undefined) return;
|
||||
return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + '/' + relativePath;
|
||||
}
|
||||
}
|
||||
exports.TeleReporterReceiver = TeleReporterReceiver;
|
||||
class TeleSuite {
|
||||
constructor(title, type) {
|
||||
this.title = void 0;
|
||||
this.location = void 0;
|
||||
this.parent = void 0;
|
||||
this._entries = [];
|
||||
this._requireFile = '';
|
||||
this._timeout = void 0;
|
||||
this._retries = void 0;
|
||||
this._project = void 0;
|
||||
this._parallelMode = 'none';
|
||||
this._type = void 0;
|
||||
this.title = title;
|
||||
this._type = type;
|
||||
}
|
||||
get type() {
|
||||
return this._type;
|
||||
}
|
||||
get suites() {
|
||||
return this._entries.filter(e => e.type !== 'test');
|
||||
}
|
||||
get tests() {
|
||||
return this._entries.filter(e => e.type === 'test');
|
||||
}
|
||||
entries() {
|
||||
return this._entries;
|
||||
}
|
||||
allTests() {
|
||||
const result = [];
|
||||
const visit = suite => {
|
||||
for (const entry of suite.entries()) {
|
||||
if (entry.type === 'test') result.push(entry);else visit(entry);
|
||||
}
|
||||
};
|
||||
visit(this);
|
||||
return result;
|
||||
}
|
||||
titlePath() {
|
||||
const titlePath = this.parent ? this.parent.titlePath() : [];
|
||||
// Ignore anonymous describe blocks.
|
||||
if (this.title || this._type !== 'describe') titlePath.push(this.title);
|
||||
return titlePath;
|
||||
}
|
||||
project() {
|
||||
var _this$_project, _this$parent;
|
||||
return (_this$_project = this._project) !== null && _this$_project !== void 0 ? _this$_project : (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.project();
|
||||
}
|
||||
_addTest(test) {
|
||||
test.parent = this;
|
||||
this._entries.push(test);
|
||||
}
|
||||
_addSuite(suite) {
|
||||
suite.parent = this;
|
||||
this._entries.push(suite);
|
||||
}
|
||||
}
|
||||
exports.TeleSuite = TeleSuite;
|
||||
class TeleTestCase {
|
||||
constructor(id, title, location, repeatEachIndex) {
|
||||
this.title = void 0;
|
||||
this.fn = () => {};
|
||||
this.results = [];
|
||||
this.location = void 0;
|
||||
this.parent = void 0;
|
||||
this.type = 'test';
|
||||
this.expectedStatus = 'passed';
|
||||
this.timeout = 0;
|
||||
this.annotations = [];
|
||||
this.retries = 0;
|
||||
this.tags = [];
|
||||
this.repeatEachIndex = 0;
|
||||
this.id = void 0;
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.location = location;
|
||||
this.repeatEachIndex = repeatEachIndex;
|
||||
}
|
||||
titlePath() {
|
||||
const titlePath = this.parent ? this.parent.titlePath() : [];
|
||||
titlePath.push(this.title);
|
||||
return titlePath;
|
||||
}
|
||||
outcome() {
|
||||
return computeTestCaseOutcome(this);
|
||||
}
|
||||
ok() {
|
||||
const status = this.outcome();
|
||||
return status === 'expected' || status === 'flaky' || status === 'skipped';
|
||||
}
|
||||
_createTestResult(id) {
|
||||
const result = new TeleTestResult(this.results.length, id);
|
||||
this.results.push(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.TeleTestCase = TeleTestCase;
|
||||
class TeleTestStep {
|
||||
constructor(payload, parentStep, location, result) {
|
||||
this.title = void 0;
|
||||
this.category = void 0;
|
||||
this.location = void 0;
|
||||
this.parent = void 0;
|
||||
this.duration = -1;
|
||||
this.steps = [];
|
||||
this.error = void 0;
|
||||
this._result = void 0;
|
||||
this._endPayload = void 0;
|
||||
this._startTime = 0;
|
||||
this.title = payload.title;
|
||||
this.category = payload.category;
|
||||
this.location = location;
|
||||
this.parent = parentStep;
|
||||
this._startTime = payload.startTime;
|
||||
this._result = result;
|
||||
}
|
||||
titlePath() {
|
||||
var _this$parent2;
|
||||
const parentPath = ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.titlePath()) || [];
|
||||
return [...parentPath, this.title];
|
||||
}
|
||||
get startTime() {
|
||||
return new Date(this._startTime);
|
||||
}
|
||||
set startTime(value) {
|
||||
this._startTime = +value;
|
||||
}
|
||||
get attachments() {
|
||||
var _this$_endPayload$att, _this$_endPayload;
|
||||
return (_this$_endPayload$att = (_this$_endPayload = this._endPayload) === null || _this$_endPayload === void 0 || (_this$_endPayload = _this$_endPayload.attachments) === null || _this$_endPayload === void 0 ? void 0 : _this$_endPayload.map(index => this._result.attachments[index])) !== null && _this$_endPayload$att !== void 0 ? _this$_endPayload$att : [];
|
||||
}
|
||||
get annotations() {
|
||||
var _this$_endPayload$ann, _this$_endPayload2;
|
||||
return (_this$_endPayload$ann = (_this$_endPayload2 = this._endPayload) === null || _this$_endPayload2 === void 0 ? void 0 : _this$_endPayload2.annotations) !== null && _this$_endPayload$ann !== void 0 ? _this$_endPayload$ann : [];
|
||||
}
|
||||
}
|
||||
class TeleTestResult {
|
||||
constructor(retry, id) {
|
||||
this.retry = void 0;
|
||||
this.parallelIndex = -1;
|
||||
this.workerIndex = -1;
|
||||
this.duration = -1;
|
||||
this.stdout = [];
|
||||
this.stderr = [];
|
||||
this.attachments = [];
|
||||
this.status = 'skipped';
|
||||
this.steps = [];
|
||||
this.errors = [];
|
||||
this.error = void 0;
|
||||
this._stepMap = new Map();
|
||||
this._id = void 0;
|
||||
this._startTime = 0;
|
||||
this.retry = retry;
|
||||
this._id = id;
|
||||
}
|
||||
setStartTimeNumber(startTime) {
|
||||
this._startTime = startTime;
|
||||
}
|
||||
get startTime() {
|
||||
return new Date(this._startTime);
|
||||
}
|
||||
set startTime(value) {
|
||||
this._startTime = +value;
|
||||
}
|
||||
}
|
||||
exports.TeleTestResult = TeleTestResult;
|
||||
const baseFullConfig = exports.baseFullConfig = {
|
||||
forbidOnly: false,
|
||||
fullyParallel: false,
|
||||
globalSetup: null,
|
||||
globalTeardown: null,
|
||||
globalTimeout: 0,
|
||||
grep: /.*/,
|
||||
grepInvert: null,
|
||||
maxFailures: 0,
|
||||
metadata: {},
|
||||
preserveOutput: 'always',
|
||||
projects: [],
|
||||
reporter: [[process.env.CI ? 'dot' : 'list']],
|
||||
reportSlowTests: {
|
||||
max: 5,
|
||||
threshold: 300_000 /* 5 minutes */
|
||||
},
|
||||
configFile: '',
|
||||
rootDir: '',
|
||||
quiet: false,
|
||||
shard: null,
|
||||
updateSnapshots: 'missing',
|
||||
updateSourceMethod: 'patch',
|
||||
version: '',
|
||||
workers: 0,
|
||||
webServer: null
|
||||
};
|
||||
function serializeRegexPatterns(patterns) {
|
||||
if (!Array.isArray(patterns)) patterns = [patterns];
|
||||
return patterns.map(s => {
|
||||
if (typeof s === 'string') return {
|
||||
s
|
||||
};
|
||||
return {
|
||||
r: {
|
||||
source: s.source,
|
||||
flags: s.flags
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
function parseRegexPatterns(patterns) {
|
||||
return patterns.map(p => {
|
||||
if (p.s !== undefined) return p.s;
|
||||
return new RegExp(p.r.source, p.r.flags);
|
||||
});
|
||||
}
|
||||
function computeTestCaseOutcome(test) {
|
||||
let skipped = 0;
|
||||
let didNotRun = 0;
|
||||
let expected = 0;
|
||||
let interrupted = 0;
|
||||
let unexpected = 0;
|
||||
for (const result of test.results) {
|
||||
if (result.status === 'interrupted') {
|
||||
++interrupted; // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
} else if (result.status === 'skipped' && test.expectedStatus === 'skipped') {
|
||||
// Only tests "expected to be skipped" are skipped. These were specifically
|
||||
// marked with test.skip or test.fixme.
|
||||
++skipped;
|
||||
} else if (result.status === 'skipped') {
|
||||
// Tests that were expected to run, but were skipped are "did not run".
|
||||
// This happens when:
|
||||
// - testing finished early;
|
||||
// - test failure prevented other tests in the serial suite to run;
|
||||
// - probably more cases!
|
||||
++didNotRun; // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
} else if (result.status === test.expectedStatus) {
|
||||
// Either passed and expected to pass, or failed and expected to fail.
|
||||
++expected;
|
||||
} else {
|
||||
++unexpected;
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that were "skipped as expected" are considered equal to "expected" below,
|
||||
// because that's the expected outcome.
|
||||
//
|
||||
// However, we specifically differentiate the case of "only skipped"
|
||||
// and show it as "skipped" in all reporters.
|
||||
//
|
||||
// More exotic cases like "failed on first run and skipped on retry" are flaky.
|
||||
if (expected === 0 && unexpected === 0) return 'skipped'; // all results were skipped or interrupted
|
||||
if (unexpected === 0) return 'expected'; // no failures, just expected+skipped
|
||||
if (expected === 0 && skipped === 0) return 'unexpected'; // only failures
|
||||
return 'flaky'; // expected+unexpected or skipped+unexpected
|
||||
}
|
||||
144
node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js
generated
vendored
Normal file
144
node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TeleSuiteUpdater = void 0;
|
||||
var _teleReceiver = require("./teleReceiver");
|
||||
var _testTree = require("./testTree");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class TeleSuiteUpdater {
|
||||
constructor(options) {
|
||||
this.rootSuite = void 0;
|
||||
this.config = void 0;
|
||||
this.loadErrors = [];
|
||||
this.progress = {
|
||||
total: 0,
|
||||
passed: 0,
|
||||
failed: 0,
|
||||
skipped: 0
|
||||
};
|
||||
this._receiver = void 0;
|
||||
this._lastRunReceiver = void 0;
|
||||
this._lastRunTestCount = 0;
|
||||
this._options = void 0;
|
||||
this._testResultsSnapshot = void 0;
|
||||
this._receiver = new _teleReceiver.TeleReporterReceiver(this._createReporter(), {
|
||||
mergeProjects: true,
|
||||
mergeTestCases: true,
|
||||
resolvePath: (rootDir, relativePath) => rootDir + options.pathSeparator + relativePath,
|
||||
clearPreviousResultsWhenTestBegins: true
|
||||
});
|
||||
this._options = options;
|
||||
}
|
||||
_createReporter() {
|
||||
return {
|
||||
version: () => 'v2',
|
||||
onConfigure: c => {
|
||||
this.config = c;
|
||||
// TeleReportReceiver is merging everything into a single suite, so when we
|
||||
// run one test, we still get many tests via rootSuite.allTests().length.
|
||||
// To work around that, have a dedicated per-run receiver that will only have
|
||||
// suite for a single test run, and hence will have correct total.
|
||||
this._lastRunReceiver = new _teleReceiver.TeleReporterReceiver({
|
||||
version: () => 'v2',
|
||||
onBegin: suite => {
|
||||
this._lastRunTestCount = suite.allTests().length;
|
||||
this._lastRunReceiver = undefined;
|
||||
}
|
||||
}, {
|
||||
mergeProjects: true,
|
||||
mergeTestCases: false,
|
||||
resolvePath: (rootDir, relativePath) => rootDir + this._options.pathSeparator + relativePath
|
||||
});
|
||||
},
|
||||
onBegin: suite => {
|
||||
if (!this.rootSuite) this.rootSuite = suite;
|
||||
// As soon as new test tree is built add previous results, before calling onUpdate
|
||||
// to avoid flashing empty results in the UI.
|
||||
if (this._testResultsSnapshot) {
|
||||
for (const test of this.rootSuite.allTests()) {
|
||||
var _this$_testResultsSna;
|
||||
test.results = ((_this$_testResultsSna = this._testResultsSnapshot) === null || _this$_testResultsSna === void 0 ? void 0 : _this$_testResultsSna.get(test.id)) || test.results;
|
||||
}
|
||||
this._testResultsSnapshot = undefined;
|
||||
}
|
||||
this.progress.total = this._lastRunTestCount;
|
||||
this.progress.passed = 0;
|
||||
this.progress.failed = 0;
|
||||
this.progress.skipped = 0;
|
||||
this._options.onUpdate(true);
|
||||
},
|
||||
onEnd: () => {
|
||||
this._options.onUpdate(true);
|
||||
},
|
||||
onTestBegin: (test, testResult) => {
|
||||
testResult[_testTree.statusEx] = 'running';
|
||||
this._options.onUpdate();
|
||||
},
|
||||
onTestEnd: (test, testResult) => {
|
||||
if (test.outcome() === 'skipped') ++this.progress.skipped;else if (test.outcome() === 'unexpected') ++this.progress.failed;else ++this.progress.passed;
|
||||
testResult[_testTree.statusEx] = testResult.status;
|
||||
this._options.onUpdate();
|
||||
},
|
||||
onError: error => this._handleOnError(error),
|
||||
printsToStdio: () => false
|
||||
};
|
||||
}
|
||||
processGlobalReport(report) {
|
||||
const receiver = new _teleReceiver.TeleReporterReceiver({
|
||||
version: () => 'v2',
|
||||
onConfigure: c => {
|
||||
this.config = c;
|
||||
},
|
||||
onError: error => this._handleOnError(error)
|
||||
});
|
||||
for (const message of report) void receiver.dispatch(message);
|
||||
}
|
||||
processListReport(report) {
|
||||
var _this$rootSuite;
|
||||
// Save test results and reset all projects, the results will be restored after
|
||||
// new project structure is built.
|
||||
const tests = ((_this$rootSuite = this.rootSuite) === null || _this$rootSuite === void 0 ? void 0 : _this$rootSuite.allTests()) || [];
|
||||
this._testResultsSnapshot = new Map(tests.map(test => [test.id, test.results]));
|
||||
this._receiver.reset();
|
||||
for (const message of report) void this._receiver.dispatch(message);
|
||||
}
|
||||
processTestReportEvent(message) {
|
||||
var _this$_lastRunReceive, _this$_receiver$dispa;
|
||||
// The order of receiver dispatches matters here, we want to assign `lastRunTestCount`
|
||||
// before we use it.
|
||||
(_this$_lastRunReceive = this._lastRunReceiver) === null || _this$_lastRunReceive === void 0 || (_this$_lastRunReceive = _this$_lastRunReceive.dispatch(message)) === null || _this$_lastRunReceive === void 0 || _this$_lastRunReceive.catch(() => {});
|
||||
(_this$_receiver$dispa = this._receiver.dispatch(message)) === null || _this$_receiver$dispa === void 0 || _this$_receiver$dispa.catch(() => {});
|
||||
}
|
||||
_handleOnError(error) {
|
||||
var _this$_options$onErro, _this$_options;
|
||||
this.loadErrors.push(error);
|
||||
(_this$_options$onErro = (_this$_options = this._options).onError) === null || _this$_options$onErro === void 0 || _this$_options$onErro.call(_this$_options, error);
|
||||
this._options.onUpdate();
|
||||
}
|
||||
asModel() {
|
||||
return {
|
||||
rootSuite: this.rootSuite || new _teleReceiver.TeleSuite('', 'root'),
|
||||
config: this.config,
|
||||
loadErrors: this.loadErrors,
|
||||
progress: this.progress
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.TeleSuiteUpdater = TeleSuiteUpdater;
|
||||
210
node_modules/playwright/lib/isomorphic/testServerConnection.js
generated
vendored
Normal file
210
node_modules/playwright/lib/isomorphic/testServerConnection.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.WebSocketTestServerTransport = exports.TestServerConnection = void 0;
|
||||
var events = _interopRequireWildcard(require("./events"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
|
||||
|
||||
class WebSocketTestServerTransport {
|
||||
constructor(url) {
|
||||
this._ws = void 0;
|
||||
this._ws = new WebSocket(url);
|
||||
}
|
||||
onmessage(listener) {
|
||||
this._ws.addEventListener('message', event => listener(event.data));
|
||||
}
|
||||
onopen(listener) {
|
||||
this._ws.addEventListener('open', listener);
|
||||
}
|
||||
onerror(listener) {
|
||||
this._ws.addEventListener('error', listener);
|
||||
}
|
||||
onclose(listener) {
|
||||
this._ws.addEventListener('close', listener);
|
||||
}
|
||||
send(data) {
|
||||
this._ws.send(data);
|
||||
}
|
||||
close() {
|
||||
this._ws.close();
|
||||
}
|
||||
}
|
||||
exports.WebSocketTestServerTransport = WebSocketTestServerTransport;
|
||||
class TestServerConnection {
|
||||
constructor(transport) {
|
||||
this.onClose = void 0;
|
||||
this.onReport = void 0;
|
||||
this.onStdio = void 0;
|
||||
this.onTestFilesChanged = void 0;
|
||||
this.onLoadTraceRequested = void 0;
|
||||
this._onCloseEmitter = new events.EventEmitter();
|
||||
this._onReportEmitter = new events.EventEmitter();
|
||||
this._onStdioEmitter = new events.EventEmitter();
|
||||
this._onTestFilesChangedEmitter = new events.EventEmitter();
|
||||
this._onLoadTraceRequestedEmitter = new events.EventEmitter();
|
||||
this._lastId = 0;
|
||||
this._transport = void 0;
|
||||
this._callbacks = new Map();
|
||||
this._connectedPromise = void 0;
|
||||
this._isClosed = false;
|
||||
this.onClose = this._onCloseEmitter.event;
|
||||
this.onReport = this._onReportEmitter.event;
|
||||
this.onStdio = this._onStdioEmitter.event;
|
||||
this.onTestFilesChanged = this._onTestFilesChangedEmitter.event;
|
||||
this.onLoadTraceRequested = this._onLoadTraceRequestedEmitter.event;
|
||||
this._transport = transport;
|
||||
this._transport.onmessage(data => {
|
||||
const message = JSON.parse(data);
|
||||
const {
|
||||
id,
|
||||
result,
|
||||
error,
|
||||
method,
|
||||
params
|
||||
} = message;
|
||||
if (id) {
|
||||
const callback = this._callbacks.get(id);
|
||||
if (!callback) return;
|
||||
this._callbacks.delete(id);
|
||||
if (error) callback.reject(new Error(error));else callback.resolve(result);
|
||||
} else {
|
||||
this._dispatchEvent(method, params);
|
||||
}
|
||||
});
|
||||
const pingInterval = setInterval(() => this._sendMessage('ping').catch(() => {}), 30000);
|
||||
this._connectedPromise = new Promise((f, r) => {
|
||||
this._transport.onopen(f);
|
||||
this._transport.onerror(r);
|
||||
});
|
||||
this._transport.onclose(() => {
|
||||
this._isClosed = true;
|
||||
this._onCloseEmitter.fire();
|
||||
clearInterval(pingInterval);
|
||||
});
|
||||
}
|
||||
isClosed() {
|
||||
return this._isClosed;
|
||||
}
|
||||
async _sendMessage(method, params) {
|
||||
const logForTest = globalThis.__logForTest;
|
||||
logForTest === null || logForTest === void 0 || logForTest({
|
||||
method,
|
||||
params
|
||||
});
|
||||
await this._connectedPromise;
|
||||
const id = ++this._lastId;
|
||||
const message = {
|
||||
id,
|
||||
method,
|
||||
params
|
||||
};
|
||||
this._transport.send(JSON.stringify(message));
|
||||
return new Promise((resolve, reject) => {
|
||||
this._callbacks.set(id, {
|
||||
resolve,
|
||||
reject
|
||||
});
|
||||
});
|
||||
}
|
||||
_sendMessageNoReply(method, params) {
|
||||
this._sendMessage(method, params).catch(() => {});
|
||||
}
|
||||
_dispatchEvent(method, params) {
|
||||
if (method === 'report') this._onReportEmitter.fire(params);else if (method === 'stdio') this._onStdioEmitter.fire(params);else if (method === 'testFilesChanged') this._onTestFilesChangedEmitter.fire(params);else if (method === 'loadTraceRequested') this._onLoadTraceRequestedEmitter.fire(params);
|
||||
}
|
||||
async initialize(params) {
|
||||
await this._sendMessage('initialize', params);
|
||||
}
|
||||
async ping(params) {
|
||||
await this._sendMessage('ping', params);
|
||||
}
|
||||
async pingNoReply(params) {
|
||||
this._sendMessageNoReply('ping', params);
|
||||
}
|
||||
async watch(params) {
|
||||
await this._sendMessage('watch', params);
|
||||
}
|
||||
watchNoReply(params) {
|
||||
this._sendMessageNoReply('watch', params);
|
||||
}
|
||||
async open(params) {
|
||||
await this._sendMessage('open', params);
|
||||
}
|
||||
openNoReply(params) {
|
||||
this._sendMessageNoReply('open', params);
|
||||
}
|
||||
async resizeTerminal(params) {
|
||||
await this._sendMessage('resizeTerminal', params);
|
||||
}
|
||||
resizeTerminalNoReply(params) {
|
||||
this._sendMessageNoReply('resizeTerminal', params);
|
||||
}
|
||||
async checkBrowsers(params) {
|
||||
return await this._sendMessage('checkBrowsers', params);
|
||||
}
|
||||
async installBrowsers(params) {
|
||||
await this._sendMessage('installBrowsers', params);
|
||||
}
|
||||
async runGlobalSetup(params) {
|
||||
return await this._sendMessage('runGlobalSetup', params);
|
||||
}
|
||||
async runGlobalTeardown(params) {
|
||||
return await this._sendMessage('runGlobalTeardown', params);
|
||||
}
|
||||
async startDevServer(params) {
|
||||
return await this._sendMessage('startDevServer', params);
|
||||
}
|
||||
async stopDevServer(params) {
|
||||
return await this._sendMessage('stopDevServer', params);
|
||||
}
|
||||
async clearCache(params) {
|
||||
return await this._sendMessage('clearCache', params);
|
||||
}
|
||||
async listFiles(params) {
|
||||
return await this._sendMessage('listFiles', params);
|
||||
}
|
||||
async listTests(params) {
|
||||
return await this._sendMessage('listTests', params);
|
||||
}
|
||||
async runTests(params) {
|
||||
return await this._sendMessage('runTests', params);
|
||||
}
|
||||
async findRelatedTestFiles(params) {
|
||||
return await this._sendMessage('findRelatedTestFiles', params);
|
||||
}
|
||||
async stopTests(params) {
|
||||
await this._sendMessage('stopTests', params);
|
||||
}
|
||||
stopTestsNoReply(params) {
|
||||
this._sendMessageNoReply('stopTests', params);
|
||||
}
|
||||
async closeGracefully(params) {
|
||||
await this._sendMessage('closeGracefully', params);
|
||||
}
|
||||
close() {
|
||||
try {
|
||||
this._transport.close();
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
exports.TestServerConnection = TestServerConnection;
|
||||
5
node_modules/playwright/lib/isomorphic/testServerInterface.js
generated
vendored
Normal file
5
node_modules/playwright/lib/isomorphic/testServerInterface.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
276
node_modules/playwright/lib/isomorphic/testTree.js
generated
vendored
Normal file
276
node_modules/playwright/lib/isomorphic/testTree.js
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TestTree = void 0;
|
||||
exports.collectTestIds = collectTestIds;
|
||||
exports.sortAndPropagateStatus = sortAndPropagateStatus;
|
||||
exports.statusEx = void 0;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// -- Reuse boundary -- Everything below this line is reused in the vscode extension.
|
||||
|
||||
class TestTree {
|
||||
constructor(rootFolder, rootSuite, loadErrors, projectFilters, pathSeparator) {
|
||||
this.rootItem = void 0;
|
||||
this._treeItemById = new Map();
|
||||
this._treeItemByTestId = new Map();
|
||||
this.pathSeparator = void 0;
|
||||
const filterProjects = projectFilters && [...projectFilters.values()].some(Boolean);
|
||||
this.pathSeparator = pathSeparator;
|
||||
this.rootItem = {
|
||||
kind: 'group',
|
||||
subKind: 'folder',
|
||||
id: rootFolder,
|
||||
title: '',
|
||||
location: {
|
||||
file: '',
|
||||
line: 0,
|
||||
column: 0
|
||||
},
|
||||
duration: 0,
|
||||
parent: undefined,
|
||||
children: [],
|
||||
status: 'none',
|
||||
hasLoadErrors: false
|
||||
};
|
||||
this._treeItemById.set(rootFolder, this.rootItem);
|
||||
const visitSuite = (project, parentSuite, parentGroup) => {
|
||||
for (const suite of parentSuite.suites) {
|
||||
if (!suite.title) {
|
||||
// Flatten anonymous describes.
|
||||
visitSuite(project, suite, parentGroup);
|
||||
continue;
|
||||
}
|
||||
let group = parentGroup.children.find(item => item.kind === 'group' && item.title === suite.title);
|
||||
if (!group) {
|
||||
group = {
|
||||
kind: 'group',
|
||||
subKind: 'describe',
|
||||
id: 'suite:' + parentSuite.titlePath().join('\x1e') + '\x1e' + suite.title,
|
||||
// account for anonymous suites
|
||||
title: suite.title,
|
||||
location: suite.location,
|
||||
duration: 0,
|
||||
parent: parentGroup,
|
||||
children: [],
|
||||
status: 'none',
|
||||
hasLoadErrors: false
|
||||
};
|
||||
this._addChild(parentGroup, group);
|
||||
}
|
||||
visitSuite(project, suite, group);
|
||||
}
|
||||
for (const test of parentSuite.tests) {
|
||||
const title = test.title;
|
||||
let testCaseItem = parentGroup.children.find(t => t.kind !== 'group' && t.title === title);
|
||||
if (!testCaseItem) {
|
||||
testCaseItem = {
|
||||
kind: 'case',
|
||||
id: 'test:' + test.titlePath().join('\x1e'),
|
||||
title,
|
||||
parent: parentGroup,
|
||||
children: [],
|
||||
tests: [],
|
||||
location: test.location,
|
||||
duration: 0,
|
||||
status: 'none',
|
||||
project: undefined,
|
||||
test: undefined,
|
||||
tags: test.tags
|
||||
};
|
||||
this._addChild(parentGroup, testCaseItem);
|
||||
}
|
||||
const result = test.results[0];
|
||||
let status = 'none';
|
||||
if ((result === null || result === void 0 ? void 0 : result[statusEx]) === 'scheduled') status = 'scheduled';else if ((result === null || result === void 0 ? void 0 : result[statusEx]) === 'running') status = 'running';else if ((result === null || result === void 0 ? void 0 : result.status) === 'skipped') status = 'skipped';else if ((result === null || result === void 0 ? void 0 : result.status) === 'interrupted') status = 'none';else if (result && test.outcome() !== 'expected') status = 'failed';else if (result && test.outcome() === 'expected') status = 'passed';
|
||||
testCaseItem.tests.push(test);
|
||||
const testItem = {
|
||||
kind: 'test',
|
||||
id: test.id,
|
||||
title: project.name,
|
||||
location: test.location,
|
||||
test,
|
||||
parent: testCaseItem,
|
||||
children: [],
|
||||
status,
|
||||
duration: test.results.length ? Math.max(0, test.results[0].duration) : 0,
|
||||
project
|
||||
};
|
||||
this._addChild(testCaseItem, testItem);
|
||||
this._treeItemByTestId.set(test.id, testItem);
|
||||
testCaseItem.duration = testCaseItem.children.reduce((a, b) => a + b.duration, 0);
|
||||
}
|
||||
};
|
||||
for (const projectSuite of (rootSuite === null || rootSuite === void 0 ? void 0 : rootSuite.suites) || []) {
|
||||
if (filterProjects && !projectFilters.get(projectSuite.title)) continue;
|
||||
for (const fileSuite of projectSuite.suites) {
|
||||
const fileItem = this._fileItem(fileSuite.location.file.split(pathSeparator), true);
|
||||
visitSuite(projectSuite.project(), fileSuite, fileItem);
|
||||
}
|
||||
}
|
||||
for (const loadError of loadErrors) {
|
||||
if (!loadError.location) continue;
|
||||
const fileItem = this._fileItem(loadError.location.file.split(pathSeparator), true);
|
||||
fileItem.hasLoadErrors = true;
|
||||
}
|
||||
}
|
||||
_addChild(parent, child) {
|
||||
parent.children.push(child);
|
||||
child.parent = parent;
|
||||
this._treeItemById.set(child.id, child);
|
||||
}
|
||||
filterTree(filterText, statusFilters, runningTestIds) {
|
||||
const tokens = filterText.trim().toLowerCase().split(' ');
|
||||
const filtersStatuses = [...statusFilters.values()].some(Boolean);
|
||||
const filter = testCase => {
|
||||
const titleWithTags = [...testCase.tests[0].titlePath(), ...testCase.tests[0].tags].join(' ').toLowerCase();
|
||||
if (!tokens.every(token => titleWithTags.includes(token)) && !testCase.tests.some(t => runningTestIds === null || runningTestIds === void 0 ? void 0 : runningTestIds.has(t.id))) return false;
|
||||
testCase.children = testCase.children.filter(test => {
|
||||
return !filtersStatuses || (runningTestIds === null || runningTestIds === void 0 ? void 0 : runningTestIds.has(test.test.id)) || statusFilters.get(test.status);
|
||||
});
|
||||
testCase.tests = testCase.children.map(c => c.test);
|
||||
return !!testCase.children.length;
|
||||
};
|
||||
const visit = treeItem => {
|
||||
const newChildren = [];
|
||||
for (const child of treeItem.children) {
|
||||
if (child.kind === 'case') {
|
||||
if (filter(child)) newChildren.push(child);
|
||||
} else {
|
||||
visit(child);
|
||||
if (child.children.length || child.hasLoadErrors) newChildren.push(child);
|
||||
}
|
||||
}
|
||||
treeItem.children = newChildren;
|
||||
};
|
||||
visit(this.rootItem);
|
||||
}
|
||||
_fileItem(filePath, isFile) {
|
||||
if (filePath.length === 0) return this.rootItem;
|
||||
const fileName = filePath.join(this.pathSeparator);
|
||||
const existingFileItem = this._treeItemById.get(fileName);
|
||||
if (existingFileItem) return existingFileItem;
|
||||
const parentFileItem = this._fileItem(filePath.slice(0, filePath.length - 1), false);
|
||||
const fileItem = {
|
||||
kind: 'group',
|
||||
subKind: isFile ? 'file' : 'folder',
|
||||
id: fileName,
|
||||
title: filePath[filePath.length - 1],
|
||||
location: {
|
||||
file: fileName,
|
||||
line: 0,
|
||||
column: 0
|
||||
},
|
||||
duration: 0,
|
||||
parent: parentFileItem,
|
||||
children: [],
|
||||
status: 'none',
|
||||
hasLoadErrors: false
|
||||
};
|
||||
this._addChild(parentFileItem, fileItem);
|
||||
return fileItem;
|
||||
}
|
||||
sortAndPropagateStatus() {
|
||||
sortAndPropagateStatus(this.rootItem);
|
||||
}
|
||||
flattenForSingleProject() {
|
||||
const visit = treeItem => {
|
||||
if (treeItem.kind === 'case' && treeItem.children.length === 1) {
|
||||
treeItem.project = treeItem.children[0].project;
|
||||
treeItem.test = treeItem.children[0].test;
|
||||
treeItem.children = [];
|
||||
this._treeItemByTestId.set(treeItem.test.id, treeItem);
|
||||
} else {
|
||||
treeItem.children.forEach(visit);
|
||||
}
|
||||
};
|
||||
visit(this.rootItem);
|
||||
}
|
||||
shortenRoot() {
|
||||
let shortRoot = this.rootItem;
|
||||
while (shortRoot.children.length === 1 && shortRoot.children[0].kind === 'group' && shortRoot.children[0].subKind === 'folder') shortRoot = shortRoot.children[0];
|
||||
shortRoot.location = this.rootItem.location;
|
||||
this.rootItem = shortRoot;
|
||||
}
|
||||
testIds() {
|
||||
const result = new Set();
|
||||
const visit = treeItem => {
|
||||
if (treeItem.kind === 'case') treeItem.tests.forEach(t => result.add(t.id));
|
||||
treeItem.children.forEach(visit);
|
||||
};
|
||||
visit(this.rootItem);
|
||||
return result;
|
||||
}
|
||||
fileNames() {
|
||||
const result = new Set();
|
||||
const visit = treeItem => {
|
||||
if (treeItem.kind === 'group' && treeItem.subKind === 'file') result.add(treeItem.id);else treeItem.children.forEach(visit);
|
||||
};
|
||||
visit(this.rootItem);
|
||||
return [...result];
|
||||
}
|
||||
flatTreeItems() {
|
||||
const result = [];
|
||||
const visit = treeItem => {
|
||||
result.push(treeItem);
|
||||
treeItem.children.forEach(visit);
|
||||
};
|
||||
visit(this.rootItem);
|
||||
return result;
|
||||
}
|
||||
treeItemById(id) {
|
||||
return this._treeItemById.get(id);
|
||||
}
|
||||
collectTestIds(treeItem) {
|
||||
return treeItem ? collectTestIds(treeItem) : new Set();
|
||||
}
|
||||
}
|
||||
exports.TestTree = TestTree;
|
||||
function sortAndPropagateStatus(treeItem) {
|
||||
for (const child of treeItem.children) sortAndPropagateStatus(child);
|
||||
if (treeItem.kind === 'group') {
|
||||
treeItem.children.sort((a, b) => {
|
||||
const fc = a.location.file.localeCompare(b.location.file);
|
||||
return fc || a.location.line - b.location.line;
|
||||
});
|
||||
}
|
||||
let allPassed = treeItem.children.length > 0;
|
||||
let allSkipped = treeItem.children.length > 0;
|
||||
let hasFailed = false;
|
||||
let hasRunning = false;
|
||||
let hasScheduled = false;
|
||||
for (const child of treeItem.children) {
|
||||
allSkipped = allSkipped && child.status === 'skipped';
|
||||
allPassed = allPassed && (child.status === 'passed' || child.status === 'skipped');
|
||||
hasFailed = hasFailed || child.status === 'failed';
|
||||
hasRunning = hasRunning || child.status === 'running';
|
||||
hasScheduled = hasScheduled || child.status === 'scheduled';
|
||||
}
|
||||
if (hasRunning) treeItem.status = 'running';else if (hasScheduled) treeItem.status = 'scheduled';else if (hasFailed) treeItem.status = 'failed';else if (allSkipped) treeItem.status = 'skipped';else if (allPassed) treeItem.status = 'passed';
|
||||
}
|
||||
function collectTestIds(treeItem) {
|
||||
const testIds = new Set();
|
||||
const visit = treeItem => {
|
||||
var _treeItem$children;
|
||||
if (treeItem.kind === 'case') treeItem.tests.map(t => t.id).forEach(id => testIds.add(id));else if (treeItem.kind === 'test') testIds.add(treeItem.id);else (_treeItem$children = treeItem.children) === null || _treeItem$children === void 0 || _treeItem$children.forEach(visit);
|
||||
};
|
||||
visit(treeItem);
|
||||
return testIds;
|
||||
}
|
||||
const statusEx = exports.statusEx = Symbol('statusEx');
|
||||
23
node_modules/playwright/lib/isomorphic/util.js
generated
vendored
Normal file
23
node_modules/playwright/lib/isomorphic/util.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.kTopLevelAttachmentPrefix = void 0;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const kTopLevelAttachmentPrefix = exports.kTopLevelAttachmentPrefix = '_attach';
|
||||
Reference in New Issue
Block a user