mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 14:05:41 -04:00
build(deps): bump playwright from 1.49.1 to 1.50.1
This commit is contained in:
59
node_modules/playwright/lib/worker/testInfo.js
generated
vendored
59
node_modules/playwright/lib/worker/testInfo.js
generated
vendored
@@ -74,6 +74,7 @@ class TestInfoImpl {
|
||||
this._projectInternal = void 0;
|
||||
this._configInternal = void 0;
|
||||
this._steps = [];
|
||||
this._stepMap = new Map();
|
||||
this._onDidFinishTestFunction = void 0;
|
||||
this._hasNonRetriableError = false;
|
||||
this._hasUnhandledError = false;
|
||||
@@ -144,7 +145,10 @@ class TestInfoImpl {
|
||||
})();
|
||||
this._attachmentsPush = this.attachments.push.bind(this.attachments);
|
||||
this.attachments.push = (...attachments) => {
|
||||
for (const a of attachments) this._attach(a.name, a);
|
||||
for (const a of attachments) {
|
||||
var _this$_parentStep;
|
||||
this._attach(a, (_this$_parentStep = this._parentStep()) === null || _this$_parentStep === void 0 ? void 0 : _this$_parentStep.stepId);
|
||||
}
|
||||
return this.attachments.length;
|
||||
};
|
||||
this._tracing = new _testTracing.TestTracing(this, workerParams.artifactsDir);
|
||||
@@ -176,6 +180,10 @@ class TestInfoImpl {
|
||||
if (steps[i].isStage && !steps[i].endWallTime) return steps[i];
|
||||
}
|
||||
}
|
||||
_parentStep() {
|
||||
var _zones$zoneData;
|
||||
return (_zones$zoneData = _utils.zones.zoneData('stepZone')) !== null && _zones$zoneData !== void 0 ? _zones$zoneData : this._findLastStageStep(this._steps); // If no parent step on stack, assume the current stage as parent.
|
||||
}
|
||||
_addStep(data, parentStep) {
|
||||
var _parentStep, _parentStep2;
|
||||
const stepId = `${data.category}@${++this._lastStepId}`;
|
||||
@@ -183,11 +191,7 @@ class TestInfoImpl {
|
||||
// Predefined stages form a fixed hierarchy - use the current one as parent.
|
||||
parentStep = this._findLastStageStep(this._steps);
|
||||
} else {
|
||||
if (!parentStep) parentStep = _utils.zones.zoneData('stepZone');
|
||||
if (!parentStep) {
|
||||
// If no parent step on stack, assume the current stage as parent.
|
||||
parentStep = this._findLastStageStep(this._steps);
|
||||
}
|
||||
if (!parentStep) parentStep = this._parentStep();
|
||||
}
|
||||
const filteredStack = (0, _util.filteredStackTrace)((0, _utils.captureRawStack)());
|
||||
data.boxedStack = (_parentStep = parentStep) === null || _parentStep === void 0 ? void 0 : _parentStep.boxedStack;
|
||||
@@ -196,10 +200,12 @@ class TestInfoImpl {
|
||||
data.location = data.location || data.boxedStack[0];
|
||||
}
|
||||
data.location = data.location || filteredStack[0];
|
||||
const attachmentIndices = [];
|
||||
const step = {
|
||||
stepId,
|
||||
...data,
|
||||
steps: [],
|
||||
attachmentIndices,
|
||||
complete: result => {
|
||||
if (step.endWallTime) return;
|
||||
step.endWallTime = Date.now();
|
||||
@@ -235,11 +241,13 @@ class TestInfoImpl {
|
||||
message: step.error.message || '',
|
||||
stack: step.error.stack
|
||||
} : undefined;
|
||||
this._tracing.appendAfterActionForStep(stepId, errorForTrace, result.attachments);
|
||||
const attachments = attachmentIndices.map(i => this.attachments[i]);
|
||||
this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments);
|
||||
}
|
||||
};
|
||||
const parentStepList = parentStep ? parentStep.steps : this._steps;
|
||||
parentStepList.push(step);
|
||||
this._stepMap.set(stepId, step);
|
||||
const payload = {
|
||||
testId: this.testId,
|
||||
stepId,
|
||||
@@ -250,7 +258,7 @@ class TestInfoImpl {
|
||||
location: data.location
|
||||
};
|
||||
this._onStepBegin(payload);
|
||||
this._tracing.appendBeforeActionForStep(stepId, (_parentStep2 = parentStep) === null || _parentStep2 === void 0 ? void 0 : _parentStep2.stepId, data.apiName || data.title, data.params, data.location ? [data.location] : []);
|
||||
this._tracing.appendBeforeActionForStep(stepId, (_parentStep2 = parentStep) === null || _parentStep2 === void 0 ? void 0 : _parentStep2.stepId, data.category, data.apiName || data.title, data.params, data.location ? [data.location] : []);
|
||||
return step;
|
||||
}
|
||||
_interrupt() {
|
||||
@@ -330,24 +338,32 @@ class TestInfoImpl {
|
||||
// ------------ TestInfo methods ------------
|
||||
|
||||
async attach(name, options = {}) {
|
||||
this._attach(name, await (0, _util.normalizeAndSaveAttachment)(this.outputPath(), name, options));
|
||||
}
|
||||
_attach(name, attachment) {
|
||||
var _attachment$body;
|
||||
const step = this._addStep({
|
||||
title: `attach "${name}"`,
|
||||
category: 'attach'
|
||||
});
|
||||
this._attachmentsPush(attachment);
|
||||
this._attach(await (0, _util.normalizeAndSaveAttachment)(this.outputPath(), name, options), step.stepId);
|
||||
step.complete({});
|
||||
}
|
||||
_attach(attachment, stepId) {
|
||||
var _attachment$body;
|
||||
const index = this._attachmentsPush(attachment) - 1;
|
||||
if (stepId) {
|
||||
this._stepMap.get(stepId).attachmentIndices.push(index);
|
||||
} else {
|
||||
var _this$_findLastStageS;
|
||||
// trace viewer has no means of representing attachments outside of a step, so we create an artificial action
|
||||
const callId = `attach@${++this._lastStepId}`;
|
||||
this._tracing.appendBeforeActionForStep(callId, (_this$_findLastStageS = this._findLastStageStep(this._steps)) === null || _this$_findLastStageS === void 0 ? void 0 : _this$_findLastStageS.stepId, 'attach', `attach "${attachment.name}"`, undefined, []);
|
||||
this._tracing.appendAfterActionForStep(callId, undefined, [attachment]);
|
||||
}
|
||||
this._onAttach({
|
||||
testId: this.testId,
|
||||
name: attachment.name,
|
||||
contentType: attachment.contentType,
|
||||
path: attachment.path,
|
||||
body: (_attachment$body = attachment.body) === null || _attachment$body === void 0 ? void 0 : _attachment$body.toString('base64')
|
||||
});
|
||||
step.complete({
|
||||
attachments: [attachment]
|
||||
body: (_attachment$body = attachment.body) === null || _attachment$body === void 0 ? void 0 : _attachment$body.toString('base64'),
|
||||
stepId
|
||||
});
|
||||
}
|
||||
outputPath(...pathSegments) {
|
||||
@@ -367,15 +383,20 @@ class TestInfoImpl {
|
||||
const fullTitleWithoutSpec = this.titlePath.slice(1).join(' ');
|
||||
return (0, _utils.sanitizeForFilePath)((0, _util.trimLongString)(fullTitleWithoutSpec));
|
||||
}
|
||||
snapshotPath(...pathSegments) {
|
||||
_resolveSnapshotPath(template, defaultTemplate, pathSegments) {
|
||||
const subPath = _path.default.join(...pathSegments);
|
||||
const parsedSubPath = _path.default.parse(subPath);
|
||||
const relativeTestFilePath = _path.default.relative(this.project.testDir, this._requireFile);
|
||||
const parsedRelativeTestFilePath = _path.default.parse(relativeTestFilePath);
|
||||
const projectNamePathSegment = (0, _utils.sanitizeForFilePath)(this.project.name);
|
||||
const snapshotPath = (this._projectInternal.snapshotPathTemplate || '').replace(/\{(.)?testDir\}/g, '$1' + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, '$1' + this.project.snapshotDir).replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '').replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, '$1' + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '').replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName()).replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, '$1' + relativeTestFilePath).replace(/\{(.)?arg\}/g, '$1' + _path.default.join(parsedSubPath.dir, parsedSubPath.name)).replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');
|
||||
const actualTemplate = template || this._projectInternal.snapshotPathTemplate || defaultTemplate;
|
||||
const snapshotPath = actualTemplate.replace(/\{(.)?testDir\}/g, '$1' + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, '$1' + this.project.snapshotDir).replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '').replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, '$1' + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '').replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName()).replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, '$1' + relativeTestFilePath).replace(/\{(.)?arg\}/g, '$1' + _path.default.join(parsedSubPath.dir, parsedSubPath.name)).replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');
|
||||
return _path.default.normalize(_path.default.resolve(this._configInternal.configDir, snapshotPath));
|
||||
}
|
||||
snapshotPath(...pathSegments) {
|
||||
const legacyTemplate = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}';
|
||||
return this._resolveSnapshotPath(undefined, legacyTemplate, pathSegments);
|
||||
}
|
||||
skip(...args) {
|
||||
this._modifier('skip', args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user