@stanterprise/playwright-reporter 0.1.1 → 0.1.3
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/handlers/onBeginHandler.d.ts +1 -1
- package/dist/handlers/onBeginHandler.js +7 -5
- package/dist/handlers/onEndHandler.d.ts +1 -1
- package/dist/handlers/onEndHandler.js +2 -1
- package/dist/handlers/onErrorHandler.d.ts +1 -1
- package/dist/handlers/onErrorHandler.js +2 -1
- package/dist/handlers/onStepBeginHandler.d.ts +1 -1
- package/dist/handlers/onStepBeginHandler.js +2 -1
- package/dist/handlers/onStepEndHandler.d.ts +1 -1
- package/dist/handlers/onStepEndHandler.js +4 -1
- package/dist/handlers/onTestBeginHandler.d.ts +1 -1
- package/dist/handlers/onTestBeginHandler.js +2 -1
- package/dist/handlers/onTestEndHandler.d.ts +1 -1
- package/dist/handlers/onTestEndHandler.js +2 -1
- package/dist/handlers/onTestFailHandler.d.ts +1 -1
- package/dist/handlers/onTestFailHandler.js +2 -1
- package/dist/reporter.d.ts +1 -0
- package/dist/reporter.js +10 -9
- package/dist/utils/attachmentProcessor.d.ts +3 -3
- package/dist/utils/attachmentProcessor.js +2 -3
- package/package.json +2 -2
|
@@ -3,4 +3,4 @@ import { Suite } from "@playwright/test/reporter";
|
|
|
3
3
|
import { StanterpriseReporterOptions } from "../types";
|
|
4
4
|
import * as grpc from "@grpc/grpc-js";
|
|
5
5
|
import { MessageQueue } from "../client/messageQueue";
|
|
6
|
-
export declare function handleOnBeginEvent(config: FullConfig, suite: Suite, name: string, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
6
|
+
export declare function handleOnBeginEvent(config: FullConfig, suite: Suite, name: string, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -6,7 +6,7 @@ const grpcClient_1 = require("../client/grpcClient");
|
|
|
6
6
|
const entities_1 = require("@stanterprise/protobuf/testsystem/v1/entities");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
8
|
const common_1 = require("@stanterprise/protobuf/testsystem/v1/common");
|
|
9
|
-
function handleOnBeginEvent(config, suite, name, runId, client, options, queue) {
|
|
9
|
+
function handleOnBeginEvent(config, suite, name, runId, executionId, client, options, queue) {
|
|
10
10
|
// Report root suite and all child suites recursively
|
|
11
11
|
// Convert all metadata values to strings for protobuf compatibility
|
|
12
12
|
// Use plain object instead of Map - protobuf expects object literals
|
|
@@ -26,8 +26,9 @@ function handleOnBeginEvent(config, suite, name, runId, client, options, queue)
|
|
|
26
26
|
}
|
|
27
27
|
const request = new events_1.ReportRunStartEventRequest({
|
|
28
28
|
run_id: runId,
|
|
29
|
+
execution_id: executionId,
|
|
29
30
|
name: name,
|
|
30
|
-
test_suites: mapSuites(suite, runId),
|
|
31
|
+
test_suites: mapSuites(suite, runId, executionId),
|
|
31
32
|
total_tests: suite.allTests().length,
|
|
32
33
|
metadata: (0, utils_1.toMetadataMap)(metadata),
|
|
33
34
|
});
|
|
@@ -36,9 +37,9 @@ function handleOnBeginEvent(config, suite, name, runId, client, options, queue)
|
|
|
36
37
|
console.warn(`onBegin. gRPC disabled for the remainder of the run. Address=${options.grpcAddress}. Details: ${details}`);
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
function mapSuites(suite, runId) {
|
|
40
|
+
function mapSuites(suite, runId, executionId) {
|
|
40
41
|
let allSuites = getAllSuites(suite);
|
|
41
|
-
return allSuites.map((currentSuite) => mapSingleSuite(currentSuite, runId));
|
|
42
|
+
return allSuites.map((currentSuite) => mapSingleSuite(currentSuite, runId, executionId));
|
|
42
43
|
}
|
|
43
44
|
function getAllSuites(suite) {
|
|
44
45
|
let suites = [];
|
|
@@ -48,7 +49,7 @@ function getAllSuites(suite) {
|
|
|
48
49
|
});
|
|
49
50
|
return suites;
|
|
50
51
|
}
|
|
51
|
-
function mapSingleSuite(suite, runId) {
|
|
52
|
+
function mapSingleSuite(suite, runId, executionId) {
|
|
52
53
|
const suiteId = (0, utils_1.generateSuiteId)(suite);
|
|
53
54
|
const parentSuiteId = suite.parent
|
|
54
55
|
? (0, utils_1.generateSuiteId)(suite.parent)
|
|
@@ -86,6 +87,7 @@ function mapSingleSuite(suite, runId) {
|
|
|
86
87
|
status: common_1.TestStatus.NOT_RUN,
|
|
87
88
|
retry_count: test.retries,
|
|
88
89
|
retry_index: 0,
|
|
90
|
+
execution_id: executionId,
|
|
89
91
|
})),
|
|
90
92
|
test_case_ids: suite.tests.map((test) => test.id),
|
|
91
93
|
type: type,
|
|
@@ -2,4 +2,4 @@ import { FullResult } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnEndEvent(result: FullResult, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue, metadata?: Record<string, string>): void;
|
|
5
|
+
export declare function handleOnEndEvent(result: FullResult, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue, metadata?: Record<string, string>): void;
|
|
@@ -19,7 +19,7 @@ function mapTestStatus(status) {
|
|
|
19
19
|
return common_1.TestStatus.UNKNOWN;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
function handleOnEndEvent(result, runId, client, options, queue, metadata) {
|
|
22
|
+
function handleOnEndEvent(result, runId, executionId, client, options, queue, metadata) {
|
|
23
23
|
// Validate and sanitize inputs to prevent serialization failures
|
|
24
24
|
const startTimeMs = result.startTime?.getTime();
|
|
25
25
|
const duration = result.duration;
|
|
@@ -36,6 +36,7 @@ function handleOnEndEvent(result, runId, client, options, queue, metadata) {
|
|
|
36
36
|
start_time: (0, utils_1.createTimestampFromMs)(validStartTimeMs),
|
|
37
37
|
duration: (0, utils_1.createDuration)(validDuration),
|
|
38
38
|
metadata: (0, utils_1.toMetadataMap)(metadata || {}),
|
|
39
|
+
execution_id: executionId,
|
|
39
40
|
});
|
|
40
41
|
(0, grpcClient_1.reportUnary)(options, client, "/testsystem.v1.observer.TestEventCollector/ReportRunEnd", request, options.grpcTimeout, queue).catch((error) => {
|
|
41
42
|
if (error instanceof Error) {
|
|
@@ -2,4 +2,4 @@ import { TestError } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnErrorEvent(error: TestError, runId: string, grpcClient: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnErrorEvent(error: TestError, runId: string, executionId: string, grpcClient: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -4,11 +4,12 @@ exports.handleOnErrorEvent = handleOnErrorEvent;
|
|
|
4
4
|
const events_1 = require("@stanterprise/protobuf/testsystem/v1/events");
|
|
5
5
|
const timeHelpers_1 = require("../utils/timeHelpers");
|
|
6
6
|
const grpcClient_1 = require("../client/grpcClient");
|
|
7
|
-
function handleOnErrorEvent(error, runId, grpcClient, options, queue) {
|
|
7
|
+
function handleOnErrorEvent(error, runId, executionId, grpcClient, options, queue) {
|
|
8
8
|
const request = new events_1.StdErrorEventRequest({
|
|
9
9
|
run_id: runId,
|
|
10
10
|
message: error.message,
|
|
11
11
|
timestamp: (0, timeHelpers_1.createTimestampFromMs)(Date.now()),
|
|
12
|
+
execution_id: executionId,
|
|
12
13
|
});
|
|
13
14
|
// Fire-and-forget to avoid slowing tests
|
|
14
15
|
(0, grpcClient_1.reportUnary)(options, grpcClient, "/testsystem.v1.observer.TestEventCollector/ReportStdError", request, options.grpcTimeout, queue).catch((e) => console.error("Failed to report standard error", e));
|
|
@@ -2,4 +2,4 @@ import { TestCase, TestResult, TestStep } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnStepBeginEvent(test: TestCase, result: TestResult, step: TestStep, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnStepBeginEvent(test: TestCase, result: TestResult, step: TestStep, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const grpcClient_1 = require("../client/grpcClient");
|
|
8
8
|
const utils_2 = require("../utils");
|
|
9
9
|
const common_1 = require("@stanterprise/protobuf/testsystem/v1/common");
|
|
10
|
-
function handleOnStepBeginEvent(test, result, step, runId, client, options, queue) {
|
|
10
|
+
function handleOnStepBeginEvent(test, result, step, runId, executionId, client, options, queue) {
|
|
11
11
|
// Build metadata from step annotations
|
|
12
12
|
const metadata = (0, utils_1.buildStepMetadata)(step);
|
|
13
13
|
// Get parent step ID if this step has a parent
|
|
@@ -31,6 +31,7 @@ function handleOnStepBeginEvent(test, result, step, runId, client, options, queu
|
|
|
31
31
|
: undefined,
|
|
32
32
|
worker_index: result.workerIndex.toString(),
|
|
33
33
|
retry_index: result.retry,
|
|
34
|
+
execution_id: executionId,
|
|
34
35
|
}),
|
|
35
36
|
});
|
|
36
37
|
// Fire-and-forget to avoid slowing tests
|
|
@@ -2,4 +2,4 @@ import { TestCase, TestResult, TestStep } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnStepEndEvent(test: TestCase, result: TestResult, step: TestStep, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnStepEndEvent(test: TestCase, result: TestResult, step: TestStep, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -6,9 +6,10 @@ const events_1 = require("@stanterprise/protobuf/testsystem/v1/events");
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const grpcClient_1 = require("../client/grpcClient");
|
|
8
8
|
const utils_2 = require("../utils");
|
|
9
|
-
function handleOnStepEndEvent(test, result, step, runId, client, options, queue) {
|
|
9
|
+
function handleOnStepEndEvent(test, result, step, runId, executionId, client, options, queue) {
|
|
10
10
|
// Map step error to status
|
|
11
11
|
const stepStatus = (0, utils_1.mapStepStatus)(!!step.error);
|
|
12
|
+
const attachments = (0, utils_1.processAttachments)(result, options.maxAttachmentSize || 10485760);
|
|
12
13
|
// Build metadata from step annotations
|
|
13
14
|
const metadata = (0, utils_1.buildStepMetadata)(step);
|
|
14
15
|
const stepId = (0, utils_2.generateStepId)(step, test);
|
|
@@ -52,6 +53,8 @@ function handleOnStepEndEvent(test, result, step, runId, client, options, queue)
|
|
|
52
53
|
: undefined,
|
|
53
54
|
worker_index: result.workerIndex.toString(),
|
|
54
55
|
retry_index: result.retry,
|
|
56
|
+
attachments: attachments,
|
|
57
|
+
execution_id: executionId,
|
|
55
58
|
}),
|
|
56
59
|
});
|
|
57
60
|
// Fire-and-forget to avoid slowing tests
|
|
@@ -2,4 +2,4 @@ import { TestCase, TestResult } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnTestBeginEvent(test: TestCase, result: TestResult, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnTestBeginEvent(test: TestCase, result: TestResult, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -6,7 +6,7 @@ const events_1 = require("@stanterprise/protobuf/testsystem/v1/events");
|
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const grpcClient_1 = require("../client/grpcClient");
|
|
8
8
|
const common_1 = require("@stanterprise/protobuf/testsystem/v1/common");
|
|
9
|
-
function handleOnTestBeginEvent(test, result, runId, client, options, queue) {
|
|
9
|
+
function handleOnTestBeginEvent(test, result, runId, executionId, client, options, queue) {
|
|
10
10
|
// Build and send the TestBegin event via generic unary call.
|
|
11
11
|
const request = new events_1.TestBeginEventRequest({
|
|
12
12
|
test_case: new entities_1.TestCaseRun({
|
|
@@ -22,6 +22,7 @@ function handleOnTestBeginEvent(test, result, runId, client, options, queue) {
|
|
|
22
22
|
test_suite_id: (0, utils_1.generateSuiteId)(test.parent),
|
|
23
23
|
start_time: (0, utils_1.createTimestamp)(result.startTime),
|
|
24
24
|
tags: test.tags,
|
|
25
|
+
execution_id: executionId,
|
|
25
26
|
}),
|
|
26
27
|
});
|
|
27
28
|
// Fire-and-forget to avoid slowing tests; log errors once.
|
|
@@ -2,4 +2,4 @@ import { TestCase, TestResult } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnTestEndEvent(test: TestCase, result: TestResult, runId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnTestEndEvent(test: TestCase, result: TestResult, runId: string, executionId: string, client: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -10,7 +10,7 @@ const utils_2 = require("../utils");
|
|
|
10
10
|
* Constant for converting bytes to megabytes
|
|
11
11
|
*/
|
|
12
12
|
const BYTES_PER_MB = 1048576;
|
|
13
|
-
function handleOnTestEndEvent(test, result, runId, client, options, queue) {
|
|
13
|
+
function handleOnTestEndEvent(test, result, runId, executionId, client, options, queue) {
|
|
14
14
|
// Map Playwright test status to protobuf TestStatus
|
|
15
15
|
const testStatus = (0, utils_1.mapTestStatus)(result.status);
|
|
16
16
|
// Process attachments (screenshots, videos, etc.)
|
|
@@ -39,6 +39,7 @@ function handleOnTestEndEvent(test, result, runId, client, options, queue) {
|
|
|
39
39
|
tags: test.tags,
|
|
40
40
|
retry_index: result.retry,
|
|
41
41
|
retry_count: test.retries,
|
|
42
|
+
execution_id: executionId,
|
|
42
43
|
}),
|
|
43
44
|
});
|
|
44
45
|
// Serialize once to capture payload size for potential error logging
|
|
@@ -2,4 +2,4 @@ import { TestCase, TestResult } from "@playwright/test/reporter";
|
|
|
2
2
|
import { StanterpriseReporterOptions } from "../types";
|
|
3
3
|
import * as grpc from "@grpc/grpc-js";
|
|
4
4
|
import { MessageQueue } from "../client/messageQueue";
|
|
5
|
-
export declare function handleOnTestFailEvent(test: TestCase, result: TestResult, runId: string, grpcClient: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
5
|
+
export declare function handleOnTestFailEvent(test: TestCase, result: TestResult, runId: string, executionId: string, grpcClient: grpc.Client, options: StanterpriseReporterOptions, queue?: MessageQueue): void;
|
|
@@ -4,7 +4,7 @@ exports.handleOnTestFailEvent = handleOnTestFailEvent;
|
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const events_1 = require("@stanterprise/protobuf/testsystem/v1/events");
|
|
6
6
|
const grpcClient_1 = require("../client/grpcClient");
|
|
7
|
-
function handleOnTestFailEvent(test, result, runId, grpcClient, options, queue) {
|
|
7
|
+
function handleOnTestFailEvent(test, result, runId, executionId, grpcClient, options, queue) {
|
|
8
8
|
// Extract failure details
|
|
9
9
|
const { errorMessage: failureMessage, stackTrace } = (0, utils_1.extractErrorInfo)(result);
|
|
10
10
|
// Process attachments for failed tests
|
|
@@ -18,6 +18,7 @@ function handleOnTestFailEvent(test, result, runId, grpcClient, options, queue)
|
|
|
18
18
|
timestamp: (0, utils_1.createTimestampFromMs)(Date.now()),
|
|
19
19
|
attachments: attachments,
|
|
20
20
|
retry_index: result.retry,
|
|
21
|
+
execution_id: executionId,
|
|
21
22
|
});
|
|
22
23
|
// Fire-and-forget to avoid slowing tests
|
|
23
24
|
(0, grpcClient_1.reportUnary)(options, grpcClient, "/testsystem.v1.observer.TestEventCollector/ReportTestFailure", request, options.grpcTimeout, queue).catch((e) => console.error("Failed to report test failure", e));
|
package/dist/reporter.d.ts
CHANGED
package/dist/reporter.js
CHANGED
|
@@ -16,6 +16,7 @@ class StanterpriseReporter {
|
|
|
16
16
|
this.options = {};
|
|
17
17
|
// Generate a unique run ID for this test run
|
|
18
18
|
this.runId = "";
|
|
19
|
+
this.executionId = "";
|
|
19
20
|
this.runStartTime = new Date();
|
|
20
21
|
// Sequential message queue – guarantees ordered delivery to the server
|
|
21
22
|
this.messageQueue = new messageQueue_1.MessageQueue();
|
|
@@ -31,6 +32,7 @@ class StanterpriseReporter {
|
|
|
31
32
|
}
|
|
32
33
|
// Generate a UUID for runId
|
|
33
34
|
this.runId = process.env.STANTERPRISE_RUN_ID || (0, crypto_1.randomUUID)();
|
|
35
|
+
this.executionId = process.env.STANTERPRISE_EXECUTION_ID || (0, crypto_1.randomUUID)();
|
|
34
36
|
// Initialize debug file (creates/truncates it) when debug mode is enabled
|
|
35
37
|
(0, debugLogger_1.initDebugFile)(this.options);
|
|
36
38
|
}
|
|
@@ -61,7 +63,7 @@ class StanterpriseReporter {
|
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
if (this.options.grpcEnabled) {
|
|
64
|
-
(0, handlers_1.handleOnBeginEvent)(config, suite, process.env.STANTERPRISE_TEST_RUN_NAME || "Playwright Test Run", this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
66
|
+
(0, handlers_1.handleOnBeginEvent)(config, suite, process.env.STANTERPRISE_TEST_RUN_NAME || "Playwright Test Run", this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
async onExit() {
|
|
@@ -86,19 +88,18 @@ class StanterpriseReporter {
|
|
|
86
88
|
console.log(`Playwright start time: ${result.startTime.toISOString()}`);
|
|
87
89
|
}
|
|
88
90
|
if (this.options.grpcEnabled) {
|
|
89
|
-
(0, handlers_1.handleOnEndEvent)(result, this.runId, this.grpcClient, this.options, this.messageQueue, this.metadata);
|
|
91
|
+
(0, handlers_1.handleOnEndEvent)(result, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue, this.metadata);
|
|
90
92
|
}
|
|
91
93
|
return Promise.resolve();
|
|
92
94
|
}
|
|
93
95
|
onTestBegin(test, result) {
|
|
94
|
-
// Create unique test execution ID combining run ID and test ID
|
|
95
96
|
if (this.options.verbose) {
|
|
96
97
|
console.log(`Stanterprise Reporter: Test started - ${test.title}`);
|
|
97
98
|
console.log(` Run ID: ${this.runId}`);
|
|
98
99
|
console.log(` Test ID: ${test.id}`);
|
|
99
100
|
}
|
|
100
101
|
if (this.options.grpcEnabled) {
|
|
101
|
-
(0, handlers_1.handleOnTestBeginEvent)(test, result, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
102
|
+
(0, handlers_1.handleOnTestBeginEvent)(test, result, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
async onStepBegin(test, result, step) {
|
|
@@ -107,7 +108,7 @@ class StanterpriseReporter {
|
|
|
107
108
|
console.log(` Category: ${step.category}`);
|
|
108
109
|
}
|
|
109
110
|
if (this.options.grpcEnabled) {
|
|
110
|
-
(0, handlers_1.handleOnStepBeginEvent)(test, result, step, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
111
|
+
(0, handlers_1.handleOnStepBeginEvent)(test, result, step, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
onStepEnd(test, result, step) {
|
|
@@ -116,7 +117,7 @@ class StanterpriseReporter {
|
|
|
116
117
|
console.log(` Duration: ${step.duration}ms`);
|
|
117
118
|
}
|
|
118
119
|
if (this.options.grpcEnabled) {
|
|
119
|
-
(0, handlers_1.handleOnStepEndEvent)(test, result, step, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
120
|
+
(0, handlers_1.handleOnStepEndEvent)(test, result, step, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
onTestEnd(test, result) {
|
|
@@ -126,7 +127,7 @@ class StanterpriseReporter {
|
|
|
126
127
|
console.log(` Duration: ${result.duration}ms`);
|
|
127
128
|
}
|
|
128
129
|
if (this.options.grpcEnabled) {
|
|
129
|
-
(0, handlers_1.handleOnTestEndEvent)(test, result, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
130
|
+
(0, handlers_1.handleOnTestEndEvent)(test, result, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
onTestFail(test, result) {
|
|
@@ -134,7 +135,7 @@ class StanterpriseReporter {
|
|
|
134
135
|
console.log(`Stanterprise Reporter: Test failed - ${test.title}`);
|
|
135
136
|
}
|
|
136
137
|
if (this.options.grpcEnabled) {
|
|
137
|
-
(0, handlers_1.handleOnTestFailEvent)(test, result, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
138
|
+
(0, handlers_1.handleOnTestFailEvent)(test, result, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
onError(error) {
|
|
@@ -144,7 +145,7 @@ class StanterpriseReporter {
|
|
|
144
145
|
console.error(`Stack trace: ${error.stack}`);
|
|
145
146
|
}
|
|
146
147
|
if (this.options.grpcEnabled) {
|
|
147
|
-
(0, handlers_1.handleOnErrorEvent)(error, this.runId, this.grpcClient, this.options, this.messageQueue);
|
|
148
|
+
(0, handlers_1.handleOnErrorEvent)(error, this.runId, this.executionId, this.grpcClient, this.options, this.messageQueue);
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
onStdErr(chunk, test, result) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility functions for processing test attachments
|
|
3
3
|
*/
|
|
4
|
-
import type { TestResult } from "@playwright/test/reporter";
|
|
4
|
+
import type { TestResult, TestStep } from "@playwright/test/reporter";
|
|
5
5
|
import { common } from "@stanterprise/protobuf";
|
|
6
6
|
declare const Attachment: typeof common.v1.common.Attachment;
|
|
7
7
|
/**
|
|
8
8
|
* Process Playwright test attachments into protobuf Attachment objects
|
|
9
|
-
* @param result Test result containing attachments
|
|
9
|
+
* @param result Test result or test step containing attachments
|
|
10
10
|
* @param maxAttachmentSize Maximum size for attachment content (default 1MB, reduced from 10MB)
|
|
11
11
|
*/
|
|
12
|
-
export declare function processAttachments(result: TestResult, maxAttachmentSize?: number): InstanceType<typeof Attachment>[];
|
|
12
|
+
export declare function processAttachments(result: TestResult | TestStep, maxAttachmentSize?: number): InstanceType<typeof Attachment>[];
|
|
13
13
|
/**
|
|
14
14
|
* Extract error information from test results
|
|
15
15
|
*/
|
|
@@ -10,11 +10,10 @@ const Attachment = protobuf_1.common.v1.common.Attachment;
|
|
|
10
10
|
const BYTES_PER_MB = 1048576;
|
|
11
11
|
/**
|
|
12
12
|
* Process Playwright test attachments into protobuf Attachment objects
|
|
13
|
-
* @param result Test result containing attachments
|
|
13
|
+
* @param result Test result or test step containing attachments
|
|
14
14
|
* @param maxAttachmentSize Maximum size for attachment content (default 1MB, reduced from 10MB)
|
|
15
15
|
*/
|
|
16
|
-
function processAttachments(result, maxAttachmentSize = 1048576
|
|
17
|
-
) {
|
|
16
|
+
function processAttachments(result, maxAttachmentSize = 1048576) {
|
|
18
17
|
const attachments = [];
|
|
19
18
|
if (!result.attachments || result.attachments.length === 0) {
|
|
20
19
|
return attachments;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stanterprise/playwright-reporter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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": {
|
|
@@ -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.1.
|
|
56
|
+
"@stanterprise/protobuf": "^0.1.3"
|
|
57
57
|
}
|
|
58
58
|
}
|