@alternative-path/testlens-playwright-reporter 0.4.6 → 0.4.8

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
@@ -1,163 +1,163 @@
1
- # TestLens Playwright Reporter
2
-
3
- A Playwright reporter for [TestLens](https://testlens.qa-path.com) - real-time test monitoring dashboard.
4
-
5
- ## Features
6
-
7
- - 🚀 **Real-time streaming** - Watch test results as they happen in the dashboard
8
- - 📸 **Artifact support** - Shows screenshots, videos, and traces
9
- - 🔄 **Retry tracking** - Monitor test retries and identify flaky tests
10
- - ⚡ **Cross-platform** - Works on Windows, macOS, and Linux
11
-
12
- ## Installation
13
-
14
- ```bash
15
- npm i @alternative-path/testlens-playwright-reporter
16
- ```
17
-
18
- ## Configuration
19
-
20
- ### Quick Start (Recommended)
21
-
22
- The simplest config - API key and metadata are passed via environment variables:
23
-
24
- **TypeScript (`playwright.config.ts`)**
25
- ```typescript
26
- import { defineConfig } from '@playwright/test';
27
-
28
- export default defineConfig({
29
- use: {
30
- screenshot: 'on',
31
- video: 'on',
32
- trace: 'on',
33
- },
34
- reporter: [
35
- ['testlens-playwright-reporter']
36
- // API key is auto-detected from TESTLENS_API_KEY env var
37
- // Build metadata is auto-detected from testlensBuildName/testlensBuildTag env vars
38
- ],
39
- });
40
- ```
41
-
42
- **JavaScript (`playwright.config.js`)**
43
- ```javascript
44
- const { defineConfig } = require('@playwright/test');
45
-
46
- module.exports = defineConfig({
47
- use: {
48
- screenshot: 'on',
49
- video: 'on',
50
- trace: 'on',
51
- },
52
- reporter: [
53
- ['testlens-playwright-reporter']
54
- // API key is auto-detected from TESTLENS_API_KEY env var
55
- // Build metadata is auto-detected from testlensBuildName/testlensBuildTag env vars
56
- ],
57
- });
58
- ```
59
-
60
- ### Advanced Configuration (Optional)
61
-
62
- If you prefer to set API key or metadata explicitly in config:
63
-
64
- **TypeScript (`playwright.config.ts`)**
65
- ```typescript
66
- import { defineConfig } from '@playwright/test';
67
-
68
- export default defineConfig({
69
- use: {
70
- screenshot: 'on',
71
- video: 'on',
72
- trace: 'on',
73
- },
74
- reporter: [
75
- ['@alternative-path/testlens-playwright-reporter', {
76
- apiKey: process.env.TESTLENS_API_KEY || 'your-api-key-here',
77
-
78
- // Optional: explicitly forward build metadata from env vars
79
- customMetadata: {
80
- testlensBuildName: process.env.testlensBuildName,
81
- testlensBuildTag: process.env.testlensBuildTag,
82
- },
83
- }]
84
- ],
85
- });
86
- ```
87
-
88
- **JavaScript (`playwright.config.js`)**
89
- ```javascript
90
- const { defineConfig } = require('@playwright/test');
91
-
92
- module.exports = defineConfig({
93
- use: {
94
- screenshot: 'on',
95
- video: 'on',
96
- trace: 'on',
97
- },
98
- reporter: [
99
- ['@alternative-path/testlens-playwright-reporter', {
100
- apiKey: process.env.TESTLENS_API_KEY || 'your-api-key-here',
101
-
102
- // Optional: explicitly forward build metadata from env vars
103
- customMetadata: {
104
- testlensBuildName: process.env.testlensBuildName,
105
- testlensBuildTag: process.env.testlensBuildTag,
106
- },
107
- }]
108
- ],
109
- });
110
- ```
111
-
112
- ## Run With Build Name & Tag (UI Mode)
113
-
114
- Use `testlens-cross-env` (bundled with this package) to set API key and metadata cross-platform, including Windows.
115
-
116
- ### Command
117
-
118
- ```bash
119
- npx testlens-cross-env TESTLENS_API_KEY="<your-api-key>" testlensBuildName="Testing Build Local Environment" testlensBuildTag="smoke" playwright test --ui
120
- ```
121
-
122
- ### What Gets Auto-Detected
123
-
124
- The reporter automatically reads these environment variables (no config changes needed):
125
-
126
- - **API Key**: `TESTLENS_API_KEY` (also checks: `testlens_api_key`, `TESTLENS_KEY`, `testlensApiKey`, `PLAYWRIGHT_API_KEY`, `PW_API_KEY`)
127
- - **Build Name**: `testlensBuildName` (also checks: `TESTLENS_BUILD_NAME`, `BUILDNAME`, `BUILD_NAME`)
128
- - **Build Tag**: `testlensBuildTag` (also checks: `TESTLENS_BUILD_TAG`, `BUILDTAG`, `BUILD_TAG`)
129
-
130
- ### Notes
131
-
132
- - No config changes required - just pass env vars in the command
133
- - `testlensBuildName` and `testlensBuildTag` are sent to TestLens as run `custom_metadata`
134
- - Multiple tags: use comma-separated list `testlensBuildTag="smoke,regression"`
135
-
136
- > 💡 **Tip:** Keep `screenshot`, `video`, and `trace` set to `'on'` for better debugging experience. TestLens automatically uploads these artifacts for failed tests, making it easier to identify issues.
137
-
138
- ### Configuration Options
139
-
140
- | Option | Type | Default | Description |
141
- |--------|------|---------|-------------|
142
- | `apiKey` | `string` | **Required** | Your TestLens API key |
143
-
144
- ## Artifacts
145
-
146
- TestLens automatically captures and uploads:
147
-
148
- | Artifact | Description |
149
- |----------|-------------|
150
- | **Screenshots** | Visual snapshots of test failures |
151
- | **Videos** | Full video recording of test execution |
152
- | **Traces** | Playwright trace files for step-by-step debugging |
153
-
154
- These artifacts are viewable directly in the TestLens dashboard for easy debugging.
155
-
156
- ## Requirements
157
-
158
- - Node.js >= 16.0.0
159
- - Playwright >= 1.40.0
160
-
161
- ## License
162
-
163
- MIT License
1
+ # TestLens Playwright Reporter
2
+
3
+ A Playwright reporter for [TestLens](https://testlens.qa-path.com) - real-time test monitoring dashboard.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Real-time streaming** - Watch test results as they happen in the dashboard
8
+ - 📸 **Artifact support** - Shows screenshots, videos, and traces
9
+ - 🔄 **Retry tracking** - Monitor test retries and identify flaky tests
10
+ - ⚡ **Cross-platform** - Works on Windows, macOS, and Linux
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm i @alternative-path/testlens-playwright-reporter
16
+ ```
17
+
18
+ ## Configuration
19
+
20
+ ### Quick Start (Recommended)
21
+
22
+ The simplest config - API key and metadata are passed via environment variables:
23
+
24
+ **TypeScript (`playwright.config.ts`)**
25
+ ```typescript
26
+ import { defineConfig } from '@playwright/test';
27
+
28
+ export default defineConfig({
29
+ use: {
30
+ screenshot: 'on',
31
+ video: 'on',
32
+ trace: 'on',
33
+ },
34
+ reporter: [
35
+ ['testlens-playwright-reporter']
36
+ // API key is auto-detected from TESTLENS_API_KEY env var
37
+ // Build metadata is auto-detected from testlensBuildName/testlensBuildTag env vars
38
+ ],
39
+ });
40
+ ```
41
+
42
+ **JavaScript (`playwright.config.js`)**
43
+ ```javascript
44
+ const { defineConfig } = require('@playwright/test');
45
+
46
+ module.exports = defineConfig({
47
+ use: {
48
+ screenshot: 'on',
49
+ video: 'on',
50
+ trace: 'on',
51
+ },
52
+ reporter: [
53
+ ['testlens-playwright-reporter']
54
+ // API key is auto-detected from TESTLENS_API_KEY env var
55
+ // Build metadata is auto-detected from testlensBuildName/testlensBuildTag env vars
56
+ ],
57
+ });
58
+ ```
59
+
60
+ ### Advanced Configuration (Optional)
61
+
62
+ If you prefer to set API key or metadata explicitly in config:
63
+
64
+ **TypeScript (`playwright.config.ts`)**
65
+ ```typescript
66
+ import { defineConfig } from '@playwright/test';
67
+
68
+ export default defineConfig({
69
+ use: {
70
+ screenshot: 'on',
71
+ video: 'on',
72
+ trace: 'on',
73
+ },
74
+ reporter: [
75
+ ['@alternative-path/testlens-playwright-reporter', {
76
+ apiKey: process.env.TESTLENS_API_KEY || 'your-api-key-here',
77
+
78
+ // Optional: explicitly forward build metadata from env vars
79
+ customMetadata: {
80
+ testlensBuildName: process.env.testlensBuildName,
81
+ testlensBuildTag: process.env.testlensBuildTag,
82
+ },
83
+ }]
84
+ ],
85
+ });
86
+ ```
87
+
88
+ **JavaScript (`playwright.config.js`)**
89
+ ```javascript
90
+ const { defineConfig } = require('@playwright/test');
91
+
92
+ module.exports = defineConfig({
93
+ use: {
94
+ screenshot: 'on',
95
+ video: 'on',
96
+ trace: 'on',
97
+ },
98
+ reporter: [
99
+ ['@alternative-path/testlens-playwright-reporter', {
100
+ apiKey: process.env.TESTLENS_API_KEY || 'your-api-key-here',
101
+
102
+ // Optional: explicitly forward build metadata from env vars
103
+ customMetadata: {
104
+ testlensBuildName: process.env.testlensBuildName,
105
+ testlensBuildTag: process.env.testlensBuildTag,
106
+ },
107
+ }]
108
+ ],
109
+ });
110
+ ```
111
+
112
+ ## Run With Build Name & Tag (UI Mode)
113
+
114
+ Use `testlens-cross-env` (bundled with this package) to set API key and metadata cross-platform, including Windows.
115
+
116
+ ### Command
117
+
118
+ ```bash
119
+ npx testlens-cross-env TESTLENS_API_KEY="<your-api-key>" testlensBuildName="Testing Build Local Environment" testlensBuildTag="smoke" playwright test --ui
120
+ ```
121
+
122
+ ### What Gets Auto-Detected
123
+
124
+ The reporter automatically reads these environment variables (no config changes needed):
125
+
126
+ - **API Key**: `TESTLENS_API_KEY` (also checks: `testlens_api_key`, `TESTLENS_KEY`, `testlensApiKey`, `PLAYWRIGHT_API_KEY`, `PW_API_KEY`)
127
+ - **Build Name**: `testlensBuildName` (also checks: `TESTLENS_BUILD_NAME`, `BUILDNAME`, `BUILD_NAME`)
128
+ - **Build Tag**: `testlensBuildTag` (also checks: `TESTLENS_BUILD_TAG`, `BUILDTAG`, `BUILD_TAG`)
129
+
130
+ ### Notes
131
+
132
+ - No config changes required - just pass env vars in the command
133
+ - `testlensBuildName` and `testlensBuildTag` are sent to TestLens as run `custom_metadata`
134
+ - Multiple tags: use comma-separated list `testlensBuildTag="smoke,regression"`
135
+
136
+ > 💡 **Tip:** Keep `screenshot`, `video`, and `trace` set to `'on'` for better debugging experience. TestLens automatically uploads these artifacts for failed tests, making it easier to identify issues.
137
+
138
+ ### Configuration Options
139
+
140
+ | Option | Type | Default | Description |
141
+ |--------|------|---------|-------------|
142
+ | `apiKey` | `string` | **Required** | Your TestLens API key |
143
+
144
+ ## Artifacts
145
+
146
+ TestLens automatically captures and uploads:
147
+
148
+ | Artifact | Description |
149
+ |----------|-------------|
150
+ | **Screenshots** | Visual snapshots of test failures |
151
+ | **Videos** | Full video recording of test execution |
152
+ | **Traces** | Playwright trace files for step-by-step debugging |
153
+
154
+ These artifacts are viewable directly in the TestLens dashboard for easy debugging.
155
+
156
+ ## Requirements
157
+
158
+ - Node.js >= 16.0.0
159
+ - Playwright >= 1.40.0
160
+
161
+ ## License
162
+
163
+ MIT License
package/index.d.ts CHANGED
@@ -99,6 +99,7 @@ export interface RunMetadata {
99
99
  passedTests?: number;
100
100
  failedTests?: number;
101
101
  skippedTests?: number;
102
+ timedOutTests?: number;
102
103
  status?: string;
103
104
  testlensBuildName?: string;
104
105
  customMetadata?: Record<string, string | string[]>;
@@ -161,6 +162,7 @@ export declare class TestLensReporter implements Reporter {
161
162
  private runCreationFailed;
162
163
  private cliArgs;
163
164
  private pendingUploads;
165
+ private traceNetworkRows;
164
166
  private artifactStats;
165
167
  private artifactsSeen;
166
168
  /**