playwright-opentelemetry 0.13.6 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{config-DhuwcBzL.d.cts → config-DFY22ysa.d.cts} +5 -0
- package/dist/{config-DhuwcBzL.d.mts → config-DFY22ysa.d.mts} +5 -0
- package/dist/fixture.cjs +433 -14
- package/dist/fixture.d.cts +51 -2
- package/dist/fixture.d.mts +51 -2
- package/dist/fixture.mjs +420 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{reporter-DCwosQMM.mjs → reporter-CWAovnMj.mjs} +95 -60
- package/dist/{reporter-CzP9uSdk.cjs → reporter-DMlPQnrW.cjs} +115 -80
- package/dist/reporter.cjs +1 -1
- package/dist/reporter.mjs +1 -1
- package/dist/{config-knifnJua.cjs → screenshots-zip-B07U2DaB.cjs} +145 -1
- package/dist/{config-CNqq0WLw.mjs → screenshots-zip-DXk2R8_S.mjs} +110 -2
- package/package.json +1 -1
|
@@ -20,8 +20,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
//#endregion
|
|
23
|
+
let _zip_js_zip_js = require("@zip.js/zip.js");
|
|
23
24
|
//#region package.json
|
|
24
|
-
var version = "0.
|
|
25
|
+
var version = "0.14.0";
|
|
25
26
|
const PLAYWRIGHT_TRACE_API_SOURCE_HEADER = "x-playwright-otel-source";
|
|
26
27
|
const PLAYWRIGHT_TRACE_API_SOURCE_REPORTER = "reporter";
|
|
27
28
|
function withPlaywrightTraceApiHeaders(headers) {
|
|
@@ -226,7 +227,15 @@ async function createTestTraceContext(testInfo) {
|
|
|
226
227
|
});
|
|
227
228
|
return traceContext;
|
|
228
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Writes the expected-trace marker that lets the Trace API admit spans from the
|
|
232
|
+
* app under test. Only browser requests carry the test's traceparent, so the
|
|
233
|
+
* marker is skipped when propagation is off; the fixture's own spans are
|
|
234
|
+
* trusted and stored without it. Never rejects, so callers can start it
|
|
235
|
+
* without awaiting.
|
|
236
|
+
*/
|
|
229
237
|
async function registerExpectedTrace(traceContext, config, options) {
|
|
238
|
+
if (!config.propagateTraceHeaders) return;
|
|
230
239
|
const couldRetainTrace = (trace) => couldRetainPlaywrightTrace(trace ?? options.trace, options.testInfo);
|
|
231
240
|
const destinations = filterRetainedDestinations(config.playwrightTraceApiDestinations, config.trace, couldRetainTrace);
|
|
232
241
|
if (destinations.length === 0) return;
|
|
@@ -316,6 +325,7 @@ function resolvePlaywrightOpentelemetryConfig(config, options = {}) {
|
|
|
316
325
|
}),
|
|
317
326
|
storeTraceZip: config?.storeTraceZip === true,
|
|
318
327
|
trace: config?.trace ?? null,
|
|
328
|
+
screenshots: config?.screenshots ?? true,
|
|
319
329
|
propagateTraceHeaders: config?.propagateTraceHeaders ?? true,
|
|
320
330
|
debug: debugEnv === void 0 ? config?.debug ?? false : debugEnv === "1" || debugEnv === "true"
|
|
321
331
|
};
|
|
@@ -357,6 +367,104 @@ function getConfigurationErrorMessage() {
|
|
|
357
367
|
return "playwright-opentelemetry reporter requires an OTLP endpoint, trace API endpoint, or storeTraceZip to be configured.\n\nYou can configure it using environment variables:\n\n export OTEL_EXPORTER_OTLP_ENDPOINT=\"https://api.honeycomb.io\"\n export OTEL_EXPORTER_OTLP_HEADERS=\"x-honeycomb-team=YOUR_API_KEY\"\n\nOr via playwright.config.ts:\n\nimport { defineConfig } from '@playwright/test';\nimport type { PlaywrightOpentelemetryUseOptions } from 'playwright-opentelemetry/fixture';\n\nexport default defineConfig<PlaywrightOpentelemetryUseOptions>({\n use: {\n playwrightOpentelemetry: {\n otlpEndpoint: {\n url: 'http://localhost:4317/v1/traces',\n headers: {\n Authorization: 'Bearer YOUR_TOKEN',\n },\n },\n },\n },\n reporter: [['playwright-opentelemetry/reporter']],\n});\n\nNote: Environment variables take precedence over use.playwrightOpentelemetry options.\n";
|
|
358
368
|
}
|
|
359
369
|
//#endregion
|
|
370
|
+
//#region src/shared/screencast-screenshots.ts
|
|
371
|
+
/**
|
|
372
|
+
* The first Playwright version whose screencast frames carry the browser's
|
|
373
|
+
* presentation timestamp (1.61) and viewport size (1.60), and whose browsers
|
|
374
|
+
* report new contexts (1.60).
|
|
375
|
+
*
|
|
376
|
+
* From this version, screenshots only come from the fixture's screencast
|
|
377
|
+
* capture: tests without the fixture get none. Before it, the fixture
|
|
378
|
+
* captures nothing and the reporter reads screenshots from Playwright's
|
|
379
|
+
* trace.zip (see reporter/legacy/). Once the peer dependency requires this
|
|
380
|
+
* version, delete this module and that legacy path.
|
|
381
|
+
*/
|
|
382
|
+
const SCREENCAST_SCREENSHOTS_MIN_PLAYWRIGHT_VERSION = "1.61.0";
|
|
383
|
+
/** Whether this Playwright version's screencast can provide screenshots. */
|
|
384
|
+
function supportsScreencastScreenshots(playwrightVersion) {
|
|
385
|
+
const version = parseVersion(playwrightVersion);
|
|
386
|
+
const minimum = parseVersion(SCREENCAST_SCREENSHOTS_MIN_PLAYWRIGHT_VERSION);
|
|
387
|
+
if (!version || !minimum) return false;
|
|
388
|
+
for (let index = 0; index < minimum.length; index++) if (version[index] !== minimum[index]) return version[index] > minimum[index];
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Major, minor and patch of a version such as "1.61.0" or "1.61.0-next".
|
|
393
|
+
* Prereleases count as their release: 1.61.0-next already has the API.
|
|
394
|
+
*/
|
|
395
|
+
function parseVersion(version) {
|
|
396
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
|
|
397
|
+
return match ? [
|
|
398
|
+
Number(match[1]),
|
|
399
|
+
Number(match[2]),
|
|
400
|
+
Number(match[3])
|
|
401
|
+
] : void 0;
|
|
402
|
+
}
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/shared/screenshots-zip.ts
|
|
405
|
+
/**
|
|
406
|
+
* The fixture attaches captured screencast frames to the test result as a
|
|
407
|
+
* screenshots ZIP under this name; the reporter uploads it and copies it into
|
|
408
|
+
* the local trace ZIP.
|
|
409
|
+
*/
|
|
410
|
+
const SCREENSHOTS_ATTACHMENT_NAME = "playwright-opentelemetry-screenshots";
|
|
411
|
+
const MANIFEST_PATH = "manifest.json";
|
|
412
|
+
const SCREENSHOTS_DIR = "screenshots/";
|
|
413
|
+
async function createScreenshotsZip(screenshots) {
|
|
414
|
+
const zipWriter = new _zip_js_zip_js.ZipWriter(new _zip_js_zip_js.BlobWriter("application/zip"));
|
|
415
|
+
await addScreenshotsToZip(zipWriter, screenshots);
|
|
416
|
+
return zipWriter.close();
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Add the manifest and frames of a screenshots ZIP to another ZIP, so the same
|
|
420
|
+
* layout can be uploaded on its own or embedded in a local trace ZIP.
|
|
421
|
+
*/
|
|
422
|
+
async function addScreenshotsToZip(zipWriter, screenshots) {
|
|
423
|
+
const sorted = [...screenshots].sort((a, b) => a.timestamp - b.timestamp);
|
|
424
|
+
const manifest = {
|
|
425
|
+
version: 3,
|
|
426
|
+
screenshots: sorted.map((screenshot) => ({
|
|
427
|
+
timestamp: screenshot.timestamp,
|
|
428
|
+
file: screenshot.file,
|
|
429
|
+
path: `${SCREENSHOTS_DIR}${screenshot.file}`,
|
|
430
|
+
contentType: screenshot.contentType,
|
|
431
|
+
pageId: screenshot.pageId,
|
|
432
|
+
...viewportOf(screenshot)
|
|
433
|
+
}))
|
|
434
|
+
};
|
|
435
|
+
await zipWriter.add(MANIFEST_PATH, new Blob([JSON.stringify(manifest, null, 2)], { type: "application/json" }).stream());
|
|
436
|
+
for (const screenshot of sorted) await zipWriter.add(`${SCREENSHOTS_DIR}${screenshot.file}`, screenshot.blob.stream(), { level: 0 });
|
|
437
|
+
}
|
|
438
|
+
async function readScreenshotsZip(zipBlob) {
|
|
439
|
+
const zipReader = new _zip_js_zip_js.ZipReader(new _zip_js_zip_js.BlobReader(zipBlob));
|
|
440
|
+
try {
|
|
441
|
+
const entries = new Map((await zipReader.getEntries()).filter((entry) => !entry.directory).map((entry) => [entry.filename, entry]));
|
|
442
|
+
const manifestEntry = entries.get(MANIFEST_PATH);
|
|
443
|
+
if (!manifestEntry) throw new Error(`Screenshots ZIP has no ${MANIFEST_PATH}`);
|
|
444
|
+
const manifest = JSON.parse(await manifestEntry.getData(new _zip_js_zip_js.TextWriter()));
|
|
445
|
+
return await Promise.all(manifest.screenshots.map(async (screenshot) => {
|
|
446
|
+
const entry = entries.get(screenshot.path);
|
|
447
|
+
if (!entry) throw new Error(`Screenshots ZIP has no ${screenshot.path}`);
|
|
448
|
+
return {
|
|
449
|
+
timestamp: screenshot.timestamp,
|
|
450
|
+
file: screenshot.file,
|
|
451
|
+
contentType: screenshot.contentType,
|
|
452
|
+
pageId: screenshot.pageId,
|
|
453
|
+
...viewportOf(screenshot),
|
|
454
|
+
blob: await entry.getData(new _zip_js_zip_js.BlobWriter(screenshot.contentType))
|
|
455
|
+
};
|
|
456
|
+
}));
|
|
457
|
+
} finally {
|
|
458
|
+
await zipReader.close();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function viewportOf(screenshot) {
|
|
462
|
+
return screenshot.viewportWidth !== void 0 && screenshot.viewportHeight !== void 0 ? {
|
|
463
|
+
viewportWidth: screenshot.viewportWidth,
|
|
464
|
+
viewportHeight: screenshot.viewportHeight
|
|
465
|
+
} : {};
|
|
466
|
+
}
|
|
467
|
+
//#endregion
|
|
360
468
|
Object.defineProperty(exports, "BROWSER_SERVICE_NAME", {
|
|
361
469
|
enumerable: true,
|
|
362
470
|
get: function() {
|
|
@@ -381,6 +489,12 @@ Object.defineProperty(exports, "PLAYWRIGHT_TRACE_API_SOURCE_REPORTER", {
|
|
|
381
489
|
return PLAYWRIGHT_TRACE_API_SOURCE_REPORTER;
|
|
382
490
|
}
|
|
383
491
|
});
|
|
492
|
+
Object.defineProperty(exports, "SCREENSHOTS_ATTACHMENT_NAME", {
|
|
493
|
+
enumerable: true,
|
|
494
|
+
get: function() {
|
|
495
|
+
return SCREENSHOTS_ATTACHMENT_NAME;
|
|
496
|
+
}
|
|
497
|
+
});
|
|
384
498
|
Object.defineProperty(exports, "TRACE_CONTEXT_ATTACHMENT_NAME", {
|
|
385
499
|
enumerable: true,
|
|
386
500
|
get: function() {
|
|
@@ -393,12 +507,30 @@ Object.defineProperty(exports, "__toESM", {
|
|
|
393
507
|
return __toESM;
|
|
394
508
|
}
|
|
395
509
|
});
|
|
510
|
+
Object.defineProperty(exports, "addScreenshotsToZip", {
|
|
511
|
+
enumerable: true,
|
|
512
|
+
get: function() {
|
|
513
|
+
return addScreenshotsToZip;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
396
516
|
Object.defineProperty(exports, "buildOtlpRequest", {
|
|
397
517
|
enumerable: true,
|
|
398
518
|
get: function() {
|
|
399
519
|
return buildOtlpRequest;
|
|
400
520
|
}
|
|
401
521
|
});
|
|
522
|
+
Object.defineProperty(exports, "couldRetainPlaywrightTrace", {
|
|
523
|
+
enumerable: true,
|
|
524
|
+
get: function() {
|
|
525
|
+
return couldRetainPlaywrightTrace;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
Object.defineProperty(exports, "createScreenshotsZip", {
|
|
529
|
+
enumerable: true,
|
|
530
|
+
get: function() {
|
|
531
|
+
return createScreenshotsZip;
|
|
532
|
+
}
|
|
533
|
+
});
|
|
402
534
|
Object.defineProperty(exports, "createTestTraceContext", {
|
|
403
535
|
enumerable: true,
|
|
404
536
|
get: function() {
|
|
@@ -429,6 +561,12 @@ Object.defineProperty(exports, "generateTraceId", {
|
|
|
429
561
|
return generateTraceId;
|
|
430
562
|
}
|
|
431
563
|
});
|
|
564
|
+
Object.defineProperty(exports, "readScreenshotsZip", {
|
|
565
|
+
enumerable: true,
|
|
566
|
+
get: function() {
|
|
567
|
+
return readScreenshotsZip;
|
|
568
|
+
}
|
|
569
|
+
});
|
|
432
570
|
Object.defineProperty(exports, "registerExpectedTrace", {
|
|
433
571
|
enumerable: true,
|
|
434
572
|
get: function() {
|
|
@@ -453,6 +591,12 @@ Object.defineProperty(exports, "shouldRetainPlaywrightTrace", {
|
|
|
453
591
|
return shouldRetainPlaywrightTrace;
|
|
454
592
|
}
|
|
455
593
|
});
|
|
594
|
+
Object.defineProperty(exports, "supportsScreencastScreenshots", {
|
|
595
|
+
enumerable: true,
|
|
596
|
+
get: function() {
|
|
597
|
+
return supportsScreencastScreenshots;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
456
600
|
Object.defineProperty(exports, "withPlaywrightTraceApiHeaders", {
|
|
457
601
|
enumerable: true,
|
|
458
602
|
get: function() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BlobReader, BlobWriter, TextWriter, ZipReader, ZipWriter } from "@zip.js/zip.js";
|
|
1
2
|
//#region package.json
|
|
2
|
-
var version = "0.
|
|
3
|
+
var version = "0.14.0";
|
|
3
4
|
const PLAYWRIGHT_TRACE_API_SOURCE_HEADER = "x-playwright-otel-source";
|
|
4
5
|
const PLAYWRIGHT_TRACE_API_SOURCE_REPORTER = "reporter";
|
|
5
6
|
function withPlaywrightTraceApiHeaders(headers) {
|
|
@@ -204,7 +205,15 @@ async function createTestTraceContext(testInfo) {
|
|
|
204
205
|
});
|
|
205
206
|
return traceContext;
|
|
206
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Writes the expected-trace marker that lets the Trace API admit spans from the
|
|
210
|
+
* app under test. Only browser requests carry the test's traceparent, so the
|
|
211
|
+
* marker is skipped when propagation is off; the fixture's own spans are
|
|
212
|
+
* trusted and stored without it. Never rejects, so callers can start it
|
|
213
|
+
* without awaiting.
|
|
214
|
+
*/
|
|
207
215
|
async function registerExpectedTrace(traceContext, config, options) {
|
|
216
|
+
if (!config.propagateTraceHeaders) return;
|
|
208
217
|
const couldRetainTrace = (trace) => couldRetainPlaywrightTrace(trace ?? options.trace, options.testInfo);
|
|
209
218
|
const destinations = filterRetainedDestinations(config.playwrightTraceApiDestinations, config.trace, couldRetainTrace);
|
|
210
219
|
if (destinations.length === 0) return;
|
|
@@ -294,6 +303,7 @@ function resolvePlaywrightOpentelemetryConfig(config, options = {}) {
|
|
|
294
303
|
}),
|
|
295
304
|
storeTraceZip: config?.storeTraceZip === true,
|
|
296
305
|
trace: config?.trace ?? null,
|
|
306
|
+
screenshots: config?.screenshots ?? true,
|
|
297
307
|
propagateTraceHeaders: config?.propagateTraceHeaders ?? true,
|
|
298
308
|
debug: debugEnv === void 0 ? config?.debug ?? false : debugEnv === "1" || debugEnv === "true"
|
|
299
309
|
};
|
|
@@ -335,4 +345,102 @@ function getConfigurationErrorMessage() {
|
|
|
335
345
|
return "playwright-opentelemetry reporter requires an OTLP endpoint, trace API endpoint, or storeTraceZip to be configured.\n\nYou can configure it using environment variables:\n\n export OTEL_EXPORTER_OTLP_ENDPOINT=\"https://api.honeycomb.io\"\n export OTEL_EXPORTER_OTLP_HEADERS=\"x-honeycomb-team=YOUR_API_KEY\"\n\nOr via playwright.config.ts:\n\nimport { defineConfig } from '@playwright/test';\nimport type { PlaywrightOpentelemetryUseOptions } from 'playwright-opentelemetry/fixture';\n\nexport default defineConfig<PlaywrightOpentelemetryUseOptions>({\n use: {\n playwrightOpentelemetry: {\n otlpEndpoint: {\n url: 'http://localhost:4317/v1/traces',\n headers: {\n Authorization: 'Bearer YOUR_TOKEN',\n },\n },\n },\n },\n reporter: [['playwright-opentelemetry/reporter']],\n});\n\nNote: Environment variables take precedence over use.playwrightOpentelemetry options.\n";
|
|
336
346
|
}
|
|
337
347
|
//#endregion
|
|
338
|
-
|
|
348
|
+
//#region src/shared/screencast-screenshots.ts
|
|
349
|
+
/**
|
|
350
|
+
* The first Playwright version whose screencast frames carry the browser's
|
|
351
|
+
* presentation timestamp (1.61) and viewport size (1.60), and whose browsers
|
|
352
|
+
* report new contexts (1.60).
|
|
353
|
+
*
|
|
354
|
+
* From this version, screenshots only come from the fixture's screencast
|
|
355
|
+
* capture: tests without the fixture get none. Before it, the fixture
|
|
356
|
+
* captures nothing and the reporter reads screenshots from Playwright's
|
|
357
|
+
* trace.zip (see reporter/legacy/). Once the peer dependency requires this
|
|
358
|
+
* version, delete this module and that legacy path.
|
|
359
|
+
*/
|
|
360
|
+
const SCREENCAST_SCREENSHOTS_MIN_PLAYWRIGHT_VERSION = "1.61.0";
|
|
361
|
+
/** Whether this Playwright version's screencast can provide screenshots. */
|
|
362
|
+
function supportsScreencastScreenshots(playwrightVersion) {
|
|
363
|
+
const version = parseVersion(playwrightVersion);
|
|
364
|
+
const minimum = parseVersion(SCREENCAST_SCREENSHOTS_MIN_PLAYWRIGHT_VERSION);
|
|
365
|
+
if (!version || !minimum) return false;
|
|
366
|
+
for (let index = 0; index < minimum.length; index++) if (version[index] !== minimum[index]) return version[index] > minimum[index];
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Major, minor and patch of a version such as "1.61.0" or "1.61.0-next".
|
|
371
|
+
* Prereleases count as their release: 1.61.0-next already has the API.
|
|
372
|
+
*/
|
|
373
|
+
function parseVersion(version) {
|
|
374
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
|
|
375
|
+
return match ? [
|
|
376
|
+
Number(match[1]),
|
|
377
|
+
Number(match[2]),
|
|
378
|
+
Number(match[3])
|
|
379
|
+
] : void 0;
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/shared/screenshots-zip.ts
|
|
383
|
+
/**
|
|
384
|
+
* The fixture attaches captured screencast frames to the test result as a
|
|
385
|
+
* screenshots ZIP under this name; the reporter uploads it and copies it into
|
|
386
|
+
* the local trace ZIP.
|
|
387
|
+
*/
|
|
388
|
+
const SCREENSHOTS_ATTACHMENT_NAME = "playwright-opentelemetry-screenshots";
|
|
389
|
+
const MANIFEST_PATH = "manifest.json";
|
|
390
|
+
const SCREENSHOTS_DIR = "screenshots/";
|
|
391
|
+
async function createScreenshotsZip(screenshots) {
|
|
392
|
+
const zipWriter = new ZipWriter(new BlobWriter("application/zip"));
|
|
393
|
+
await addScreenshotsToZip(zipWriter, screenshots);
|
|
394
|
+
return zipWriter.close();
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Add the manifest and frames of a screenshots ZIP to another ZIP, so the same
|
|
398
|
+
* layout can be uploaded on its own or embedded in a local trace ZIP.
|
|
399
|
+
*/
|
|
400
|
+
async function addScreenshotsToZip(zipWriter, screenshots) {
|
|
401
|
+
const sorted = [...screenshots].sort((a, b) => a.timestamp - b.timestamp);
|
|
402
|
+
const manifest = {
|
|
403
|
+
version: 3,
|
|
404
|
+
screenshots: sorted.map((screenshot) => ({
|
|
405
|
+
timestamp: screenshot.timestamp,
|
|
406
|
+
file: screenshot.file,
|
|
407
|
+
path: `${SCREENSHOTS_DIR}${screenshot.file}`,
|
|
408
|
+
contentType: screenshot.contentType,
|
|
409
|
+
pageId: screenshot.pageId,
|
|
410
|
+
...viewportOf(screenshot)
|
|
411
|
+
}))
|
|
412
|
+
};
|
|
413
|
+
await zipWriter.add(MANIFEST_PATH, new Blob([JSON.stringify(manifest, null, 2)], { type: "application/json" }).stream());
|
|
414
|
+
for (const screenshot of sorted) await zipWriter.add(`${SCREENSHOTS_DIR}${screenshot.file}`, screenshot.blob.stream(), { level: 0 });
|
|
415
|
+
}
|
|
416
|
+
async function readScreenshotsZip(zipBlob) {
|
|
417
|
+
const zipReader = new ZipReader(new BlobReader(zipBlob));
|
|
418
|
+
try {
|
|
419
|
+
const entries = new Map((await zipReader.getEntries()).filter((entry) => !entry.directory).map((entry) => [entry.filename, entry]));
|
|
420
|
+
const manifestEntry = entries.get(MANIFEST_PATH);
|
|
421
|
+
if (!manifestEntry) throw new Error(`Screenshots ZIP has no ${MANIFEST_PATH}`);
|
|
422
|
+
const manifest = JSON.parse(await manifestEntry.getData(new TextWriter()));
|
|
423
|
+
return await Promise.all(manifest.screenshots.map(async (screenshot) => {
|
|
424
|
+
const entry = entries.get(screenshot.path);
|
|
425
|
+
if (!entry) throw new Error(`Screenshots ZIP has no ${screenshot.path}`);
|
|
426
|
+
return {
|
|
427
|
+
timestamp: screenshot.timestamp,
|
|
428
|
+
file: screenshot.file,
|
|
429
|
+
contentType: screenshot.contentType,
|
|
430
|
+
pageId: screenshot.pageId,
|
|
431
|
+
...viewportOf(screenshot),
|
|
432
|
+
blob: await entry.getData(new BlobWriter(screenshot.contentType))
|
|
433
|
+
};
|
|
434
|
+
}));
|
|
435
|
+
} finally {
|
|
436
|
+
await zipReader.close();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function viewportOf(screenshot) {
|
|
440
|
+
return screenshot.viewportWidth !== void 0 && screenshot.viewportHeight !== void 0 ? {
|
|
441
|
+
viewportWidth: screenshot.viewportWidth,
|
|
442
|
+
viewportHeight: screenshot.viewportHeight
|
|
443
|
+
} : {};
|
|
444
|
+
}
|
|
445
|
+
//#endregion
|
|
446
|
+
export { withPlaywrightTraceApiHeaders as S, PLAYWRIGHT_TRACE_API_SOURCE_REPORTER as _, supportsScreencastScreenshots as a, generateTraceId as b, FIXTURE_SPANS_ATTACHMENT_NAME as c, flushFixtureSpans as d, registerExpectedTrace as f, PLAYWRIGHT_TRACE_API_SOURCE_HEADER as g, filterRetainedDestinations as h, readScreenshotsZip as i, TRACE_CONTEXT_ATTACHMENT_NAME as l, shouldRetainPlaywrightTrace as m, addScreenshotsToZip as n, resolvePlaywrightOpentelemetryConfig as o, couldRetainPlaywrightTrace as p, createScreenshotsZip as r, BROWSER_SERVICE_NAME as s, SCREENSHOTS_ATTACHMENT_NAME as t, createTestTraceContext as u, buildOtlpRequest as v, sendSpans as x, generateSpanId as y };
|