autotel-playwright 0.4.55 → 0.4.57
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/dist/index.cjs +0 -21
- package/dist/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +0 -21
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -219,27 +219,6 @@ function createGlobalSetup(initOptions) {
|
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Creates a typed client for the test-spans HTTP endpoint.
|
|
224
|
-
*
|
|
225
|
-
* Pairs with `createTestSpansHandlers()` from `autotel-tanstack/testing`.
|
|
226
|
-
*
|
|
227
|
-
* @param baseUrl - Base URL of the app under test (e.g. 'http://localhost:3100')
|
|
228
|
-
* @param options.path - Path of the test-spans endpoint (default: '/api/test-spans')
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* ```typescript
|
|
232
|
-
* const spansClient = createTestSpansClient('http://localhost:3100');
|
|
233
|
-
*
|
|
234
|
-
* test('server function is traced', async ({ request }) => {
|
|
235
|
-
* await spansClient.clearSpans(request);
|
|
236
|
-
* await page.goto('/');
|
|
237
|
-
* // ... trigger action ...
|
|
238
|
-
* const spans = await spansClient.getSpans(request);
|
|
239
|
-
* expect(spans.find(s => s.name === 'sendMoney.handler')).toBeDefined();
|
|
240
|
-
* });
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
222
|
function createTestSpansClient(baseUrl, options) {
|
|
244
223
|
const base = baseUrl.replace(/\/$/, "");
|
|
245
224
|
const path = options?.path ?? "/api/test-spans";
|
package/dist/index.d.cts
CHANGED
|
@@ -36,12 +36,14 @@ declare function createGlobalSetup(initOptions?: AutotelConfig): () => Promise<v
|
|
|
36
36
|
/**
|
|
37
37
|
* Serialized span returned by the test-spans endpoint (matches autotel-tanstack/testing SerializedSpan).
|
|
38
38
|
*/
|
|
39
|
+
/** Span attributes as they survive JSON: OpenTelemetry's value types. */
|
|
40
|
+
type SerializedAttributes = Record<string, string | number | boolean | Array<string | number | boolean | null>>;
|
|
39
41
|
interface SerializedSpan {
|
|
40
42
|
name: string;
|
|
41
43
|
spanId: string;
|
|
42
44
|
traceId: string;
|
|
43
45
|
parentSpanId?: string;
|
|
44
|
-
attributes?:
|
|
46
|
+
attributes?: SerializedAttributes;
|
|
45
47
|
status: {
|
|
46
48
|
code: number;
|
|
47
49
|
message?: string;
|
|
@@ -69,11 +71,13 @@ interface SerializedSpan {
|
|
|
69
71
|
* });
|
|
70
72
|
* ```
|
|
71
73
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}): {
|
|
74
|
+
/** Reads and clears the spans a test server collected. */
|
|
75
|
+
interface TestSpansClient {
|
|
75
76
|
getSpans(request: APIRequestContext): Promise<SerializedSpan[]>;
|
|
76
77
|
clearSpans(request: APIRequestContext): Promise<void>;
|
|
77
|
-
}
|
|
78
|
+
}
|
|
79
|
+
declare function createTestSpansClient(baseUrl: string, options?: {
|
|
80
|
+
path?: string;
|
|
81
|
+
}): TestSpansClient;
|
|
78
82
|
//#endregion
|
|
79
|
-
export { AUTOTEL_ATTRIBUTE_ANNOTATION, type OtelTraceContext, SerializedSpan, createGlobalSetup, createTestSpansClient, enrichWithTraceContext, expect, getTraceContext, isTracing, resolveTraceUrl, step, test };
|
|
83
|
+
export { AUTOTEL_ATTRIBUTE_ANNOTATION, type OtelTraceContext, SerializedAttributes, SerializedSpan, TestSpansClient, createGlobalSetup, createTestSpansClient, enrichWithTraceContext, expect, getTraceContext, isTracing, resolveTraceUrl, step, test };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,12 +36,14 @@ declare function createGlobalSetup(initOptions?: AutotelConfig): () => Promise<v
|
|
|
36
36
|
/**
|
|
37
37
|
* Serialized span returned by the test-spans endpoint (matches autotel-tanstack/testing SerializedSpan).
|
|
38
38
|
*/
|
|
39
|
+
/** Span attributes as they survive JSON: OpenTelemetry's value types. */
|
|
40
|
+
type SerializedAttributes = Record<string, string | number | boolean | Array<string | number | boolean | null>>;
|
|
39
41
|
interface SerializedSpan {
|
|
40
42
|
name: string;
|
|
41
43
|
spanId: string;
|
|
42
44
|
traceId: string;
|
|
43
45
|
parentSpanId?: string;
|
|
44
|
-
attributes?:
|
|
46
|
+
attributes?: SerializedAttributes;
|
|
45
47
|
status: {
|
|
46
48
|
code: number;
|
|
47
49
|
message?: string;
|
|
@@ -69,11 +71,13 @@ interface SerializedSpan {
|
|
|
69
71
|
* });
|
|
70
72
|
* ```
|
|
71
73
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}): {
|
|
74
|
+
/** Reads and clears the spans a test server collected. */
|
|
75
|
+
interface TestSpansClient {
|
|
75
76
|
getSpans(request: APIRequestContext): Promise<SerializedSpan[]>;
|
|
76
77
|
clearSpans(request: APIRequestContext): Promise<void>;
|
|
77
|
-
}
|
|
78
|
+
}
|
|
79
|
+
declare function createTestSpansClient(baseUrl: string, options?: {
|
|
80
|
+
path?: string;
|
|
81
|
+
}): TestSpansClient;
|
|
78
82
|
//#endregion
|
|
79
|
-
export { AUTOTEL_ATTRIBUTE_ANNOTATION, type OtelTraceContext, SerializedSpan, createGlobalSetup, createTestSpansClient, enrichWithTraceContext, expect, getTraceContext, isTracing, resolveTraceUrl, step, test };
|
|
83
|
+
export { AUTOTEL_ATTRIBUTE_ANNOTATION, type OtelTraceContext, SerializedAttributes, SerializedSpan, TestSpansClient, createGlobalSetup, createTestSpansClient, enrichWithTraceContext, expect, getTraceContext, isTracing, resolveTraceUrl, step, test };
|
package/dist/index.js
CHANGED
|
@@ -218,27 +218,6 @@ function createGlobalSetup(initOptions) {
|
|
|
218
218
|
});
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Creates a typed client for the test-spans HTTP endpoint.
|
|
223
|
-
*
|
|
224
|
-
* Pairs with `createTestSpansHandlers()` from `autotel-tanstack/testing`.
|
|
225
|
-
*
|
|
226
|
-
* @param baseUrl - Base URL of the app under test (e.g. 'http://localhost:3100')
|
|
227
|
-
* @param options.path - Path of the test-spans endpoint (default: '/api/test-spans')
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```typescript
|
|
231
|
-
* const spansClient = createTestSpansClient('http://localhost:3100');
|
|
232
|
-
*
|
|
233
|
-
* test('server function is traced', async ({ request }) => {
|
|
234
|
-
* await spansClient.clearSpans(request);
|
|
235
|
-
* await page.goto('/');
|
|
236
|
-
* // ... trigger action ...
|
|
237
|
-
* const spans = await spansClient.getSpans(request);
|
|
238
|
-
* expect(spans.find(s => s.name === 'sendMoney.handler')).toBeDefined();
|
|
239
|
-
* });
|
|
240
|
-
* ```
|
|
241
|
-
*/
|
|
242
221
|
function createTestSpansClient(baseUrl, options) {
|
|
243
222
|
const base = baseUrl.replace(/\/$/, "");
|
|
244
223
|
const path = options?.path ?? "/api/test-spans";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-playwright",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.57",
|
|
4
4
|
"description": "Playwright fixture for OpenTelemetry: one span per test and trace context injected into API requests",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"autotel": "
|
|
27
|
+
"autotel": "7.0.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@playwright/test": ">=1.62.0"
|