testlens-playwright-reporter 0.3.3 → 0.3.4
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/cross-env.js +24 -0
- package/index.d.ts +191 -120
- package/index.js +1097 -1040
- package/index.ts +155 -19
- package/package.json +11 -3
- package/postinstall.js +39 -0
- package/lib/index.js +0 -1016
package/cross-env.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Cross-platform wrapper for cross-env
|
|
4
|
+
*
|
|
5
|
+
* This wrapper allows users to set environment variables in a cross-platform way
|
|
6
|
+
* without needing to install cross-env separately.
|
|
7
|
+
*
|
|
8
|
+
* Platform Support:
|
|
9
|
+
* - Windows (PowerShell, CMD)
|
|
10
|
+
* - macOS (bash, zsh, etc.)
|
|
11
|
+
* - Linux (bash, sh, etc.)
|
|
12
|
+
* - Any platform that runs Node.js
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* npx testlens-cross-env VAR1=value1 VAR2=value2 command args...
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* npx testlens-cross-env testlensApiKey="abc123" playwright test
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const crossEnv = require('cross-env');
|
|
22
|
+
|
|
23
|
+
// Pass all command-line arguments to cross-env
|
|
24
|
+
crossEnv(process.argv.slice(2));
|
package/index.d.ts
CHANGED
|
@@ -1,120 +1,191 @@
|
|
|
1
|
-
import { Reporter } from '@playwright/test/reporter';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export interface TestLensReporterOptions {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
import type { Reporter, TestCase, TestResult, FullConfig, Suite } from '@playwright/test/reporter';
|
|
2
|
+
export interface TestLensReporterConfig {
|
|
3
|
+
/** TestLens API endpoint URL */
|
|
4
|
+
apiEndpoint?: string;
|
|
5
|
+
/** API key for authentication - can be provided in config or via TESTLENS_API_KEY environment variable */
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
/** Enable real-time streaming of test events */
|
|
8
|
+
enableRealTimeStream?: boolean;
|
|
9
|
+
/** Enable Git information collection */
|
|
10
|
+
enableGitInfo?: boolean;
|
|
11
|
+
/** Enable artifact processing */
|
|
12
|
+
enableArtifacts?: boolean;
|
|
13
|
+
/** Enable video capture - defaults to true */
|
|
14
|
+
enableVideo?: boolean;
|
|
15
|
+
/** Enable screenshot capture - defaults to true */
|
|
16
|
+
enableScreenshot?: boolean;
|
|
17
|
+
/** Batch size for API requests */
|
|
18
|
+
batchSize?: number;
|
|
19
|
+
/** Flush interval in milliseconds */
|
|
20
|
+
flushInterval?: number;
|
|
21
|
+
/** Number of retry attempts for failed API calls */
|
|
22
|
+
retryAttempts?: number;
|
|
23
|
+
/** Request timeout in milliseconds */
|
|
24
|
+
timeout?: number;
|
|
25
|
+
/** SSL certificate validation - set to false to disable SSL verification */
|
|
26
|
+
rejectUnauthorized?: boolean;
|
|
27
|
+
/** Alternative SSL option - set to true to ignore SSL certificate errors */
|
|
28
|
+
ignoreSslErrors?: boolean;
|
|
29
|
+
/** Custom metadata from CLI arguments (automatically parsed from --key=value arguments) */
|
|
30
|
+
customMetadata?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
export interface TestLensReporterOptions {
|
|
33
|
+
/** TestLens API endpoint URL */
|
|
34
|
+
apiEndpoint?: string;
|
|
35
|
+
/** API key for authentication - can be provided in config or via TESTLENS_API_KEY environment variable */
|
|
36
|
+
apiKey?: string;
|
|
37
|
+
/** Enable real-time streaming of test events */
|
|
38
|
+
enableRealTimeStream?: boolean;
|
|
39
|
+
/** Enable Git information collection */
|
|
40
|
+
enableGitInfo?: boolean;
|
|
41
|
+
/** Enable artifact processing */
|
|
42
|
+
enableArtifacts?: boolean;
|
|
43
|
+
/** Enable video capture - defaults to true */
|
|
44
|
+
enableVideo?: boolean;
|
|
45
|
+
/** Enable screenshot capture - defaults to true */
|
|
46
|
+
enableScreenshot?: boolean;
|
|
47
|
+
/** Batch size for API requests */
|
|
48
|
+
batchSize?: number;
|
|
49
|
+
/** Flush interval in milliseconds */
|
|
50
|
+
flushInterval?: number;
|
|
51
|
+
/** Number of retry attempts for failed API calls */
|
|
52
|
+
retryAttempts?: number;
|
|
53
|
+
/** Request timeout in milliseconds */
|
|
54
|
+
timeout?: number;
|
|
55
|
+
/** SSL certificate validation - set to false to disable SSL verification */
|
|
56
|
+
rejectUnauthorized?: boolean;
|
|
57
|
+
/** Alternative SSL option - set to true to ignore SSL certificate errors */
|
|
58
|
+
ignoreSslErrors?: boolean;
|
|
59
|
+
/** Custom metadata from CLI arguments (automatically parsed from --key=value arguments) */
|
|
60
|
+
customMetadata?: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
export interface GitInfo {
|
|
63
|
+
branch: string;
|
|
64
|
+
commit: string;
|
|
65
|
+
shortCommit: string;
|
|
66
|
+
author: string;
|
|
67
|
+
message: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
isDirty: boolean;
|
|
70
|
+
remoteName: string;
|
|
71
|
+
remoteUrl: string;
|
|
72
|
+
}
|
|
73
|
+
export interface CodeBlock {
|
|
74
|
+
type: 'test' | 'describe';
|
|
75
|
+
name: string;
|
|
76
|
+
content: string;
|
|
77
|
+
summary?: string;
|
|
78
|
+
describe?: string;
|
|
79
|
+
startLine?: number;
|
|
80
|
+
endLine?: number;
|
|
81
|
+
}
|
|
82
|
+
export interface RunMetadata {
|
|
83
|
+
id: string;
|
|
84
|
+
startTime: string;
|
|
85
|
+
endTime?: string;
|
|
86
|
+
duration?: number;
|
|
87
|
+
environment: string;
|
|
88
|
+
browser: string;
|
|
89
|
+
os: string;
|
|
90
|
+
playwrightVersion: string;
|
|
91
|
+
nodeVersion: string;
|
|
92
|
+
gitInfo?: GitInfo | null;
|
|
93
|
+
shardInfo?: {
|
|
94
|
+
current: number;
|
|
95
|
+
total: number;
|
|
96
|
+
};
|
|
97
|
+
totalTests?: number;
|
|
98
|
+
passedTests?: number;
|
|
99
|
+
failedTests?: number;
|
|
100
|
+
skippedTests?: number;
|
|
101
|
+
status?: string;
|
|
102
|
+
testlensBuildName?: string;
|
|
103
|
+
customMetadata?: Record<string, string>;
|
|
104
|
+
}
|
|
105
|
+
export interface TestError {
|
|
106
|
+
message: string;
|
|
107
|
+
stack?: string;
|
|
108
|
+
location?: {
|
|
109
|
+
file: string;
|
|
110
|
+
line: number;
|
|
111
|
+
column: number;
|
|
112
|
+
};
|
|
113
|
+
snippet?: string;
|
|
114
|
+
expected?: string;
|
|
115
|
+
actual?: string;
|
|
116
|
+
diff?: string;
|
|
117
|
+
matcherName?: string;
|
|
118
|
+
timeout?: number;
|
|
119
|
+
}
|
|
120
|
+
export interface TestData {
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
status: string;
|
|
124
|
+
originalStatus?: string;
|
|
125
|
+
duration: number;
|
|
126
|
+
startTime: string;
|
|
127
|
+
endTime: string;
|
|
128
|
+
errorMessages: string[];
|
|
129
|
+
errors?: TestError[];
|
|
130
|
+
retryAttempts: number;
|
|
131
|
+
currentRetry: number;
|
|
132
|
+
annotations: Array<{
|
|
133
|
+
type: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
}>;
|
|
136
|
+
projectName: string;
|
|
137
|
+
workerIndex?: number;
|
|
138
|
+
parallelIndex?: number;
|
|
139
|
+
location?: {
|
|
140
|
+
file: string;
|
|
141
|
+
line: number;
|
|
142
|
+
column: number;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export interface SpecData {
|
|
146
|
+
filePath: string;
|
|
147
|
+
testSuiteName: string;
|
|
148
|
+
tags?: string[];
|
|
149
|
+
startTime: string;
|
|
150
|
+
endTime?: string;
|
|
151
|
+
status: string;
|
|
152
|
+
}
|
|
153
|
+
export declare class TestLensReporter implements Reporter {
|
|
154
|
+
private config;
|
|
155
|
+
private axiosInstance;
|
|
156
|
+
private runId;
|
|
157
|
+
private runMetadata;
|
|
158
|
+
private specMap;
|
|
159
|
+
private testMap;
|
|
160
|
+
private runCreationFailed;
|
|
161
|
+
/**
|
|
162
|
+
* Parse custom metadata from environment variables
|
|
163
|
+
* Checks for common metadata environment variables
|
|
164
|
+
*/
|
|
165
|
+
private static parseCustomArgs;
|
|
166
|
+
constructor(options: TestLensReporterOptions);
|
|
167
|
+
private initializeRunMetadata;
|
|
168
|
+
private getPlaywrightVersion;
|
|
169
|
+
private normalizeTestStatus;
|
|
170
|
+
private normalizeRunStatus;
|
|
171
|
+
onBegin(config: FullConfig, suite: Suite): Promise<void>;
|
|
172
|
+
onTestBegin(test: TestCase, result: TestResult): Promise<void>;
|
|
173
|
+
onTestEnd(test: TestCase, result: TestResult): Promise<void>;
|
|
174
|
+
onEnd(result: {
|
|
175
|
+
status: string;
|
|
176
|
+
}): Promise<void>;
|
|
177
|
+
private sendToApi;
|
|
178
|
+
private processArtifacts;
|
|
179
|
+
private sendSpecCodeBlocks;
|
|
180
|
+
private extractTestBlocks;
|
|
181
|
+
private collectGitInfo;
|
|
182
|
+
private getArtifactType;
|
|
183
|
+
private extractTags;
|
|
184
|
+
private getTestId;
|
|
185
|
+
private uploadArtifactToS3;
|
|
186
|
+
private getContentType;
|
|
187
|
+
private generateS3Key;
|
|
188
|
+
private sanitizeForS3;
|
|
189
|
+
private getFileSize;
|
|
190
|
+
}
|
|
191
|
+
export default TestLensReporter;
|