playwright-opentelemetry 0.13.0 → 0.13.2

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 CHANGED
@@ -87,3 +87,16 @@ Full documentation, including trace retention options, screenshot capture, multi
87
87
  ## License
88
88
 
89
89
  [Apache-2.0](https://github.com/endformdev/playwright-opentelemetry/blob/main/LICENSE), built by [Endform](https://endform.dev).
90
+
91
+ ### Browser navigation indexes
92
+
93
+ Document load spans (`browser.page`) carry `browser.page.navigation.index`,
94
+ starting at 0 and increasing for each document span within the same Playwright
95
+ page (`browser.page.id`). Reloads also advance this index.
96
+
97
+ SPA navigation spans (`browser.route`) carry the enclosing document's
98
+ `browser.page.navigation.index` and their own `browser.route.navigation.index`.
99
+ The route index starts at 0 and resets on each document load. Ignored URL updates,
100
+ such as hash-only changes, do not advance it. Each Playwright page has independent
101
+ counters. If a route is observed without a captured document load, only its route
102
+ index is present.
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.13.0";
2
+ var version = "0.13.2";
3
3
  const PLAYWRIGHT_TRACE_API_SOURCE_HEADER = "x-playwright-otel-source";
4
4
  const PLAYWRIGHT_TRACE_API_SOURCE_REPORTER = "reporter";
5
5
  function withPlaywrightTraceApiHeaders(headers) {
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
  //#endregion
23
23
  //#region package.json
24
- var version = "0.13.0";
24
+ var version = "0.13.2";
25
25
  const PLAYWRIGHT_TRACE_API_SOURCE_HEADER = "x-playwright-otel-source";
26
26
  const PLAYWRIGHT_TRACE_API_SOURCE_REPORTER = "reporter";
27
27
  function withPlaywrightTraceApiHeaders(headers) {
@@ -2,7 +2,11 @@
2
2
  type PlaywrightTraceMode = "off" | "on" | "retain-on-failure" | "on-first-retry" | "on-all-retries" | "retain-on-first-failure" | "retain-on-failure-and-retries";
3
3
  type PlaywrightTraceOption = PlaywrightTraceMode | "retry-with-trace" | {
4
4
  mode: PlaywrightTraceMode;
5
- snapshots?: boolean;
5
+ snapshots?: boolean | {
6
+ dom?: boolean;
7
+ aria?: boolean;
8
+ screen?: boolean;
9
+ };
6
10
  screenshots?: boolean;
7
11
  sources?: boolean;
8
12
  attachments?: boolean;
@@ -2,7 +2,11 @@
2
2
  type PlaywrightTraceMode = "off" | "on" | "retain-on-failure" | "on-first-retry" | "on-all-retries" | "retain-on-first-failure" | "retain-on-failure-and-retries";
3
3
  type PlaywrightTraceOption = PlaywrightTraceMode | "retry-with-trace" | {
4
4
  mode: PlaywrightTraceMode;
5
- snapshots?: boolean;
5
+ snapshots?: boolean | {
6
+ dom?: boolean;
7
+ aria?: boolean;
8
+ screen?: boolean;
9
+ };
6
10
  screenshots?: boolean;
7
11
  sources?: boolean;
8
12
  attachments?: boolean;
package/dist/fixture.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_config = require("./config-DTMVyy76.cjs");
2
+ const require_config = require("./config-BP1kyuMh.cjs");
3
3
  let node_path = require("node:path");
4
4
  node_path = require_config.__toESM(node_path, 1);
5
5
  let _playwright_test = require("@playwright/test");
@@ -96,8 +96,11 @@ var BrowserPageTracker = class {
96
96
  startDocumentPageSpan(page, url, startTime) {
97
97
  const state = this.stateFor(page);
98
98
  this.finishPageSpans(page, startTime);
99
+ state.documentIndex += 1;
100
+ state.routeIndex = -1;
99
101
  const span = this.createBrowserSpan({
100
102
  pageId: state.pageId,
103
+ documentIndex: state.documentIndex,
101
104
  name: BROWSER_PAGE_SPAN_NAME,
102
105
  url,
103
106
  navigationType: "document",
@@ -117,6 +120,8 @@ var BrowserPageTracker = class {
117
120
  this.finishRouteSpan(state, startTime);
118
121
  const span = this.createBrowserSpan({
119
122
  pageId: state.pageId,
123
+ documentIndex: state.documentIndex >= 0 ? state.documentIndex : void 0,
124
+ routeIndex: ++state.routeIndex,
120
125
  name: BROWSER_ROUTE_SPAN_NAME,
121
126
  url,
122
127
  navigationType: "same-document",
@@ -155,12 +160,14 @@ var BrowserPageTracker = class {
155
160
  if (existing) return existing;
156
161
  const state = {
157
162
  pageId: `page-${this.nextPageId++}`,
158
- lastUrl: page.url()
163
+ lastUrl: page.url(),
164
+ documentIndex: -1,
165
+ routeIndex: -1
159
166
  };
160
167
  this.pageStates.set(page, state);
161
168
  return state;
162
169
  }
163
- createBrowserSpan({ pageId, name, url, navigationType, parentSpanId, startTime, previousUrl, documentUrl }) {
170
+ createBrowserSpan({ pageId, documentIndex, routeIndex, name, url, navigationType, parentSpanId, startTime, previousUrl, documentUrl }) {
164
171
  return {
165
172
  traceId: this.traceContext.traceId,
166
173
  spanId: require_config.generateSpanId(),
@@ -171,6 +178,8 @@ var BrowserPageTracker = class {
171
178
  status: { code: SPAN_STATUS_CODE_UNSET$3 },
172
179
  attributes: pageAttributes({
173
180
  pageId,
181
+ documentIndex,
182
+ routeIndex,
174
183
  url,
175
184
  navigationType,
176
185
  previousUrl,
@@ -194,7 +203,7 @@ function consoleSeverityText(type) {
194
203
  function consoleLocationLine(location) {
195
204
  return location.line ?? location.lineNumber;
196
205
  }
197
- function pageAttributes({ pageId, url, navigationType, previousUrl, documentUrl }) {
206
+ function pageAttributes({ pageId, documentIndex, routeIndex, url, navigationType, previousUrl, documentUrl }) {
198
207
  const attributes = {
199
208
  "browser.resource.type": navigationType === "document" ? "page" : "route",
200
209
  "browser.page.id": pageId,
@@ -206,6 +215,8 @@ function pageAttributes({ pageId, url, navigationType, previousUrl, documentUrl
206
215
  attributes["url.path"] = parsedUrl.pathname;
207
216
  if (parsedUrl.search) attributes["url.query"] = parsedUrl.search.slice(1);
208
217
  } catch {}
218
+ if (documentIndex !== void 0) attributes["browser.page.navigation.index"] = documentIndex;
219
+ if (routeIndex !== void 0) attributes["browser.route.navigation.index"] = routeIndex;
209
220
  if (previousUrl) attributes["browser.route.previous_url"] = previousUrl;
210
221
  if (documentUrl) attributes["browser.document.url"] = documentUrl;
211
222
  return attributes;
@@ -1,4 +1,4 @@
1
- import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-D-3pnapc.cjs";
1
+ import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-DhuwcBzL.cjs";
2
2
  import { n as SpanEvent, t as Span } from "./otel-D0ztpic2.cjs";
3
3
  import { ConsoleMessage, Page, Request } from "@playwright/test";
4
4
  export * from "@playwright/test";
@@ -1,4 +1,4 @@
1
- import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-D-3pnapc.mjs";
1
+ import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-DhuwcBzL.mjs";
2
2
  import { n as SpanEvent, t as Span } from "./otel-D0ztpic2.mjs";
3
3
  import { ConsoleMessage, Page, Request } from "@playwright/test";
4
4
  export * from "@playwright/test";
package/dist/fixture.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as createTestTraceContext, n as BROWSER_SERVICE_NAME, o as flushFixtureSpans, p as generateSpanId, s as registerExpectedTrace, t as resolvePlaywrightOpentelemetryConfig } from "./config-ChGo0Y1S.mjs";
1
+ import { a as createTestTraceContext, n as BROWSER_SERVICE_NAME, o as flushFixtureSpans, p as generateSpanId, s as registerExpectedTrace, t as resolvePlaywrightOpentelemetryConfig } from "./config-BK6F0OO5.mjs";
2
2
  import path from "node:path";
3
3
  import { test as test$1 } from "@playwright/test";
4
4
  export * from "@playwright/test";
@@ -95,8 +95,11 @@ var BrowserPageTracker = class {
95
95
  startDocumentPageSpan(page, url, startTime) {
96
96
  const state = this.stateFor(page);
97
97
  this.finishPageSpans(page, startTime);
98
+ state.documentIndex += 1;
99
+ state.routeIndex = -1;
98
100
  const span = this.createBrowserSpan({
99
101
  pageId: state.pageId,
102
+ documentIndex: state.documentIndex,
100
103
  name: BROWSER_PAGE_SPAN_NAME,
101
104
  url,
102
105
  navigationType: "document",
@@ -116,6 +119,8 @@ var BrowserPageTracker = class {
116
119
  this.finishRouteSpan(state, startTime);
117
120
  const span = this.createBrowserSpan({
118
121
  pageId: state.pageId,
122
+ documentIndex: state.documentIndex >= 0 ? state.documentIndex : void 0,
123
+ routeIndex: ++state.routeIndex,
119
124
  name: BROWSER_ROUTE_SPAN_NAME,
120
125
  url,
121
126
  navigationType: "same-document",
@@ -154,12 +159,14 @@ var BrowserPageTracker = class {
154
159
  if (existing) return existing;
155
160
  const state = {
156
161
  pageId: `page-${this.nextPageId++}`,
157
- lastUrl: page.url()
162
+ lastUrl: page.url(),
163
+ documentIndex: -1,
164
+ routeIndex: -1
158
165
  };
159
166
  this.pageStates.set(page, state);
160
167
  return state;
161
168
  }
162
- createBrowserSpan({ pageId, name, url, navigationType, parentSpanId, startTime, previousUrl, documentUrl }) {
169
+ createBrowserSpan({ pageId, documentIndex, routeIndex, name, url, navigationType, parentSpanId, startTime, previousUrl, documentUrl }) {
163
170
  return {
164
171
  traceId: this.traceContext.traceId,
165
172
  spanId: generateSpanId(),
@@ -170,6 +177,8 @@ var BrowserPageTracker = class {
170
177
  status: { code: SPAN_STATUS_CODE_UNSET$3 },
171
178
  attributes: pageAttributes({
172
179
  pageId,
180
+ documentIndex,
181
+ routeIndex,
173
182
  url,
174
183
  navigationType,
175
184
  previousUrl,
@@ -193,7 +202,7 @@ function consoleSeverityText(type) {
193
202
  function consoleLocationLine(location) {
194
203
  return location.line ?? location.lineNumber;
195
204
  }
196
- function pageAttributes({ pageId, url, navigationType, previousUrl, documentUrl }) {
205
+ function pageAttributes({ pageId, documentIndex, routeIndex, url, navigationType, previousUrl, documentUrl }) {
197
206
  const attributes = {
198
207
  "browser.resource.type": navigationType === "document" ? "page" : "route",
199
208
  "browser.page.id": pageId,
@@ -205,6 +214,8 @@ function pageAttributes({ pageId, url, navigationType, previousUrl, documentUrl
205
214
  attributes["url.path"] = parsedUrl.pathname;
206
215
  if (parsedUrl.search) attributes["url.query"] = parsedUrl.search.slice(1);
207
216
  } catch {}
217
+ if (documentIndex !== void 0) attributes["browser.page.navigation.index"] = documentIndex;
218
+ if (routeIndex !== void 0) attributes["browser.route.navigation.index"] = routeIndex;
208
219
  if (previousUrl) attributes["browser.route.previous_url"] = previousUrl;
209
220
  if (documentUrl) attributes["browser.document.url"] = documentUrl;
210
221
  return attributes;
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/index.ts
2
- var src_default = require("./reporter--8bw74PI.cjs").PlaywrightOpentelemetryReporter;
2
+ var src_default = require("./reporter-BfEohc31.cjs").PlaywrightOpentelemetryReporter;
3
3
  //#endregion
4
4
  module.exports = src_default;
package/dist/index.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-D-3pnapc.cjs";
1
+ import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-DhuwcBzL.cjs";
2
2
  import { t as PlaywrightOpentelemetryReporter } from "./reporter-DaCojFom.cjs";
3
3
  export { type PlaywrightOpentelemetryConfig, type PlaywrightOpentelemetryDestination, type PlaywrightOpentelemetryUseOptions, type PlaywrightTraceOption, PlaywrightOpentelemetryReporter as default };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-D-3pnapc.mjs";
1
+ import { i as PlaywrightTraceOption, n as PlaywrightOpentelemetryDestination, r as PlaywrightOpentelemetryUseOptions, t as PlaywrightOpentelemetryConfig } from "./config-DhuwcBzL.mjs";
2
2
  import { t as PlaywrightOpentelemetryReporter } from "./reporter-DaCojFom.mjs";
3
3
  export { type PlaywrightOpentelemetryConfig, type PlaywrightOpentelemetryDestination, type PlaywrightOpentelemetryUseOptions, type PlaywrightTraceOption, PlaywrightOpentelemetryReporter as default };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PlaywrightOpentelemetryReporter } from "./reporter-CgzB0Kq8.mjs";
1
+ import { t as PlaywrightOpentelemetryReporter } from "./reporter-CUrEVFvR.mjs";
2
2
  //#region src/index.ts
3
3
  var src_default = PlaywrightOpentelemetryReporter;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- const require_config = require("./config-DTMVyy76.cjs");
1
+ const require_config = require("./config-BP1kyuMh.cjs");
2
2
  let node_path = require("node:path");
3
3
  node_path = require_config.__toESM(node_path, 1);
4
4
  let node_fs_promises = require("node:fs/promises");
@@ -17,6 +17,7 @@ const TEST_STEP_SPAN_NAME = "playwright.test.step";
17
17
  const ATTR_TEST_STEP_NAME = "test.step.name";
18
18
  const ATTR_TEST_STEP_TITLE = "test.step.title";
19
19
  const ATTR_TEST_STEP_CATEGORY = "test.step.category";
20
+ const ATTR_TEST_PHASE = "playwright.test.phase";
20
21
  //#endregion
21
22
  //#region src/reporter/trace-zip-builder.ts
22
23
  /**
@@ -324,16 +325,21 @@ var PlaywrightOpentelemetryReporter = class {
324
325
  const [traceZipBlob] = await Promise.all([traceZipBlobPromise, ...uploadPromises]);
325
326
  return { traceZipBlob };
326
327
  }
327
- processTestStep(test, step, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds) {
328
+ processTestStep(test, step, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, inheritedPhase) {
329
+ let phase = inheritedPhase;
330
+ if (step.category === "hook") {
331
+ if (step.title === "Before Hooks") phase = "before";
332
+ if (step.title === "After Hooks" || step.title === "Worker Cleanup") phase = "after";
333
+ }
328
334
  const stepId = getStepId(test, step);
329
335
  if (isInternalFixtureStep(step) || isInternalApiRequestStep(step)) {
330
336
  skippedStepIds.add(stepId);
331
337
  processedSteps.delete(stepId);
332
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds);
338
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, phase);
333
339
  return;
334
340
  }
335
341
  if (skippedStepIds.has(stepId)) {
336
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds);
342
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, phase);
337
343
  return;
338
344
  }
339
345
  const currentTitlePath = [...parentTitlePath, step.title];
@@ -346,13 +352,14 @@ var PlaywrightOpentelemetryReporter = class {
346
352
  existingSpan.attributes[ATTR_CODE_FILE_PATH] = relativePath;
347
353
  existingSpan.attributes[ATTR_CODE_LINE_NUMBER] = line;
348
354
  }
349
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, existingSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds);
355
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, existingSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds, phase);
350
356
  return;
351
357
  }
352
358
  const attributes = {};
353
359
  attributes[ATTR_TEST_STEP_NAME] = currentTitlePath.join(" > ");
354
360
  attributes[ATTR_TEST_STEP_TITLE] = step.title;
355
361
  attributes[ATTR_TEST_STEP_CATEGORY] = step.category;
362
+ if (phase) attributes[ATTR_TEST_PHASE] = phase;
356
363
  if (step.location) {
357
364
  const { file, line } = step.location;
358
365
  attributes[ATTR_CODE_FILE_PATH] = this.rootDir ? node_path.default.relative(this.rootDir, file) : file;
@@ -369,7 +376,7 @@ var PlaywrightOpentelemetryReporter = class {
369
376
  };
370
377
  if (step.error) stepSpan.status = errorStatus(step.error.message);
371
378
  processedSteps.set(stepId, stepSpan);
372
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, stepSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds);
379
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, stepSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds, phase);
373
380
  }
374
381
  onStdOut(chunk, _test, _result) {
375
382
  if (this.debug) console.log(chunk.toString().slice(0, -1));
@@ -1,4 +1,4 @@
1
- import { c as shouldRetainPlaywrightTrace, d as PLAYWRIGHT_TRACE_API_SOURCE_REPORTER, f as buildOtlpRequest, g as withPlaywrightTraceApiHeaders, h as sendSpans, i as TRACE_CONTEXT_ATTACHMENT_NAME, l as filterRetainedDestinations, m as generateTraceId, p as generateSpanId, r as FIXTURE_SPANS_ATTACHMENT_NAME, t as resolvePlaywrightOpentelemetryConfig, u as PLAYWRIGHT_TRACE_API_SOURCE_HEADER } from "./config-ChGo0Y1S.mjs";
1
+ import { c as shouldRetainPlaywrightTrace, d as PLAYWRIGHT_TRACE_API_SOURCE_REPORTER, f as buildOtlpRequest, g as withPlaywrightTraceApiHeaders, h as sendSpans, i as TRACE_CONTEXT_ATTACHMENT_NAME, l as filterRetainedDestinations, m as generateTraceId, p as generateSpanId, r as FIXTURE_SPANS_ATTACHMENT_NAME, t as resolvePlaywrightOpentelemetryConfig, u as PLAYWRIGHT_TRACE_API_SOURCE_HEADER } from "./config-BK6F0OO5.mjs";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
  import { BlobReader, BlobWriter, TextWriter, ZipReader, ZipWriter } from "@zip.js/zip.js";
@@ -15,6 +15,7 @@ const TEST_STEP_SPAN_NAME = "playwright.test.step";
15
15
  const ATTR_TEST_STEP_NAME = "test.step.name";
16
16
  const ATTR_TEST_STEP_TITLE = "test.step.title";
17
17
  const ATTR_TEST_STEP_CATEGORY = "test.step.category";
18
+ const ATTR_TEST_PHASE = "playwright.test.phase";
18
19
  //#endregion
19
20
  //#region src/reporter/trace-zip-builder.ts
20
21
  /**
@@ -322,16 +323,21 @@ var PlaywrightOpentelemetryReporter = class {
322
323
  const [traceZipBlob] = await Promise.all([traceZipBlobPromise, ...uploadPromises]);
323
324
  return { traceZipBlob };
324
325
  }
325
- processTestStep(test, step, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds) {
326
+ processTestStep(test, step, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, inheritedPhase) {
327
+ let phase = inheritedPhase;
328
+ if (step.category === "hook") {
329
+ if (step.title === "Before Hooks") phase = "before";
330
+ if (step.title === "After Hooks" || step.title === "Worker Cleanup") phase = "after";
331
+ }
326
332
  const stepId = getStepId(test, step);
327
333
  if (isInternalFixtureStep(step) || isInternalApiRequestStep(step)) {
328
334
  skippedStepIds.add(stepId);
329
335
  processedSteps.delete(stepId);
330
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds);
336
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, phase);
331
337
  return;
332
338
  }
333
339
  if (skippedStepIds.has(stepId)) {
334
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds);
340
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, parentSpanId, traceId, parentTitlePath, processedSteps, skippedStepIds, phase);
335
341
  return;
336
342
  }
337
343
  const currentTitlePath = [...parentTitlePath, step.title];
@@ -344,13 +350,14 @@ var PlaywrightOpentelemetryReporter = class {
344
350
  existingSpan.attributes[ATTR_CODE_FILE_PATH] = relativePath;
345
351
  existingSpan.attributes[ATTR_CODE_LINE_NUMBER] = line;
346
352
  }
347
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, existingSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds);
353
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, existingSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds, phase);
348
354
  return;
349
355
  }
350
356
  const attributes = {};
351
357
  attributes[ATTR_TEST_STEP_NAME] = currentTitlePath.join(" > ");
352
358
  attributes[ATTR_TEST_STEP_TITLE] = step.title;
353
359
  attributes[ATTR_TEST_STEP_CATEGORY] = step.category;
360
+ if (phase) attributes[ATTR_TEST_PHASE] = phase;
354
361
  if (step.location) {
355
362
  const { file, line } = step.location;
356
363
  attributes[ATTR_CODE_FILE_PATH] = this.rootDir ? path.relative(this.rootDir, file) : file;
@@ -367,7 +374,7 @@ var PlaywrightOpentelemetryReporter = class {
367
374
  };
368
375
  if (step.error) stepSpan.status = errorStatus(step.error.message);
369
376
  processedSteps.set(stepId, stepSpan);
370
- if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, stepSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds);
377
+ if (step.steps && step.steps.length > 0) for (const childStep of step.steps) this.processTestStep(test, childStep, stepSpan.spanId, traceId, currentTitlePath, processedSteps, skippedStepIds, phase);
371
378
  }
372
379
  onStdOut(chunk, _test, _result) {
373
380
  if (this.debug) console.log(chunk.toString().slice(0, -1));
package/dist/reporter.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region src/reporter/index.ts
2
- var reporter_default = require("./reporter--8bw74PI.cjs").PlaywrightOpentelemetryReporter;
2
+ var reporter_default = require("./reporter-BfEohc31.cjs").PlaywrightOpentelemetryReporter;
3
3
  //#endregion
4
4
  module.exports = reporter_default;
package/dist/reporter.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PlaywrightOpentelemetryReporter } from "./reporter-CgzB0Kq8.mjs";
1
+ import { t as PlaywrightOpentelemetryReporter } from "./reporter-CUrEVFvR.mjs";
2
2
  //#region src/reporter/index.ts
3
3
  var reporter_default = PlaywrightOpentelemetryReporter;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-opentelemetry",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "A reporter for Playwright that can export traces and spans in opentelemetry format.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -17,6 +17,12 @@
17
17
  "keywords": [
18
18
  "playwright",
19
19
  "opentelemetry",
20
+ "otel",
21
+ "otlp",
22
+ "tracing",
23
+ "distributed-tracing",
24
+ "observability",
25
+ "e2e",
20
26
  "reporting",
21
27
  "testing",
22
28
  "automation"
@@ -55,7 +61,7 @@
55
61
  "@zip.js/zip.js": "^2.8.26"
56
62
  },
57
63
  "devDependencies": {
58
- "@playwright/test": "1.61.0",
64
+ "@playwright/test": "1.63.0",
59
65
  "@types/bun": "^1.3.14",
60
66
  "@types/node": "^25.9.1",
61
67
  "tsdown": "^0.22.1"