@@ -27,24 +27,35 @@ Writes test results to JSON files on the local filesystem. Useful for local deve
2727
2828** Example:**
2929
30+ Create a reporter file:
31+
3032``` typescript
33+ // reporter.ts
3134import { CoreReporter } from ' @lytics/playwright-reporter' ;
3235import { FilesystemAdapter } from ' @lytics/playwright-adapters/filesystem' ;
3336
37+ class CustomReporter extends CoreReporter {
38+ constructor () {
39+ super ({
40+ adapters: [
41+ new FilesystemAdapter ({
42+ outputDir: ' ./test-results' ,
43+ pretty: true , // default: true
44+ }),
45+ ],
46+ });
47+ }
48+ }
49+
50+ export default CustomReporter ;
51+ ```
52+
53+ Reference it in your config:
54+
55+ ``` typescript
56+ // playwright.config.ts
3457export default {
35- reporter: [
36- [' list' ],
37- [
38- new CoreReporter ({
39- adapters: [
40- new FilesystemAdapter ({
41- outputDir: ' ./test-results' ,
42- pretty: true , // default: true
43- }),
44- ],
45- }),
46- ],
47- ],
58+ reporter: [[' list' ], [' ./reporter.ts' ]],
4859};
4960```
5061
@@ -88,32 +99,32 @@ Sends test results to Slack channels using `@lytics/playwright-slack`. Automatic
8899** Example:**
89100
90101``` typescript
102+ // reporter.ts
91103import { CoreReporter } from ' @lytics/playwright-reporter' ;
92104import { FilesystemAdapter } from ' @lytics/playwright-adapters/filesystem' ;
93105import { SlackAdapter } from ' @lytics/playwright-adapters/slack' ;
94106
95- export default {
96- reporter: [
97- [' list' ],
98- [
99- new CoreReporter ({
100- adapters: [
101- new FilesystemAdapter ({ outputDir: ' ./test-results' }),
102- new SlackAdapter ({
103- webhookUrl: process .env .SLACK_WEBHOOK_URL ,
104- environment: ' Production' ,
105- productionOnly: true , // default: true
106- skipPullRequests: true , // default: true
107- dashboardUrl: ' https://dashboard.example.com' ,
108- ciJobUrl: process .env .CI_JOB_URL ,
109- artifactBaseUrl: process .env .ARTIFACT_BASE_URL ,
110- triggerType: process .env .TRIGGER_TYPE ,
111- }),
112- ],
113- }),
114- ],
115- ],
116- };
107+ class CustomReporter extends CoreReporter {
108+ constructor () {
109+ super ({
110+ adapters: [
111+ new FilesystemAdapter ({ outputDir: ' ./test-results' }),
112+ new SlackAdapter ({
113+ webhookUrl: process .env .SLACK_WEBHOOK_URL ! ,
114+ environment: ' Production' ,
115+ productionOnly: true , // default: true
116+ skipPullRequests: true , // default: true
117+ dashboardUrl: ' https://dashboard.example.com' ,
118+ ciJobUrl: process .env .CI_JOB_URL ,
119+ artifactBaseUrl: process .env .ARTIFACT_BASE_URL ,
120+ triggerType: process .env .TRIGGER_TYPE ,
121+ }),
122+ ],
123+ });
124+ }
125+ }
126+
127+ export default CustomReporter ;
117128```
118129
119130** Configuration:**
@@ -165,33 +176,33 @@ Writes test results to Google Cloud Firestore. Supports automatic retry with exp
165176** Example:**
166177
167178``` typescript
179+ // reporter.ts
168180import { CoreReporter } from ' @lytics/playwright-reporter' ;
169181import { FirestoreAdapter } from ' @lytics/playwright-adapters/firestore' ;
170182
171- export default {
172- reporter: [
173- [' list' ],
174- [
175- new CoreReporter ({
176- adapters: [
177- new FirestoreAdapter ({
178- projectId: ' my-gcp-project' ,
179- credentials: process .env .GOOGLE_APPLICATION_CREDENTIALS_JSON ,
180- // Configure your own collection names to match your Firestore schema
181- collections: {
182- testRuns: ' your_test_runs_collection' ,
183- testCases: ' your_test_cases_collection' ,
184- latestTestCases: ' your_latest_test_cases_collection' ,
185- },
186- skipConditions: {
187- skipPullRequests: true ,
188- },
189- }),
190- ],
191- }),
192- ],
193- ],
194- };
183+ class CustomReporter extends CoreReporter {
184+ constructor () {
185+ super ({
186+ adapters: [
187+ new FirestoreAdapter ({
188+ projectId: ' my-gcp-project' ,
189+ credentials: process .env .GOOGLE_APPLICATION_CREDENTIALS_JSON ,
190+ // Configure your own collection names to match your Firestore schema
191+ collections: {
192+ testRuns: ' your_test_runs_collection' ,
193+ testCases: ' your_test_cases_collection' ,
194+ latestTestCases: ' your_latest_test_cases_collection' ,
195+ },
196+ skipConditions: {
197+ skipPullRequests: true ,
198+ },
199+ }),
200+ ],
201+ });
202+ }
203+ }
204+
205+ export default CustomReporter ;
195206```
196207
197208** Configuration:**
0 commit comments