First Commit
This commit is contained in:
77
node_modules/playwright/lib/isomorphic/events.js
generated
vendored
Normal file
77
node_modules/playwright/lib/isomorphic/events.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var events_exports = {};
|
||||
__export(events_exports, {
|
||||
Disposable: () => Disposable,
|
||||
EventEmitter: () => EventEmitter
|
||||
});
|
||||
module.exports = __toCommonJS(events_exports);
|
||||
var Disposable;
|
||||
((Disposable2) => {
|
||||
function disposeAll(disposables) {
|
||||
for (const disposable of disposables.splice(0))
|
||||
disposable.dispose();
|
||||
}
|
||||
Disposable2.disposeAll = disposeAll;
|
||||
})(Disposable || (Disposable = {}));
|
||||
class EventEmitter {
|
||||
constructor() {
|
||||
this._listeners = /* @__PURE__ */ 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: event2 } = this._deliveryQueue[index];
|
||||
listener.call(null, event2);
|
||||
}
|
||||
this._deliveryQueue = void 0;
|
||||
}
|
||||
dispose() {
|
||||
this._listeners.clear();
|
||||
if (this._deliveryQueue)
|
||||
this._deliveryQueue = [];
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Disposable,
|
||||
EventEmitter
|
||||
});
|
30
node_modules/playwright/lib/isomorphic/folders.js
generated
vendored
Normal file
30
node_modules/playwright/lib/isomorphic/folders.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var folders_exports = {};
|
||||
__export(folders_exports, {
|
||||
artifactsFolderName: () => artifactsFolderName
|
||||
});
|
||||
module.exports = __toCommonJS(folders_exports);
|
||||
function artifactsFolderName(workerIndex) {
|
||||
return `.playwright-artifacts-${workerIndex}`;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
artifactsFolderName
|
||||
});
|
69
node_modules/playwright/lib/isomorphic/stringInternPool.js
generated
vendored
Normal file
69
node_modules/playwright/lib/isomorphic/stringInternPool.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stringInternPool_exports = {};
|
||||
__export(stringInternPool_exports, {
|
||||
JsonStringInternalizer: () => JsonStringInternalizer,
|
||||
StringInternPool: () => StringInternPool
|
||||
});
|
||||
module.exports = __toCommonJS(stringInternPool_exports);
|
||||
class StringInternPool {
|
||||
constructor() {
|
||||
this._stringCache = /* @__PURE__ */ new Map();
|
||||
}
|
||||
internString(s) {
|
||||
let result = this._stringCache.get(s);
|
||||
if (!result) {
|
||||
this._stringCache.set(s, s);
|
||||
result = s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
class JsonStringInternalizer {
|
||||
constructor(pool) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
JsonStringInternalizer,
|
||||
StringInternPool
|
||||
});
|
507
node_modules/playwright/lib/isomorphic/teleReceiver.js
generated
vendored
Normal file
507
node_modules/playwright/lib/isomorphic/teleReceiver.js
generated
vendored
Normal file
@@ -0,0 +1,507 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var teleReceiver_exports = {};
|
||||
__export(teleReceiver_exports, {
|
||||
TeleReporterReceiver: () => TeleReporterReceiver,
|
||||
TeleSuite: () => TeleSuite,
|
||||
TeleTestCase: () => TeleTestCase,
|
||||
TeleTestResult: () => TeleTestResult,
|
||||
baseFullConfig: () => baseFullConfig,
|
||||
computeTestCaseOutcome: () => computeTestCaseOutcome,
|
||||
parseRegexPatterns: () => parseRegexPatterns,
|
||||
serializeRegexPatterns: () => serializeRegexPatterns
|
||||
});
|
||||
module.exports = __toCommonJS(teleReceiver_exports);
|
||||
class TeleReporterReceiver {
|
||||
constructor(reporter, options = {}) {
|
||||
this.isListing = false;
|
||||
this._tests = /* @__PURE__ */ new Map();
|
||||
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 === "onAttach") {
|
||||
this._onAttach(params.testId, params.resultId, params.attachments);
|
||||
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) {
|
||||
this._rootDir = config.rootDir;
|
||||
this._config = this._parseConfig(config);
|
||||
this._reporter.onConfigure?.(this._config);
|
||||
}
|
||||
_onProject(project) {
|
||||
let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find((suite) => suite.project().name === project.name) : void 0;
|
||||
if (!projectSuite) {
|
||||
projectSuite = new TeleSuite(project.name, "project");
|
||||
this._rootSuite._addSuite(projectSuite);
|
||||
}
|
||||
projectSuite._project = this._parseProject(project);
|
||||
for (const suite of project.suites)
|
||||
this._mergeSuiteInto(suite, projectSuite);
|
||||
}
|
||||
_onBegin() {
|
||||
this._reporter.onBegin?.(this._rootSuite);
|
||||
}
|
||||
_onTestBegin(testId, payload) {
|
||||
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.onTestBegin?.(test, testResult);
|
||||
}
|
||||
_onTestEnd(testEndPayload, payload) {
|
||||
const test = this._tests.get(testEndPayload.testId);
|
||||
test.timeout = testEndPayload.timeout;
|
||||
test.expectedStatus = testEndPayload.expectedStatus;
|
||||
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?.[0];
|
||||
if (!!payload.attachments)
|
||||
result.attachments = this._parseAttachments(payload.attachments);
|
||||
if (payload.annotations) {
|
||||
this._absoluteAnnotationLocationsInplace(payload.annotations);
|
||||
result.annotations = payload.annotations;
|
||||
test.annotations = payload.annotations;
|
||||
}
|
||||
this._reporter.onTestEnd?.(test, result);
|
||||
result._stepMap = /* @__PURE__ */ new Map();
|
||||
}
|
||||
_onStepBegin(testId, resultId, payload) {
|
||||
const test = this._tests.get(testId);
|
||||
const result = test.results.find((r) => r._id === resultId);
|
||||
const parentStep = payload.parentStepId ? result._stepMap.get(payload.parentStepId) : void 0;
|
||||
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.onStepBegin?.(test, result, step);
|
||||
}
|
||||
_onStepEnd(testId, resultId, payload) {
|
||||
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.onStepEnd?.(test, result, step);
|
||||
}
|
||||
_onAttach(testId, resultId, attachments) {
|
||||
const test = this._tests.get(testId);
|
||||
const result = test.results.find((r) => r._id === resultId);
|
||||
result.attachments.push(...attachments.map((a) => ({
|
||||
name: a.name,
|
||||
contentType: a.contentType,
|
||||
path: a.path,
|
||||
body: a.base64 && globalThis.Buffer ? Buffer.from(a.base64, "base64") : void 0
|
||||
})));
|
||||
}
|
||||
_onError(error) {
|
||||
this._reporter.onError?.(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) : void 0;
|
||||
const result = test && resultId ? test.results.find((r) => r._id === resultId) : void 0;
|
||||
if (type === "stdout") {
|
||||
result?.stdout.push(chunk);
|
||||
this._reporter.onStdOut?.(chunk, test, result);
|
||||
} else {
|
||||
result?.stderr.push(chunk);
|
||||
this._reporter.onStdErr?.(chunk, test, result);
|
||||
}
|
||||
}
|
||||
async _onEnd(result) {
|
||||
await this._reporter.onEnd?.({
|
||||
status: result.status,
|
||||
startTime: new Date(result.startTime),
|
||||
duration: result.duration
|
||||
});
|
||||
}
|
||||
_onExit() {
|
||||
return this._reporter.onExit?.();
|
||||
}
|
||||
_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") : void 0
|
||||
};
|
||||
});
|
||||
}
|
||||
_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) : void 0;
|
||||
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) {
|
||||
test.id = payload.testId;
|
||||
test.location = this._absoluteLocation(payload.location);
|
||||
test.retries = payload.retries;
|
||||
test.tags = payload.tags ?? [];
|
||||
test.annotations = payload.annotations ?? [];
|
||||
this._absoluteAnnotationLocationsInplace(test.annotations);
|
||||
return test;
|
||||
}
|
||||
_absoluteAnnotationLocationsInplace(annotations) {
|
||||
for (const annotation of annotations) {
|
||||
if (annotation.location)
|
||||
annotation.location = this._absoluteLocation(annotation.location);
|
||||
}
|
||||
}
|
||||
_absoluteLocation(location) {
|
||||
if (!location)
|
||||
return location;
|
||||
return {
|
||||
...location,
|
||||
file: this._absolutePath(location.file)
|
||||
};
|
||||
}
|
||||
_absolutePath(relativePath) {
|
||||
if (relativePath === void 0)
|
||||
return;
|
||||
return this._options.resolvePath ? this._options.resolvePath(this._rootDir, relativePath) : this._rootDir + "/" + relativePath;
|
||||
}
|
||||
}
|
||||
class TeleSuite {
|
||||
constructor(title, type) {
|
||||
this._entries = [];
|
||||
this._requireFile = "";
|
||||
this._parallelMode = "none";
|
||||
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() : [];
|
||||
if (this.title || this._type !== "describe")
|
||||
titlePath.push(this.title);
|
||||
return titlePath;
|
||||
}
|
||||
project() {
|
||||
return this._project ?? this.parent?.project();
|
||||
}
|
||||
_addTest(test) {
|
||||
test.parent = this;
|
||||
this._entries.push(test);
|
||||
}
|
||||
_addSuite(suite) {
|
||||
suite.parent = this;
|
||||
this._entries.push(suite);
|
||||
}
|
||||
}
|
||||
class TeleTestCase {
|
||||
constructor(id, title, location, repeatEachIndex) {
|
||||
this.fn = () => {
|
||||
};
|
||||
this.results = [];
|
||||
this.type = "test";
|
||||
this.expectedStatus = "passed";
|
||||
this.timeout = 0;
|
||||
this.annotations = [];
|
||||
this.retries = 0;
|
||||
this.tags = [];
|
||||
this.repeatEachIndex = 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;
|
||||
}
|
||||
}
|
||||
class TeleTestStep {
|
||||
constructor(payload, parentStep, location, result) {
|
||||
this.duration = -1;
|
||||
this.steps = [];
|
||||
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() {
|
||||
const parentPath = this.parent?.titlePath() || [];
|
||||
return [...parentPath, this.title];
|
||||
}
|
||||
get startTime() {
|
||||
return new Date(this._startTime);
|
||||
}
|
||||
set startTime(value) {
|
||||
this._startTime = +value;
|
||||
}
|
||||
get attachments() {
|
||||
return this._endPayload?.attachments?.map((index) => this._result.attachments[index]) ?? [];
|
||||
}
|
||||
get annotations() {
|
||||
return this._endPayload?.annotations ?? [];
|
||||
}
|
||||
}
|
||||
class TeleTestResult {
|
||||
constructor(retry, id) {
|
||||
this.parallelIndex = -1;
|
||||
this.workerIndex = -1;
|
||||
this.duration = -1;
|
||||
this.stdout = [];
|
||||
this.stderr = [];
|
||||
this.attachments = [];
|
||||
this.annotations = [];
|
||||
this.status = "skipped";
|
||||
this.steps = [];
|
||||
this.errors = [];
|
||||
this._stepMap = /* @__PURE__ */ new Map();
|
||||
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;
|
||||
}
|
||||
}
|
||||
const 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: 3e5
|
||||
/* 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 !== void 0)
|
||||
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;
|
||||
} else if (result.status === "skipped" && test.expectedStatus === "skipped") {
|
||||
++skipped;
|
||||
} else if (result.status === "skipped") {
|
||||
++didNotRun;
|
||||
} else if (result.status === test.expectedStatus) {
|
||||
++expected;
|
||||
} else {
|
||||
++unexpected;
|
||||
}
|
||||
}
|
||||
if (expected === 0 && unexpected === 0)
|
||||
return "skipped";
|
||||
if (unexpected === 0)
|
||||
return "expected";
|
||||
if (expected === 0 && skipped === 0)
|
||||
return "unexpected";
|
||||
return "flaky";
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeleReporterReceiver,
|
||||
TeleSuite,
|
||||
TeleTestCase,
|
||||
TeleTestResult,
|
||||
baseFullConfig,
|
||||
computeTestCaseOutcome,
|
||||
parseRegexPatterns,
|
||||
serializeRegexPatterns
|
||||
});
|
137
node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js
generated
vendored
Normal file
137
node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var teleSuiteUpdater_exports = {};
|
||||
__export(teleSuiteUpdater_exports, {
|
||||
TeleSuiteUpdater: () => TeleSuiteUpdater
|
||||
});
|
||||
module.exports = __toCommonJS(teleSuiteUpdater_exports);
|
||||
var import_teleReceiver = require("./teleReceiver");
|
||||
var import_testTree = require("./testTree");
|
||||
class TeleSuiteUpdater {
|
||||
constructor(options) {
|
||||
this.loadErrors = [];
|
||||
this.progress = {
|
||||
total: 0,
|
||||
passed: 0,
|
||||
failed: 0,
|
||||
skipped: 0
|
||||
};
|
||||
this._lastRunTestCount = 0;
|
||||
this._receiver = new import_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;
|
||||
this._lastRunReceiver = new import_teleReceiver.TeleReporterReceiver({
|
||||
version: () => "v2",
|
||||
onBegin: (suite) => {
|
||||
this._lastRunTestCount = suite.allTests().length;
|
||||
this._lastRunReceiver = void 0;
|
||||
}
|
||||
}, {
|
||||
mergeProjects: true,
|
||||
mergeTestCases: false,
|
||||
resolvePath: (rootDir, relativePath) => rootDir + this._options.pathSeparator + relativePath
|
||||
});
|
||||
},
|
||||
onBegin: (suite) => {
|
||||
if (!this.rootSuite)
|
||||
this.rootSuite = suite;
|
||||
if (this._testResultsSnapshot) {
|
||||
for (const test of this.rootSuite.allTests())
|
||||
test.results = this._testResultsSnapshot?.get(test.id) || test.results;
|
||||
this._testResultsSnapshot = void 0;
|
||||
}
|
||||
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[import_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[import_testTree.statusEx] = testResult.status;
|
||||
this._options.onUpdate();
|
||||
},
|
||||
onError: (error) => this._handleOnError(error),
|
||||
printsToStdio: () => false
|
||||
};
|
||||
}
|
||||
processGlobalReport(report) {
|
||||
const receiver = new import_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) {
|
||||
const tests = 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) {
|
||||
this._lastRunReceiver?.dispatch(message)?.catch(() => {
|
||||
});
|
||||
this._receiver.dispatch(message)?.catch(() => {
|
||||
});
|
||||
}
|
||||
_handleOnError(error) {
|
||||
this.loadErrors.push(error);
|
||||
this._options.onError?.(error);
|
||||
this._options.onUpdate();
|
||||
}
|
||||
asModel() {
|
||||
return {
|
||||
rootSuite: this.rootSuite || new import_teleReceiver.TeleSuite("", "root"),
|
||||
config: this.config,
|
||||
loadErrors: this.loadErrors,
|
||||
progress: this.progress
|
||||
};
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TeleSuiteUpdater
|
||||
});
|
218
node_modules/playwright/lib/isomorphic/testServerConnection.js
generated
vendored
Normal file
218
node_modules/playwright/lib/isomorphic/testServerConnection.js
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testServerConnection_exports = {};
|
||||
__export(testServerConnection_exports, {
|
||||
TestServerConnection: () => TestServerConnection,
|
||||
WebSocketTestServerTransport: () => WebSocketTestServerTransport
|
||||
});
|
||||
module.exports = __toCommonJS(testServerConnection_exports);
|
||||
var events = __toESM(require("./events"));
|
||||
class WebSocketTestServerTransport {
|
||||
constructor(url) {
|
||||
this._ws = new WebSocket(url);
|
||||
}
|
||||
onmessage(listener) {
|
||||
this._ws.addEventListener("message", (event) => listener(event.data.toString()));
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
class TestServerConnection {
|
||||
constructor(transport) {
|
||||
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._onRecoverFromStepErrorEmitter = new events.EventEmitter();
|
||||
this._lastId = 0;
|
||||
this._callbacks = /* @__PURE__ */ new Map();
|
||||
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.onRecoverFromStepError = this._onRecoverFromStepErrorEmitter.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(() => {
|
||||
}), 3e4);
|
||||
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?.({ 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);
|
||||
else if (method === "recoverFromStepError")
|
||||
this._onRecoverFromStepErrorEmitter.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);
|
||||
}
|
||||
async resumeAfterStepError(params) {
|
||||
await this._sendMessage("resumeAfterStepError", params);
|
||||
}
|
||||
close() {
|
||||
try {
|
||||
this._transport.close();
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TestServerConnection,
|
||||
WebSocketTestServerTransport
|
||||
});
|
16
node_modules/playwright/lib/isomorphic/testServerInterface.js
generated
vendored
Normal file
16
node_modules/playwright/lib/isomorphic/testServerInterface.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testServerInterface_exports = {};
|
||||
module.exports = __toCommonJS(testServerInterface_exports);
|
307
node_modules/playwright/lib/isomorphic/testTree.js
generated
vendored
Normal file
307
node_modules/playwright/lib/isomorphic/testTree.js
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var testTree_exports = {};
|
||||
__export(testTree_exports, {
|
||||
TestTree: () => TestTree,
|
||||
collectTestIds: () => collectTestIds,
|
||||
sortAndPropagateStatus: () => sortAndPropagateStatus,
|
||||
statusEx: () => statusEx
|
||||
});
|
||||
module.exports = __toCommonJS(testTree_exports);
|
||||
class TestTree {
|
||||
constructor(rootFolder, rootSuite, loadErrors, projectFilters, pathSeparator) {
|
||||
this._treeItemById = /* @__PURE__ */ new Map();
|
||||
this._treeItemByTestId = /* @__PURE__ */ new Map();
|
||||
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: void 0,
|
||||
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) {
|
||||
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("") + "" + 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(""),
|
||||
title,
|
||||
parent: parentGroup,
|
||||
children: [],
|
||||
tests: [],
|
||||
location: test.location,
|
||||
duration: 0,
|
||||
status: "none",
|
||||
project: void 0,
|
||||
test: void 0,
|
||||
tags: test.tags
|
||||
};
|
||||
this._addChild(parentGroup, testCaseItem);
|
||||
}
|
||||
const result = test.results[0];
|
||||
let status = "none";
|
||||
if (result?.[statusEx] === "scheduled")
|
||||
status = "scheduled";
|
||||
else if (result?.[statusEx] === "running")
|
||||
status = "running";
|
||||
else if (result?.status === "skipped")
|
||||
status = "skipped";
|
||||
else if (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?.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?.has(t.id)))
|
||||
return false;
|
||||
testCase.children = testCase.children.filter((test) => {
|
||||
return !filtersStatuses || 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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) : /* @__PURE__ */ new Set();
|
||||
}
|
||||
}
|
||||
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 = /* @__PURE__ */ new Set();
|
||||
const visit = (treeItem2) => {
|
||||
if (treeItem2.kind === "case")
|
||||
treeItem2.tests.map((t) => t.id).forEach((id) => testIds.add(id));
|
||||
else if (treeItem2.kind === "test")
|
||||
testIds.add(treeItem2.id);
|
||||
else
|
||||
treeItem2.children?.forEach(visit);
|
||||
};
|
||||
visit(treeItem);
|
||||
return testIds;
|
||||
}
|
||||
const statusEx = Symbol("statusEx");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
TestTree,
|
||||
collectTestIds,
|
||||
sortAndPropagateStatus,
|
||||
statusEx
|
||||
});
|
16
node_modules/playwright/lib/isomorphic/types.d.js
generated
vendored
Normal file
16
node_modules/playwright/lib/isomorphic/types.d.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var types_d_exports = {};
|
||||
module.exports = __toCommonJS(types_d_exports);
|
Reference in New Issue
Block a user