@playwright-test-runner/core 1.0.11 β†’ 1.0.12

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.
Files changed (2) hide show
  1. package/README.md +54 -413
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,155 +1,83 @@
1
- # Playwright Test Runner Library
1
+ # Playwright Test Runner
2
2
 
3
- > Libreria completa e agnostica per eseguire test Playwright con server Express, UI report e daemon server integrato.
3
+ > Libreria per eseguire test Playwright con ricerca automatica dei test e visualizzazione report.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@playwright-test-runner/core.svg)](https://www.npmjs.com/package/@playwright-test-runner/core)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- ## ✨ Caratteristiche Principali
8
+ ## Caratteristiche
9
9
 
10
- - 🎭 **Playwright Integrato** - Include già Playwright e tutti i browser
11
- - πŸš€ **Daemon Server Automatico** - Report sempre disponibili su porta fissa (9324)
12
- - 🎨 **Web UI Completa** - Interfaccia grafica per gestire i test
13
- - πŸ“Š **Report Interattivi** - Visualizzazione avanzata dei risultati
14
- - πŸ”Œ **REST API** - Controllo completo via HTTP
15
- - πŸ› οΈ **CLI Potenti** - 4 comandi per ogni esigenza
16
- - βš™οΈ **Zero Config** - Funziona subito, nessuna configurazione richiesta
17
- - πŸ”„ **Port Management** - Gestione intelligente delle porte occupate
10
+ - **Playwright Integrato** - Include Playwright, non serve installarlo separatamente
11
+ - **Ricerca Automatica** - Trova automaticamente i file di test nella cartella `tests/`
12
+ - **Report Interattivi** - Visualizzazione automatica dei risultati nel browser
13
+ - **Zero Config** - Funziona subito, nessuna configurazione richiesta
14
+ - **Setup Guidato** - Crea automaticamente la cartella tests se non esiste
18
15
 
19
- ## πŸ“¦ Installazione
16
+ ## Installazione
20
17
 
21
18
  ```bash
22
19
  npm install @playwright-test-runner/core
23
20
  ```
24
21
 
25
- ### Installazione Automatica del Daemon
22
+ ## Comandi Disponibili
26
23
 
27
- Dopo l'installazione, il **daemon server** si avvia automaticamente e serve i report su `http://localhost:9324`!
24
+ | Comando | Descrizione |
25
+ |---------|-------------|
26
+ | `npx playwright-test` | Esegue i test e mostra il report |
27
+ | `npx playwright-report` | Mostra solo il report (senza rieseguire i test) |
28
28
 
29
- ```
30
- ╔════════════════════════════════════════════════════════════╗
31
- β•‘ 🎭 Playwright Test Runner - Post Install β•‘
32
- β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
33
-
34
- βœ… Report Server avviato in background!
35
-
36
- πŸ“Š Report disponibile su:
37
- β†’ http://localhost:9324
38
-
39
- πŸ“‹ Dashboard:
40
- β†’ http://localhost:9324/dashboard
41
- ```
29
+ ## Utilizzo
42
30
 
43
- **Controllo del daemon tramite variabili d'ambiente:**
44
-
45
- ```bash
46
- # Disabilita daemon completamente
47
- PLAYWRIGHT_SKIP_DAEMON=true npm install
48
-
49
- # Daemon non si avvia automaticamente (manuale)
50
- PLAYWRIGHT_DAEMON_AUTO=false npm install
51
-
52
- # Automaticamente disabilitato in produzione
53
- NODE_ENV=production npm install
54
-
55
- # Automaticamente disabilitato in CI/CD
56
- CI=true npm install
57
- ```
58
-
59
- ## πŸš€ Utilizzo Rapido
60
-
61
- ### Metodo 1: Web UI (Interfaccia Grafica) 🎨
62
-
63
- **Il modo piΓΉ semplice - interfaccia web completa:**
64
-
65
- ```bash
66
- npx playwright-ui
67
- ```
68
-
69
- Apri il browser su **http://localhost:3001**
70
-
71
- **FunzionalitΓ :**
72
- - πŸ“‹ Vedere tutti i test disponibili
73
- - ▢️ Eseguire i test con un click
74
- - πŸ“Š Visualizzare il report interattivo
75
- - βš™οΈ Configurare reporter e opzioni
76
-
77
- ### Metodo 2: Daemon Server (Report Persistente) πŸ”„
78
-
79
- Il daemon si avvia automaticamente all'installazione, ma puoi gestirlo manualmente:
80
-
81
- ```bash
82
- # Avvia il daemon (se non Γ¨ giΓ  attivo)
83
- npx playwright-daemon
84
-
85
- # Controlla lo stato
86
- npx playwright-daemon status
87
-
88
- # Ferma il daemon
89
- npx playwright-daemon stop
90
-
91
- # Avvia su porta custom
92
- npx playwright-daemon --port 9000
93
- ```
94
-
95
- **Accesso al daemon:**
96
- - Report: `http://localhost:9324`
97
- - Dashboard: `http://localhost:9324/dashboard`
98
- - Health Check: `http://localhost:9324/health`
99
-
100
- ### Metodo 3: CLI Esegui & Mostra ⚑
101
-
102
- **Esegui test e visualizza report automaticamente:**
31
+ ### Eseguire i test
103
32
 
104
33
  ```bash
105
34
  npx playwright-test
106
35
  ```
107
36
 
108
- **Questo comando:**
109
- 1. βœ… Legge automaticamente i test dalla cartella `tests`
110
- 2. βœ… Esegue tutti i test Playwright
111
- 3. βœ… Apre automaticamente il report UI nel browser
37
+ Questo comando:
38
+ 1. Cerca i file `*.spec.ts` / `*.test.ts` nella cartella `tests/`
39
+ 2. Esegue tutti i test con Playwright
40
+ 3. Apre automaticamente il report nel browser
41
+
42
+ **Se la cartella `tests/` non esiste**, il comando ti chiederΓ  se vuoi crearla automaticamente con un file di test di esempio.
112
43
 
113
- **Opzioni disponibili:**
44
+ ### Visualizzare il report
114
45
 
115
46
  ```bash
116
- npx playwright-test --tests-dir e2e # Usa cartella 'e2e'
117
- npx playwright-test --project /path/to/dir # Specifica root
118
- npx playwright-test --help # Mostra help
47
+ npx playwright-report
119
48
  ```
120
49
 
121
- ### Metodo 4: Server API REST πŸ”Œ
50
+ Apre il report HTML dell'ultima esecuzione su `http://localhost:9323`.
122
51
 
123
- **Avvia server con API REST complete:**
52
+ ### Opzioni
124
53
 
125
54
  ```bash
126
- npx playwright-runner
127
- ```
55
+ # Specifica una cartella test diversa
56
+ npx playwright-test --tests-dir e2e
128
57
 
129
- **Opzioni disponibili:**
58
+ # Specifica la root del progetto
59
+ npx playwright-test --project /path/to/project
130
60
 
131
- ```bash
132
- npx playwright-runner --port 4000 # Usa porta 4000
133
- npx playwright-runner --project /path/to/project # Specifica root
134
- npx playwright-runner --tests-dir e2e # Usa cartella 'e2e'
61
+ # Mostra help
62
+ npx playwright-test --help
135
63
  ```
136
64
 
137
- ## πŸ“ Setup Progetto
65
+ ## Setup Progetto
138
66
 
139
- ### Passo 1: Crea la cartella tests
140
-
141
- **IMPORTANTE:** La libreria include giΓ  Playwright. **NON serve** installare `@playwright/test` o creare `playwright.config.ts`!
67
+ ### Struttura
142
68
 
143
69
  ```
144
70
  your-project/
145
- β”œβ”€β”€ tests/ # ← Crea solo questa cartella!
71
+ β”œβ”€β”€ tests/ # Cartella dei test
146
72
  β”‚ β”œβ”€β”€ example.spec.ts
147
73
  β”‚ β”œβ”€β”€ login.spec.ts
148
- β”‚ └── checkout.spec.ts
149
- └── package.json
74
+ β”‚ └── api/
75
+ β”‚ └── users.test.ts
76
+ β”œβ”€β”€ package.json
77
+ └── playwright-report/ # Generato dopo i test
150
78
  ```
151
79
 
152
- ### Passo 2: Scrivi i tuoi test
80
+ ### Esempio di test
153
81
 
154
82
  File `tests/example.spec.ts`:
155
83
 
@@ -168,88 +96,7 @@ test('get started link', async ({ page }) => {
168
96
  });
169
97
  ```
170
98
 
171
- ## 🎯 Comandi CLI Disponibili
172
-
173
- La libreria fornisce **4 comandi CLI** principali:
174
-
175
- | Comando | Descrizione | Porta |
176
- |---------|-------------|-------|
177
- | `playwright-daemon` | Daemon server persistente per report | 9324 |
178
- | `playwright-ui` | Interfaccia web per gestire test | 3001 |
179
- | `playwright-test` | Esegui test e mostra report | 9323 |
180
- | `playwright-runner` | Server API REST completo | 3000 |
181
-
182
- ## πŸ”Œ API Endpoints
183
-
184
- ### Daemon Server (porta 9324)
185
-
186
- ```bash
187
- # Health check
188
- GET http://localhost:9324/health
189
-
190
- # Dashboard interattiva
191
- GET http://localhost:9324/dashboard
192
-
193
- # Report HTML
194
- GET http://localhost:9324/
195
-
196
- # Esegui test via API
197
- POST http://localhost:9324/api/run
198
- Content-Type: application/json
199
- {
200
- "reporter": "html",
201
- "headed": false
202
- }
203
-
204
- # Lista test disponibili
205
- GET http://localhost:9324/api/tests
206
- ```
207
-
208
- ### API Server (porta 3000)
209
-
210
- ```bash
211
- # Health check
212
- GET http://localhost:3000/health
213
-
214
- # Lista test
215
- GET http://localhost:3000/tests
216
-
217
- # Esegui test
218
- POST http://localhost:3000/run
219
- Content-Type: application/json
220
- {
221
- "reporter": "html",
222
- "headed": false
223
- }
224
-
225
- # Mostra report UI
226
- POST http://localhost:3000/report/show
227
-
228
- # Ferma report UI
229
- POST http://localhost:3000/report/stop
230
- ```
231
-
232
- ## πŸ’» Uso Programmatico
233
-
234
- ### Daemon Server
235
-
236
- ```typescript
237
- import { createDaemon } from '@playwright-test-runner/core';
238
-
239
- const daemon = createDaemon({
240
- port: 9324,
241
- projectRoot: process.cwd(),
242
- testsDir: 'tests',
243
- });
244
-
245
- await daemon.start();
246
- // Daemon attivo su http://localhost:9324
247
-
248
- // Ferma il daemon
249
- daemon.stop();
250
- ```
251
-
252
- ### Test Runner
99
+ ## Uso Programmatico
253
100
 
254
101
  ```typescript
255
102
  import { PlaywrightTestRunner } from '@playwright-test-runner/core';
@@ -269,79 +116,28 @@ const result = await runner.runTests({
269
116
  headed: false
270
117
  });
271
118
 
272
- // Mostra report
273
- const { url } = await runner.showReport();
274
- console.log('Report disponibile su:', url);
119
+ if (result.success) {
120
+ // Mostra report
121
+ const { url } = await runner.showReport();
122
+ console.log('Report disponibile su:', url);
123
+ }
275
124
 
276
125
  // Cleanup
277
126
  runner.stopReportServer();
278
127
  ```
279
128
 
280
- ### API Server
281
-
282
- ```typescript
283
- import { createServer } from '@playwright-test-runner/core';
284
-
285
- const server = createServer({
286
- port: 3000,
287
- projectRoot: process.cwd(),
288
- testsDir: 'tests'
289
- });
290
-
291
- server.start();
292
- // Server attivo su http://localhost:3000
293
- ```
294
-
295
- ## πŸ“‹ Script package.json Consigliati
296
-
297
- Aggiungi questi script al tuo `package.json`:
129
+ ## Script package.json Consigliati
298
130
 
299
131
  ```json
300
132
  {
301
133
  "scripts": {
302
- "test:ui": "playwright-ui",
303
- "test:run": "playwright-test",
304
- "test:daemon": "playwright-daemon",
305
- "test:daemon:stop": "playwright-daemon stop",
306
- "test:daemon:status": "playwright-daemon status",
307
- "test:server": "playwright-runner"
134
+ "test": "playwright-test",
135
+ "test:report": "playwright-report"
308
136
  }
309
137
  }
310
138
  ```
311
139
 
312
- ## πŸ”„ Workflow Completi
313
-
314
- ### Sviluppo Locale
315
-
316
- ```bash
317
- # 1. Installa il package (daemon si avvia automaticamente)
318
- npm install @playwright-test-runner/core
319
-
320
- # 2. Crea i tuoi test nella cartella tests/
321
- mkdir tests
322
- # Aggiungi file .spec.ts
323
-
324
- # 3. Esegui i test
325
- npx playwright-test
326
-
327
- # 4. I report sono automaticamente disponibili su:
328
- # - http://localhost:9324 (daemon - sempre attivo)
329
- # - Oppure il browser si apre automaticamente con il report
330
- ```
331
-
332
- ### Produzione
333
-
334
- ```bash
335
- # Il daemon NON si avvia in produzione
336
- NODE_ENV=production npm install
337
-
338
- # Esegui i test (se necessario)
339
- npx playwright-test
340
-
341
- # Il report sarΓ  in playwright-report/ ma il daemon non sarΓ  attivo
342
- ```
343
-
344
- ### CI/CD (GitHub Actions)
140
+ ## CI/CD (GitHub Actions)
345
141
 
346
142
  ```yaml
347
143
  name: E2E Tests
@@ -358,8 +154,6 @@ jobs:
358
154
 
359
155
  - name: Install
360
156
  run: npm install
361
- env:
362
- CI: true # Daemon automaticamente skippato
363
157
 
364
158
  - name: Install browsers
365
159
  run: npx playwright install --with-deps chromium
@@ -375,164 +169,11 @@ jobs:
375
169
  path: playwright-report/
376
170
  ```
377
171
 
378
- ## πŸ› οΈ Gestione Daemon
379
-
380
- ### Comandi Daemon
381
-
382
- ```bash
383
- # Stato del daemon
384
- npx playwright-daemon status
385
-
386
- # Output:
387
- # βœ… Daemon ATTIVO
388
- # πŸ“Š Informazioni:
389
- # β€’ PID: 12345
390
- # β€’ Porta: 9324
391
- # β€’ Status: ok
392
- # 🌐 URLs:
393
- # β€’ Report: http://localhost:9324
394
- # β€’ Dashboard: http://localhost:9324/dashboard
395
-
396
- # Fermare il daemon
397
- npx playwright-daemon stop
398
-
399
- # Avviare il daemon manualmente
400
- npx playwright-daemon
401
-
402
- # Avvio su porta custom
403
- npx playwright-daemon --port 9000
404
- ```
405
-
406
- ### Troubleshooting Daemon
407
-
408
- ```bash
409
- # Processo zombie sulla porta 9324
410
- lsof -ti:9324 | xargs kill -9
411
-
412
- # Riavvia il daemon
413
- npx playwright-daemon
414
- ```
415
-
416
- ## πŸ“š Guide Complete
417
-
418
- - πŸ“– **[QUICKSTART.md](QUICKSTART.md)** - Guida rapida per iniziare
419
- - πŸ”§ **[SETUP_SEMPLIFICATO.md](SETUP_SEMPLIFICATO.md)** - Setup zero-config
420
- - 🌐 **[WEB_UI_GUIDE.md](WEB_UI_GUIDE.md)** - Guida all'interfaccia Web
421
- - πŸ”„ **[DAEMON_GUIDE.md](DAEMON_GUIDE.md)** - Guida completa al Daemon Server
422
- - πŸ”— **[INTEGRATION.md](INTEGRATION.md)** - Integrazione con framework (React, Vue, Angular)
423
- - πŸ§ͺ **[LOCAL_TESTING_GUIDE.md](LOCAL_TESTING_GUIDE.md)** - Testing locale con npm link
424
- - ❌ **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Risoluzione problemi comuni
425
-
426
- ## 🚨 Troubleshooting Rapido
427
-
428
- ### Errore: "porta 9324 giΓ  in uso"
429
-
430
- ```bash
431
- # Verifica stato daemon
432
- npx playwright-daemon status
433
-
434
- # Se appeso, killalo
435
- lsof -ti:9324 | xargs kill -9
436
-
437
- # Riavvia
438
- npx playwright-daemon
439
- ```
440
-
441
- ### Errore: "cartella tests non trovata"
442
-
443
- ```bash
444
- # Crea la cartella tests
445
- mkdir tests
446
-
447
- # Aggiungi un file di test
448
- echo 'import { test } from "@playwright/test";
449
- test("example", async () => {});' > tests/example.spec.ts
450
- ```
451
-
452
- ### Daemon non si avvia in produzione
453
-
454
- È normale! Il daemon è disabilitato automaticamente in:
455
- - `NODE_ENV=production`
456
- - `CI=true`
457
-
458
- Per forzare l'avvio:
459
- ```bash
460
- PLAYWRIGHT_DAEMON_AUTO=true npm install
461
- ```
462
-
463
- Consulta la [Guida Troubleshooting](TROUBLESHOOTING.md) completa per altri problemi.
464
-
465
- ## πŸ”§ Port Management Avanzato
466
-
467
- La libreria include **gestione intelligente delle porte**:
468
-
469
- 1. **Controllo automatico** - Verifica se la porta Γ¨ giΓ  in uso
470
- 2. **Riutilizzo server esistente** - Se il report Γ¨ giΓ  attivo, lo riutilizza
471
- 3. **Cleanup automatico** - Chiusura pulita all'uscita del processo
472
-
473
- Questo previene l'errore `EADDRINUSE` (porta giΓ  in uso).
474
-
475
- ## πŸ“Š Struttura Progetto
476
-
477
- ```
478
- @playwright-test-runner/core/
479
- β”œβ”€β”€ dist/ # Build TypeScript
480
- β”‚ β”œβ”€β”€ cli.js # CLI per API server
481
- β”‚ β”œβ”€β”€ daemon-cli.js # CLI per daemon
482
- β”‚ β”œβ”€β”€ run-and-show.js # CLI esegui & mostra
483
- β”‚ β”œβ”€β”€ web-cli.js # CLI per Web UI
484
- β”‚ β”œβ”€β”€ server.js # Server API REST
485
- β”‚ β”œβ”€β”€ report-daemon.js # Daemon server
486
- β”‚ β”œβ”€β”€ test-runner.js # Test runner core
487
- β”‚ β”œβ”€β”€ web-ui.js # Web UI server
488
- β”‚ └── index.js # Entry point principale
489
- β”œβ”€β”€ scripts/ # Script di utilitΓ 
490
- β”‚ β”œβ”€β”€ postinstall.js # Post-install auto daemon
491
- β”‚ β”œβ”€β”€ release.js # Script per release npm
492
- β”‚ β”œβ”€β”€ status-daemon.js # Controlla stato daemon
493
- β”‚ └── stop-daemon.js # Ferma daemon
494
- β”œβ”€β”€ public/ # Asset Web UI
495
- β”‚ └── index.html # Interfaccia grafica
496
- β”œβ”€β”€ src/ # Sorgenti TypeScript
497
- β”œβ”€β”€ playwright.config.ts # Config Playwright inclusa
498
- └── package.json
499
- ```
500
-
501
- ## πŸš€ Pubblicazione (per Maintainer)
502
-
503
- La libreria include uno script interattivo per gestire versioning e pubblicazione:
504
-
505
- ```bash
506
- # Esegui lo script di release
507
- npm run release
508
-
509
- # Lo script ti guiderΓ  attraverso:
510
- # 1. Commit automatico modifiche (se presenti)
511
- # 2. Scelta tipo versione (PATCH/MINOR/MAJOR/CUSTOM)
512
- # 3. Aggiornamento automatico versione
513
- # 4. Login npm (con browser)
514
- # 5. Pubblicazione su npm
515
- # 6. Reminder per git push
516
- ```
517
-
518
- ## βœ… Requisiti
172
+ ## Requisiti
519
173
 
520
174
  - **Node.js** >= 18
521
- - **TypeScript** >= 5.0 (per progetti TypeScript)
522
- - **Playwright** - βœ… Incluso nella libreria!
523
-
524
- ## πŸ“ Versione Corrente
525
-
526
- **v1.0.9** - Include daemon server, port management, Web UI e CLI completi
527
-
528
- ## 🀝 Contributing
529
-
530
- Contributi benvenuti! Leggi [CONTRIBUTING.md](CONTRIBUTING.md) per le linee guida.
531
-
532
- ## πŸ“„ License
533
-
534
- MIT Β© Giovanni Cannone
175
+ - **Playwright** - Incluso nella libreria
535
176
 
536
- ---
177
+ ## License
537
178
 
538
- **Made with ❀️ for the Playwright community**
179
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwright-test-runner/core",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Libreria per eseguire test Playwright con ricerca automatica dei test e visualizzazione report",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",