@zest-pw/test 1.0.0
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/LICENSE +22 -0
- package/README.md +415 -0
- package/dist/config.d.ts +127 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +140 -0
- package/dist/fixtures/fixtures.d.ts +3 -0
- package/dist/fixtures/fixtures.d.ts.map +1 -0
- package/dist/fixtures/fixtures.js +24 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/reporter/custom-reporter.d.ts +11 -0
- package/dist/reporter/custom-reporter.d.ts.map +1 -0
- package/dist/reporter/custom-reporter.js +19 -0
- package/dist/reporter/result-processor.d.ts +11 -0
- package/dist/reporter/result-processor.d.ts.map +1 -0
- package/dist/reporter/result-processor.js +52 -0
- package/dist/reporter/test-results-store.d.ts +31 -0
- package/dist/reporter/test-results-store.d.ts.map +1 -0
- package/dist/reporter/test-results-store.js +38 -0
- package/dist/utils/add-file-names.d.ts +9 -0
- package/dist/utils/add-file-names.d.ts.map +1 -0
- package/dist/utils/add-file-names.js +39 -0
- package/dist/utils/enrich-test-results.d.ts +6 -0
- package/dist/utils/enrich-test-results.d.ts.map +1 -0
- package/dist/utils/enrich-test-results.js +113 -0
- package/dist/utils/parse-test-steps.d.ts +8 -0
- package/dist/utils/parse-test-steps.d.ts.map +1 -0
- package/dist/utils/parse-test-steps.js +110 -0
- package/dist/utils/save-json-report.d.ts +17 -0
- package/dist/utils/save-json-report.d.ts.map +1 -0
- package/dist/utils/save-json-report.js +75 -0
- package/dist/utils/save-screenshots.d.ts +9 -0
- package/dist/utils/save-screenshots.d.ts.map +1 -0
- package/dist/utils/save-screenshots.js +66 -0
- package/dist/utils/take-screenshots.d.ts +13 -0
- package/dist/utils/take-screenshots.d.ts.map +1 -0
- package/dist/utils/take-screenshots.js +34 -0
- package/dist/utils/terminal-reporter.d.ts +8 -0
- package/dist/utils/terminal-reporter.d.ts.map +1 -0
- package/dist/utils/terminal-reporter.js +140 -0
- package/dist/utils/test-result-transformer.d.ts +13 -0
- package/dist/utils/test-result-transformer.d.ts.map +1 -0
- package/dist/utils/test-result-transformer.js +109 -0
- package/dist/utils/test-step-wrapper.d.ts +13 -0
- package/dist/utils/test-step-wrapper.d.ts.map +1 -0
- package/dist/utils/test-step-wrapper.js +48 -0
- package/dist/zephyr-api/get-results-from-json.d.ts +2 -0
- package/dist/zephyr-api/get-results-from-json.d.ts.map +1 -0
- package/dist/zephyr-api/get-results-from-json.js +71 -0
- package/dist/zephyr-api/update-execution-result.d.ts +2 -0
- package/dist/zephyr-api/update-execution-result.d.ts.map +1 -0
- package/dist/zephyr-api/update-execution-result.js +26 -0
- package/dist/zephyr-api/zephyr-api.d.ts +19 -0
- package/dist/zephyr-api/zephyr-api.d.ts.map +1 -0
- package/dist/zephyr-api/zephyr-api.js +89 -0
- package/package.json +69 -0
- package/scripts/install-config.js +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Zest Playwright Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# Zest Playwright Test Framework
|
|
2
|
+
|
|
3
|
+
Advanced Playwright test framework with automatic screenshots, custom reporting, and Zephyr Scale integration.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 📸 **Automatic Screenshots** - Capture screenshots after each test step
|
|
8
|
+
- 📊 **Custom JSON Reports** - Detailed test results with step information
|
|
9
|
+
- 🔄 **Zephyr Scale Integration** - Automatically update test results in Zephyr
|
|
10
|
+
- ⚙️ **Type-Safe Configuration** - Configure behavior via `zest.config.ts`
|
|
11
|
+
- 🎯 **Step-by-Step Tracking** - Detailed information about each test step
|
|
12
|
+
- 🖼️ **Base64 Screenshots in Reports** - Screenshots embedded directly in JSON
|
|
13
|
+
|
|
14
|
+
## 🚀 Quick Start
|
|
15
|
+
|
|
16
|
+
### 1. Install the Package
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install --save-dev @zest-pw/test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Configuration
|
|
23
|
+
|
|
24
|
+
The configuration file `zest.config.ts` will be automatically created in your project root after installation. If it wasn't created automatically, run:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx zest-pw-init
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The default configuration:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { defineZestConfig } from '@zest-pw/test';
|
|
34
|
+
|
|
35
|
+
export default defineZestConfig({
|
|
36
|
+
reporter: {
|
|
37
|
+
saveJsonReport: true,
|
|
38
|
+
printToConsole: true,
|
|
39
|
+
outputDir: 'test-results',
|
|
40
|
+
},
|
|
41
|
+
screenshots: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
includeInReport: true,
|
|
44
|
+
onlyOnFailure: false,
|
|
45
|
+
},
|
|
46
|
+
zephyr: {
|
|
47
|
+
enabled: false,
|
|
48
|
+
updateResults: false,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Configure Playwright
|
|
54
|
+
|
|
55
|
+
Update your `playwright.config.ts`:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { defineConfig } from '@playwright/test';
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
reporter: [
|
|
62
|
+
['list'],
|
|
63
|
+
['@zest-pw/test/reporter'], // Add Zest reporter
|
|
64
|
+
],
|
|
65
|
+
// ... other Playwright config
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 4. Write Your First Test
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { test, expect } from '@zest-pw/test';
|
|
73
|
+
|
|
74
|
+
test('TC-001: Check the title', async ({ page }) => {
|
|
75
|
+
|
|
76
|
+
await test.step('Go to the playwright website', async () => {
|
|
77
|
+
await page.goto('https://playwright.dev/');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
await test.step('Check the title', async () => {
|
|
81
|
+
await expect(page).toHaveTitle(/Playwright/);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 5. Run Tests
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx playwright test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## ⚙️ Configuration
|
|
93
|
+
|
|
94
|
+
### Configuration File
|
|
95
|
+
|
|
96
|
+
The `zest.config.ts` file is automatically created when you install the package. You can customize it as needed:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { defineZestConfig } from '@zest-pw/test';
|
|
100
|
+
|
|
101
|
+
export default defineZestConfig({
|
|
102
|
+
reporter: {
|
|
103
|
+
// Save test results to JSON file
|
|
104
|
+
saveJsonReport: true,
|
|
105
|
+
|
|
106
|
+
// Output directory for reports
|
|
107
|
+
outputDir: 'test-results',
|
|
108
|
+
|
|
109
|
+
// Print test results to console
|
|
110
|
+
printToConsole: false,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
screenshots: {
|
|
114
|
+
// Enable screenshot capture
|
|
115
|
+
enabled: true,
|
|
116
|
+
|
|
117
|
+
// Include screenshots in JSON report
|
|
118
|
+
includeInReport: true,
|
|
119
|
+
|
|
120
|
+
// Capture screenshots only on failure
|
|
121
|
+
onlyOnFailure: false,
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
zephyr: {
|
|
125
|
+
// Enable Zephyr Scale integration
|
|
126
|
+
enabled: false,
|
|
127
|
+
|
|
128
|
+
// Update test results in Zephyr after test run
|
|
129
|
+
updateResults: false,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
For detailed configuration options, see [CONFIG.md](./CONFIG.md).
|
|
135
|
+
|
|
136
|
+
## 📸 Screenshots
|
|
137
|
+
|
|
138
|
+
Screenshots are automatically captured after each `test.step()` and:
|
|
139
|
+
- **Embedded in JSON report** as base64 (if `includeInReport: true`)
|
|
140
|
+
- **Named descriptively** based on step title and index
|
|
141
|
+
- **Include error screenshots** when tests fail
|
|
142
|
+
|
|
143
|
+
### Screenshot Settings
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
screenshots: {
|
|
147
|
+
enabled: true, // Enable/disable screenshots
|
|
148
|
+
includeInReport: true, // Include in JSON report
|
|
149
|
+
onlyOnFailure: false, // Capture only on test failure
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Example Screenshot Output
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"fileName": "step_1_go_to_the_playwright_website.png",
|
|
158
|
+
"image": "image/png",
|
|
159
|
+
"body": "base64_encoded_screenshot..."
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 📊 Test Reports
|
|
164
|
+
|
|
165
|
+
### JSON Report
|
|
166
|
+
|
|
167
|
+
Test results are automatically saved to `test-results/test-results.json`:
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"tests": [
|
|
172
|
+
{
|
|
173
|
+
"testTitle": "Check the title",
|
|
174
|
+
"testCaseKey": "TC-001",
|
|
175
|
+
"steps": [
|
|
176
|
+
{
|
|
177
|
+
"stepTitle": "Go to the playwright website",
|
|
178
|
+
"actualResult": [...],
|
|
179
|
+
"statusName": "passed"
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Console Output
|
|
188
|
+
|
|
189
|
+
Enable console output in your config:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
reporter: {
|
|
193
|
+
printToConsole: true,
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 🔄 Zephyr Scale Integration
|
|
198
|
+
|
|
199
|
+
### Setup
|
|
200
|
+
|
|
201
|
+
1. Add environment variables:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# .env
|
|
205
|
+
ZEPHYR_API_URL=https://api.zephyrscale.smartbear.com/v2/
|
|
206
|
+
ZEPHYR_API_KEY=your-api-key
|
|
207
|
+
ZEPHYR_TEST_CYCLE_KEY=TEST-CYCLE-123
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
2. Enable in configuration:
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
zephyr: {
|
|
214
|
+
enabled: true,
|
|
215
|
+
updateResults: true,
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
3. Run tests - results will be automatically sent to Zephyr!
|
|
220
|
+
|
|
221
|
+
### How it Works
|
|
222
|
+
|
|
223
|
+
- Test case keys are extracted from test file names (e.g., `TC-001.spec.ts` → `TC-001`)
|
|
224
|
+
- After test execution, results are sent to Zephyr Scale
|
|
225
|
+
- Test steps are updated with actual results and screenshots
|
|
226
|
+
|
|
227
|
+
## 🛠️ Project Structure
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
your-project/
|
|
231
|
+
├── node_modules/
|
|
232
|
+
│ └── @zest-pw/
|
|
233
|
+
│ └── test/ # Installed package
|
|
234
|
+
├── tests/ # Test files
|
|
235
|
+
│ ├── TC-001.spec.ts
|
|
236
|
+
│ └── TC-002.spec.ts
|
|
237
|
+
├── test-results/ # Test results
|
|
238
|
+
│ └── test-results.json
|
|
239
|
+
├── zest.config.ts # Zest configuration (auto-created)
|
|
240
|
+
├── playwright.config.ts # Playwright configuration
|
|
241
|
+
└── package.json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 📝 Writing Tests
|
|
245
|
+
|
|
246
|
+
### Basic Test Structure
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import { test, expect } from '@zest-pw/test';
|
|
250
|
+
|
|
251
|
+
test('TC-001: Test description', async ({ page }) => {
|
|
252
|
+
|
|
253
|
+
await test.step('Step 1 description', async () => {
|
|
254
|
+
// Your test code
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
await test.step('Step 2 description', async () => {
|
|
258
|
+
// Your test code
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Test Naming Convention
|
|
264
|
+
|
|
265
|
+
Name your test files with test case keys for Zephyr integration:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
tests/
|
|
269
|
+
├── TC-001.spec.ts ✅ Good - extracts "TC-001"
|
|
270
|
+
├── TC-002.spec.ts ✅ Good - extracts "TC-002"
|
|
271
|
+
└── login.spec.ts ⚠️ Will not sync with Zephyr
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Best Practices
|
|
275
|
+
|
|
276
|
+
1. **Use descriptive step names** - they become screenshot filenames
|
|
277
|
+
2. **One test per file** - easier to manage and sync with Zephyr
|
|
278
|
+
3. **Keep steps atomic** - each step should be a single action or assertion
|
|
279
|
+
4. **Use test case keys** - for Zephyr integration
|
|
280
|
+
|
|
281
|
+
## 💡 Commands
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# Initialize configuration (if not created automatically)
|
|
285
|
+
npx zest-pw-init
|
|
286
|
+
|
|
287
|
+
# Run all tests
|
|
288
|
+
npx playwright test
|
|
289
|
+
|
|
290
|
+
# Run specific test
|
|
291
|
+
npx playwright test tests/TC-001.spec.ts
|
|
292
|
+
|
|
293
|
+
# Run in headed mode
|
|
294
|
+
npx playwright test --headed
|
|
295
|
+
|
|
296
|
+
# Run in debug mode
|
|
297
|
+
npx playwright test --debug
|
|
298
|
+
|
|
299
|
+
# Run with UI
|
|
300
|
+
npx playwright test --ui
|
|
301
|
+
|
|
302
|
+
# Generate Playwright report
|
|
303
|
+
npx playwright show-report
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 🔧 Advanced Usage
|
|
307
|
+
|
|
308
|
+
### Custom Configuration per Environment
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
const isDev = process.env.NODE_ENV === 'development';
|
|
312
|
+
const isCI = process.env.CI === 'true';
|
|
313
|
+
|
|
314
|
+
export default defineZestConfig({
|
|
315
|
+
reporter: {
|
|
316
|
+
printToConsole: isDev,
|
|
317
|
+
},
|
|
318
|
+
screenshots: {
|
|
319
|
+
onlyOnFailure: isCI,
|
|
320
|
+
},
|
|
321
|
+
zephyr: {
|
|
322
|
+
enabled: isCI,
|
|
323
|
+
updateResults: isCI,
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Accessing Configuration in Code
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { getZestConfig } from '@zest-pw/test';
|
|
332
|
+
|
|
333
|
+
const config = getZestConfig();
|
|
334
|
+
console.log('Screenshots enabled:', config.screenshots.enabled);
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Programmatic Configuration
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
import { defineZestConfig } from '@zest-pw/test';
|
|
341
|
+
|
|
342
|
+
export default defineZestConfig({
|
|
343
|
+
reporter: {
|
|
344
|
+
saveJsonReport: process.env.SAVE_REPORTS !== 'false',
|
|
345
|
+
outputDir: process.env.REPORT_DIR || 'test-results',
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## 🐛 Troubleshooting
|
|
351
|
+
|
|
352
|
+
### Configuration file not created automatically
|
|
353
|
+
|
|
354
|
+
If `zest.config.ts` wasn't created after installation, run:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
npx zest-pw-init
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Or create it manually using the template from the Configuration section.
|
|
361
|
+
|
|
362
|
+
### Screenshots not appearing in report
|
|
363
|
+
|
|
364
|
+
Check your configuration:
|
|
365
|
+
```typescript
|
|
366
|
+
screenshots: {
|
|
367
|
+
enabled: true,
|
|
368
|
+
includeInReport: true,
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Zephyr integration not working
|
|
373
|
+
|
|
374
|
+
1. Verify environment variables are set
|
|
375
|
+
2. Check test case keys match Zephyr format
|
|
376
|
+
3. Enable Zephyr in configuration
|
|
377
|
+
4. Check API credentials and permissions
|
|
378
|
+
|
|
379
|
+
### JSON report not saved
|
|
380
|
+
|
|
381
|
+
Ensure configuration allows saving:
|
|
382
|
+
```typescript
|
|
383
|
+
reporter: {
|
|
384
|
+
saveJsonReport: true,
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Import errors
|
|
389
|
+
|
|
390
|
+
Make sure you're importing from the installed package:
|
|
391
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
// ✅ Correct
|
|
394
|
+
import { test, expect, defineZestConfig } from '@zest-pw/test';
|
|
395
|
+
|
|
396
|
+
// ❌ Incorrect (old local paths)
|
|
397
|
+
import { test, expect } from './zest-pw/fixtures/fixtures';
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## 📚 Documentation
|
|
401
|
+
|
|
402
|
+
- [Configuration Guide](./CONFIG.md) - Detailed configuration options
|
|
403
|
+
- [Playwright Documentation](https://playwright.dev/) - Official Playwright docs
|
|
404
|
+
- [Zephyr Scale API](https://support.smartbear.com/zephyr-scale-cloud/api-docs/) - Zephyr API reference
|
|
405
|
+
|
|
406
|
+
## 🤝 Contributing
|
|
407
|
+
|
|
408
|
+
1. Fork the repository
|
|
409
|
+
2. Create a feature branch
|
|
410
|
+
3. Make your changes
|
|
411
|
+
4. Submit a pull request
|
|
412
|
+
|
|
413
|
+
## 📄 License
|
|
414
|
+
|
|
415
|
+
MIT License - see LICENSE file for details
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zest Playwright Configuration
|
|
3
|
+
*
|
|
4
|
+
* This file contains configuration options for the Zest Playwright test framework.
|
|
5
|
+
* You can customize test reporting, screenshot behavior, and Zephyr integration.
|
|
6
|
+
*/
|
|
7
|
+
export interface ZestConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Reporter settings
|
|
10
|
+
*/
|
|
11
|
+
reporter?: {
|
|
12
|
+
/**
|
|
13
|
+
* Save test results to JSON file
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
saveJsonReport?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Output directory for JSON reports
|
|
19
|
+
* @default 'test-results'
|
|
20
|
+
*/
|
|
21
|
+
outputDir?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Print test results to console
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
printToConsole?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Print verbose output (includes all step details)
|
|
29
|
+
* @default false
|
|
30
|
+
* @todo Not yet implemented - reserved for future use
|
|
31
|
+
*/
|
|
32
|
+
verbose?: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Screenshot settings
|
|
36
|
+
*/
|
|
37
|
+
screenshots?: {
|
|
38
|
+
/**
|
|
39
|
+
* Enable screenshot capture
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Include screenshots in JSON report
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
includeInReport?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Capture screenshots only on failure
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
onlyOnFailure?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Save screenshots to disk as files
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
saveToDisk?: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Zephyr Scale integration settings
|
|
61
|
+
*/
|
|
62
|
+
zephyr?: {
|
|
63
|
+
/**
|
|
64
|
+
* Enable Zephyr Scale integration
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Zephyr API URL
|
|
70
|
+
*/
|
|
71
|
+
apiUrl?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Zephyr API key (recommended to use environment variable)
|
|
74
|
+
*/
|
|
75
|
+
apiKey?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Test Cycle Key
|
|
78
|
+
*/
|
|
79
|
+
testCycleKey?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Update test results in Zephyr after test run
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
updateResults?: boolean;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Default Zest configuration
|
|
89
|
+
*/
|
|
90
|
+
export declare const defaultConfig: Required<ZestConfig>;
|
|
91
|
+
/**
|
|
92
|
+
* Define Zest configuration
|
|
93
|
+
*
|
|
94
|
+
* @param config - User configuration object
|
|
95
|
+
* @returns Merged configuration
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* export default defineZestConfig({
|
|
100
|
+
* reporter: {
|
|
101
|
+
* saveJsonReport: true,
|
|
102
|
+
* printToConsole: true,
|
|
103
|
+
* },
|
|
104
|
+
* screenshots: {
|
|
105
|
+
* enabled: true,
|
|
106
|
+
* onlyOnFailure: true,
|
|
107
|
+
* },
|
|
108
|
+
* zephyr: {
|
|
109
|
+
* enabled: true,
|
|
110
|
+
* updateResults: true,
|
|
111
|
+
* }
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function defineZestConfig(config: ZestConfig): Required<ZestConfig>;
|
|
116
|
+
/**
|
|
117
|
+
* Get current Zest configuration
|
|
118
|
+
*
|
|
119
|
+
* @returns Current configuration
|
|
120
|
+
*/
|
|
121
|
+
export declare function getZestConfig(): Required<ZestConfig>;
|
|
122
|
+
/**
|
|
123
|
+
* Load Zest configuration from file
|
|
124
|
+
* Looks for zest.config.ts in the root directory
|
|
125
|
+
*/
|
|
126
|
+
export declare function loadZestConfig(): Promise<Required<ZestConfig>>;
|
|
127
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;;WAGG;QACH,cAAc,CAAC,EAAE,OAAO,CAAC;QAEzB;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;WAGG;QACH,cAAc,CAAC,EAAE,OAAO,CAAC;QAEzB;;;;WAIG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ;;;WAGG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAElB;;;WAGG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;QAE1B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;QAExB;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;;WAGG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAElB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,UAAU,CAoB9C,CAAC;AAOF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,CAiBzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,UAAU,CAAC,CAEpD;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAcpE"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Zest Playwright Configuration
|
|
4
|
+
*
|
|
5
|
+
* This file contains configuration options for the Zest Playwright test framework.
|
|
6
|
+
* You can customize test reporting, screenshot behavior, and Zephyr integration.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.defaultConfig = void 0;
|
|
43
|
+
exports.defineZestConfig = defineZestConfig;
|
|
44
|
+
exports.getZestConfig = getZestConfig;
|
|
45
|
+
exports.loadZestConfig = loadZestConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Default Zest configuration
|
|
48
|
+
*/
|
|
49
|
+
exports.defaultConfig = {
|
|
50
|
+
reporter: {
|
|
51
|
+
saveJsonReport: true,
|
|
52
|
+
outputDir: 'test-results',
|
|
53
|
+
printToConsole: false,
|
|
54
|
+
verbose: false,
|
|
55
|
+
},
|
|
56
|
+
screenshots: {
|
|
57
|
+
enabled: true,
|
|
58
|
+
includeInReport: true,
|
|
59
|
+
onlyOnFailure: false,
|
|
60
|
+
saveToDisk: false,
|
|
61
|
+
},
|
|
62
|
+
zephyr: {
|
|
63
|
+
enabled: false,
|
|
64
|
+
apiUrl: process.env.ZEPHYR_API_URL || '',
|
|
65
|
+
apiKey: process.env.ZEPHYR_API_KEY || '',
|
|
66
|
+
testCycleKey: process.env.ZEPHYR_TEST_CYCLE_KEY || '',
|
|
67
|
+
updateResults: false,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Loaded configuration (merged with defaults)
|
|
72
|
+
*/
|
|
73
|
+
let loadedConfig = { ...exports.defaultConfig };
|
|
74
|
+
/**
|
|
75
|
+
* Define Zest configuration
|
|
76
|
+
*
|
|
77
|
+
* @param config - User configuration object
|
|
78
|
+
* @returns Merged configuration
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* export default defineZestConfig({
|
|
83
|
+
* reporter: {
|
|
84
|
+
* saveJsonReport: true,
|
|
85
|
+
* printToConsole: true,
|
|
86
|
+
* },
|
|
87
|
+
* screenshots: {
|
|
88
|
+
* enabled: true,
|
|
89
|
+
* onlyOnFailure: true,
|
|
90
|
+
* },
|
|
91
|
+
* zephyr: {
|
|
92
|
+
* enabled: true,
|
|
93
|
+
* updateResults: true,
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
function defineZestConfig(config) {
|
|
99
|
+
loadedConfig = {
|
|
100
|
+
reporter: {
|
|
101
|
+
...exports.defaultConfig.reporter,
|
|
102
|
+
...config.reporter,
|
|
103
|
+
},
|
|
104
|
+
screenshots: {
|
|
105
|
+
...exports.defaultConfig.screenshots,
|
|
106
|
+
...config.screenshots,
|
|
107
|
+
},
|
|
108
|
+
zephyr: {
|
|
109
|
+
...exports.defaultConfig.zephyr,
|
|
110
|
+
...config.zephyr,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
return loadedConfig;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get current Zest configuration
|
|
117
|
+
*
|
|
118
|
+
* @returns Current configuration
|
|
119
|
+
*/
|
|
120
|
+
function getZestConfig() {
|
|
121
|
+
return loadedConfig;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Load Zest configuration from file
|
|
125
|
+
* Looks for zest.config.ts in the root directory
|
|
126
|
+
*/
|
|
127
|
+
async function loadZestConfig() {
|
|
128
|
+
try {
|
|
129
|
+
const configPath = process.cwd() + '/zest.config.ts';
|
|
130
|
+
const userConfig = await Promise.resolve(`${configPath}`).then(s => __importStar(require(s)));
|
|
131
|
+
if (userConfig.default) {
|
|
132
|
+
return userConfig.default;
|
|
133
|
+
}
|
|
134
|
+
return loadedConfig;
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
// Config file not found or error loading - use defaults
|
|
138
|
+
return loadedConfig;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
|
2
|
+
export { expect } from '@playwright/test';
|
|
3
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../fixtures/fixtures.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,IAAI,6OAUf,CAAC;AASH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|