@stanterprise/playwright-reporter 0.0.15 → 0.0.17
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.
|
@@ -12,6 +12,24 @@ function handleOnStepEndEvent(test, result, step, runId, client, options) {
|
|
|
12
12
|
// Build metadata from step annotations
|
|
13
13
|
const metadata = (0, utils_1.buildStepMetadata)(step);
|
|
14
14
|
const stepId = (0, utils_2.generateStepId)(step, test);
|
|
15
|
+
// Extract comprehensive error details if present
|
|
16
|
+
const errorMessage = step.error?.message || "";
|
|
17
|
+
const errorStack = step.error?.stack || "";
|
|
18
|
+
const errorValue = step.error?.value || "";
|
|
19
|
+
const errorSnippet = step.error?.snippet || "";
|
|
20
|
+
const errorLocation = step.error?.location
|
|
21
|
+
? `${step.error.location.file}:${step.error.location.line}:${step.error.location.column}`
|
|
22
|
+
: "";
|
|
23
|
+
// Combine all error information into metadata for comprehensive error tracking
|
|
24
|
+
const errorMetadata = {};
|
|
25
|
+
if (errorStack)
|
|
26
|
+
errorMetadata.error_stack = (0, utils_1.truncateValue)(errorStack);
|
|
27
|
+
if (errorValue)
|
|
28
|
+
errorMetadata.error_value = (0, utils_1.truncateValue)(errorValue);
|
|
29
|
+
if (errorSnippet)
|
|
30
|
+
errorMetadata.error_snippet = (0, utils_1.truncateValue)(errorSnippet);
|
|
31
|
+
if (errorLocation)
|
|
32
|
+
errorMetadata.error_location = (0, utils_1.truncateValue)(errorLocation);
|
|
15
33
|
// Build and send the StepEnd event
|
|
16
34
|
const request = new events_1.StepEndEventRequest({
|
|
17
35
|
step: new entities_1.StepRun({
|
|
@@ -23,12 +41,12 @@ function handleOnStepEndEvent(test, result, step, runId, client, options) {
|
|
|
23
41
|
start_time: (0, utils_1.createTimestamp)(step.startTime),
|
|
24
42
|
duration: (0, utils_1.createDuration)(step.duration),
|
|
25
43
|
status: stepStatus,
|
|
26
|
-
error:
|
|
27
|
-
errors:
|
|
44
|
+
error: errorMessage,
|
|
45
|
+
errors: errorMessage ? [errorMessage] : [],
|
|
28
46
|
location: step.location
|
|
29
47
|
? `${step.location.file}:${step.location.line}:${step.location.column}`
|
|
30
48
|
: "",
|
|
31
|
-
metadata: (0, utils_1.toMetadataMap)(metadata),
|
|
49
|
+
metadata: (0, utils_1.toMetadataMap)({ ...metadata, ...errorMetadata }),
|
|
32
50
|
parent_step_id: step.parent
|
|
33
51
|
? (0, utils_2.generateStepId)(step.parent, test)
|
|
34
52
|
: undefined,
|
|
@@ -37,6 +37,8 @@ function handleOnTestEndEvent(test, result, runId, client, options) {
|
|
|
37
37
|
errors: errors,
|
|
38
38
|
metadata: (0, utils_1.toMetadataMap)(metadata),
|
|
39
39
|
tags: test.tags,
|
|
40
|
+
retry_index: result.retry,
|
|
41
|
+
retry_count: test.retries,
|
|
40
42
|
}),
|
|
41
43
|
});
|
|
42
44
|
// Serialize once to capture payload size for potential error logging
|
|
@@ -17,6 +17,7 @@ function handleOnTestFailEvent(test, result, runId, grpcClient, options) {
|
|
|
17
17
|
stack_trace: stackTrace,
|
|
18
18
|
timestamp: (0, utils_1.createTimestampFromMs)(Date.now()),
|
|
19
19
|
attachments: attachments,
|
|
20
|
+
retry_index: result.retry,
|
|
20
21
|
});
|
|
21
22
|
// Fire-and-forget to avoid slowing tests
|
|
22
23
|
(0, grpcClient_1.reportUnary)(options, grpcClient, "/testsystem.v1.observer.TestEventCollector/ReportTestFailure", request, options.grpcTimeout).catch((e) => console.error("Failed to report test failure", e));
|
package/dist/reporter.js
CHANGED
|
@@ -135,7 +135,9 @@ class StanterpriseReporter {
|
|
|
135
135
|
console.error(`Stanterprise Reporter: Standard error output - ${chunk.toString()}`);
|
|
136
136
|
}
|
|
137
137
|
onStdOut(chunk, test, result) {
|
|
138
|
-
|
|
138
|
+
if (this.options.verbose) {
|
|
139
|
+
console.log(`Stanterprise Reporter: Standard output - ${chunk.toString()}`);
|
|
140
|
+
}
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
exports.default = StanterpriseReporter;
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* Utility functions for building metadata objects
|
|
3
3
|
*/
|
|
4
4
|
import type { TestCase, TestResult, TestStep } from "@playwright/test/reporter";
|
|
5
|
+
/**
|
|
6
|
+
* Truncate a string to a maximum length with ellipsis indicator
|
|
7
|
+
* @param value String value to truncate
|
|
8
|
+
* @param maxLength Maximum length (default 100KB)
|
|
9
|
+
* @returns Truncated string with warning suffix if truncated
|
|
10
|
+
*/
|
|
11
|
+
export declare function truncateValue(value: string, maxLength?: number): string;
|
|
5
12
|
/**
|
|
6
13
|
* Build metadata from annotations array
|
|
7
14
|
* @param annotations Array of annotations with type and optional description
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncateValue = truncateValue;
|
|
3
4
|
exports.buildAnnotationsMetadata = buildAnnotationsMetadata;
|
|
4
5
|
exports.buildTestMetadata = buildTestMetadata;
|
|
5
6
|
exports.buildStepMetadata = buildStepMetadata;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stanterprise/playwright-reporter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Custom Playwright test reporter that sends test results to Stanterprise via gRPC",
|
|
5
5
|
"homepage": "https://github.com/stanterprise/stanterprise-playwright-reporter#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@playwright/test": "^1.52.0",
|
|
46
46
|
"@types/jest": "^29.5.14",
|
|
47
|
-
"@types/node": "^22.
|
|
47
|
+
"@types/node": "^22.19.7",
|
|
48
48
|
"jest": "^29.7.0",
|
|
49
49
|
"ts-jest": "^29.4.5",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"@grpc/grpc-js": "^1.14.1",
|
|
54
54
|
"@protobuf-ts/grpc-transport": "^2.11.1",
|
|
55
55
|
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
|
56
|
-
"@stanterprise/protobuf": "^0.0.
|
|
56
|
+
"@stanterprise/protobuf": "^0.0.21"
|
|
57
57
|
}
|
|
58
58
|
}
|