@playwright-test-runner/core 1.0.9 → 1.0.11
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 +406 -171
- package/dist/index.d.ts +1 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -26
- package/dist/index.js.map +1 -1
- package/dist/run-and-show.d.ts.map +1 -1
- package/dist/run-and-show.js +51 -4
- package/dist/run-and-show.js.map +1 -1
- package/dist/show-report.d.ts +3 -0
- package/dist/show-report.d.ts.map +1 -0
- package/dist/show-report.js +65 -0
- package/dist/show-report.js.map +1 -0
- package/package.json +6 -21
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -54
- package/dist/cli.js.map +0 -1
- package/dist/daemon-cli.d.ts +0 -3
- package/dist/daemon-cli.d.ts.map +0 -1
- package/dist/daemon-cli.js +0 -149
- package/dist/daemon-cli.js.map +0 -1
- package/dist/report-daemon.d.ts +0 -26
- package/dist/report-daemon.d.ts.map +0 -1
- package/dist/report-daemon.js +0 -409
- package/dist/report-daemon.js.map +0 -1
- package/dist/server.d.ts +0 -18
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -127
- package/dist/server.js.map +0 -1
- package/dist/web-cli.d.ts +0 -3
- package/dist/web-cli.d.ts.map +0 -1
- package/dist/web-cli.js +0 -64
- package/dist/web-cli.js.map +0 -1
- package/dist/web-ui.d.ts +0 -19
- package/dist/web-ui.d.ts.map +0 -1
- package/dist/web-ui.js +0 -138
- package/dist/web-ui.js.map +0 -1
- package/public/index.html +0 -542
- package/scripts/postinstall.js +0 -144
- package/scripts/release.js +0 -222
- package/scripts/status-daemon.js +0 -104
- package/scripts/stop-daemon.js +0 -46
package/README.md
CHANGED
|
@@ -1,43 +1,64 @@
|
|
|
1
1
|
# Playwright Test Runner Library
|
|
2
2
|
|
|
3
|
-
Libreria agnostica per eseguire test Playwright con server Express
|
|
3
|
+
> Libreria completa e agnostica per eseguire test Playwright con server Express, UI report e daemon server integrato.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@playwright-test-runner/core)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- Lettura automatica dei file `.spec.ts` dalla cartella `tests`
|
|
9
|
-
- Report UI integrato di Playwright
|
|
10
|
-
- Completamente agnostico dal contesto del progetto
|
|
11
|
-
- Facile integrazione in progetti esistenti
|
|
8
|
+
## ✨ Caratteristiche Principali
|
|
12
9
|
|
|
13
|
-
|
|
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
|
|
18
|
+
|
|
19
|
+
## 📦 Installazione
|
|
14
20
|
|
|
15
21
|
```bash
|
|
16
22
|
npm install @playwright-test-runner/core
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
### Installazione Automatica del Daemon
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
Dopo l'installazione, il **daemon server** si avvia automaticamente e serve i report su `http://localhost:9324`!
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
```
|
|
30
|
+
╔════════════════════════════════════════════════════════════╗
|
|
31
|
+
║ 🎭 Playwright Test Runner - Post Install ║
|
|
32
|
+
╚════════════════════════════════════════════════════════════╝
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
✅ Report Server avviato in background!
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
📊 Report disponibile su:
|
|
37
|
+
→ http://localhost:9324
|
|
28
38
|
|
|
39
|
+
📋 Dashboard:
|
|
40
|
+
→ http://localhost:9324/dashboard
|
|
29
41
|
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
|
|
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
|
|
36
57
|
```
|
|
37
58
|
|
|
38
|
-
|
|
59
|
+
## 🚀 Utilizzo Rapido
|
|
39
60
|
|
|
40
|
-
###
|
|
61
|
+
### Metodo 1: Web UI (Interfaccia Grafica) 🎨
|
|
41
62
|
|
|
42
63
|
**Il modo più semplice - interfaccia web completa:**
|
|
43
64
|
|
|
@@ -45,15 +66,38 @@ your-project/
|
|
|
45
66
|
npx playwright-ui
|
|
46
67
|
```
|
|
47
68
|
|
|
48
|
-
|
|
69
|
+
Apri il browser su **http://localhost:3001**
|
|
49
70
|
|
|
50
|
-
|
|
71
|
+
**Funzionalità:**
|
|
51
72
|
- 📋 Vedere tutti i test disponibili
|
|
52
73
|
- ▶️ Eseguire i test con un click
|
|
53
74
|
- 📊 Visualizzare il report interattivo
|
|
54
75
|
- ⚙️ Configurare reporter e opzioni
|
|
55
76
|
|
|
56
|
-
###
|
|
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 ⚡
|
|
57
101
|
|
|
58
102
|
**Esegui test e visualizza report automaticamente:**
|
|
59
103
|
|
|
@@ -61,243 +105,434 @@ Interfaccia grafica che permette di:
|
|
|
61
105
|
npx playwright-test
|
|
62
106
|
```
|
|
63
107
|
|
|
64
|
-
Questo comando
|
|
65
|
-
1. ✅ Legge automaticamente i test dalla cartella `tests`
|
|
108
|
+
**Questo comando:**
|
|
109
|
+
1. ✅ Legge automaticamente i test dalla cartella `tests`
|
|
66
110
|
2. ✅ Esegue tutti i test Playwright
|
|
67
111
|
3. ✅ Apre automaticamente il report UI nel browser
|
|
68
112
|
|
|
69
|
-
Opzioni disponibili
|
|
113
|
+
**Opzioni disponibili:**
|
|
70
114
|
|
|
71
115
|
```bash
|
|
72
|
-
npx playwright-test --tests-dir e2e # Usa cartella 'e2e'
|
|
73
|
-
npx playwright-test --project /path/to/dir # Specifica root
|
|
116
|
+
npx playwright-test --tests-dir e2e # Usa cartella 'e2e'
|
|
117
|
+
npx playwright-test --project /path/to/dir # Specifica root
|
|
74
118
|
npx playwright-test --help # Mostra help
|
|
75
119
|
```
|
|
76
120
|
|
|
77
|
-
### 4
|
|
121
|
+
### Metodo 4: Server API REST 🔌
|
|
78
122
|
|
|
79
|
-
Avvia
|
|
123
|
+
**Avvia server con API REST complete:**
|
|
80
124
|
|
|
81
125
|
```bash
|
|
82
126
|
npx playwright-runner
|
|
83
127
|
```
|
|
84
128
|
|
|
85
|
-
Opzioni disponibili
|
|
129
|
+
**Opzioni disponibili:**
|
|
86
130
|
|
|
87
131
|
```bash
|
|
88
132
|
npx playwright-runner --port 4000 # Usa porta 4000
|
|
89
|
-
npx playwright-runner --project /path/to/project # Specifica root
|
|
90
|
-
npx playwright-runner --tests-dir e2e # Usa cartella 'e2e'
|
|
133
|
+
npx playwright-runner --project /path/to/project # Specifica root
|
|
134
|
+
npx playwright-runner --tests-dir e2e # Usa cartella 'e2e'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 📁 Setup Progetto
|
|
138
|
+
|
|
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`!
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
your-project/
|
|
145
|
+
├── tests/ # ← Crea solo questa cartella!
|
|
146
|
+
│ ├── example.spec.ts
|
|
147
|
+
│ ├── login.spec.ts
|
|
148
|
+
│ └── checkout.spec.ts
|
|
149
|
+
└── package.json
|
|
91
150
|
```
|
|
92
151
|
|
|
93
|
-
###
|
|
152
|
+
### Passo 2: Scrivi i tuoi test
|
|
94
153
|
|
|
95
|
-
|
|
154
|
+
File `tests/example.spec.ts`:
|
|
96
155
|
|
|
97
156
|
```typescript
|
|
98
|
-
import {
|
|
157
|
+
import { test, expect } from '@playwright/test';
|
|
99
158
|
|
|
100
|
-
|
|
101
|
-
|
|
159
|
+
test('homepage has title', async ({ page }) => {
|
|
160
|
+
await page.goto('https://playwright.dev/');
|
|
161
|
+
await expect(page).toHaveTitle(/Playwright/);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('get started link', async ({ page }) => {
|
|
165
|
+
await page.goto('https://playwright.dev/');
|
|
166
|
+
await page.getByRole('link', { name: 'Get started' }).click();
|
|
167
|
+
await expect(page).toHaveURL(/.*intro/);
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
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,
|
|
102
241
|
projectRoot: process.cwd(),
|
|
103
|
-
testsDir: 'tests'
|
|
242
|
+
testsDir: 'tests',
|
|
104
243
|
});
|
|
105
244
|
|
|
106
|
-
|
|
245
|
+
await daemon.start();
|
|
246
|
+
// Daemon attivo su http://localhost:9324
|
|
247
|
+
|
|
248
|
+
// Ferma il daemon
|
|
249
|
+
daemon.stop();
|
|
107
250
|
```
|
|
108
251
|
|
|
109
|
-
###
|
|
252
|
+
### Test Runner
|
|
110
253
|
|
|
111
254
|
```typescript
|
|
112
255
|
import { PlaywrightTestRunner } from '@playwright-test-runner/core';
|
|
113
256
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
257
|
+
const runner = new PlaywrightTestRunner({
|
|
258
|
+
projectRoot: process.cwd(),
|
|
259
|
+
testsDir: 'tests'
|
|
260
|
+
});
|
|
119
261
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
262
|
+
// Ottieni lista dei test
|
|
263
|
+
const testFiles = await runner.getTestFiles();
|
|
264
|
+
console.log('Test trovati:', testFiles);
|
|
123
265
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
266
|
+
// Esegui i test
|
|
267
|
+
const result = await runner.runTests({
|
|
268
|
+
reporter: 'html',
|
|
269
|
+
headed: false
|
|
270
|
+
});
|
|
129
271
|
|
|
130
|
-
|
|
131
|
-
}
|
|
272
|
+
// Mostra report
|
|
273
|
+
const { url } = await runner.showReport();
|
|
274
|
+
console.log('Report disponibile su:', url);
|
|
132
275
|
|
|
133
|
-
|
|
276
|
+
// Cleanup
|
|
277
|
+
runner.stopReportServer();
|
|
134
278
|
```
|
|
135
279
|
|
|
136
|
-
|
|
280
|
+
### API Server
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
import { createServer } from '@playwright-test-runner/core';
|
|
137
284
|
|
|
138
|
-
|
|
285
|
+
const server = createServer({
|
|
286
|
+
port: 3000,
|
|
287
|
+
projectRoot: process.cwd(),
|
|
288
|
+
testsDir: 'tests'
|
|
289
|
+
});
|
|
139
290
|
|
|
140
|
-
|
|
291
|
+
server.start();
|
|
292
|
+
// Server attivo su http://localhost:3000
|
|
293
|
+
```
|
|
141
294
|
|
|
142
|
-
|
|
295
|
+
## 📋 Script package.json Consigliati
|
|
296
|
+
|
|
297
|
+
Aggiungi questi script al tuo `package.json`:
|
|
143
298
|
|
|
144
|
-
**Response:**
|
|
145
299
|
```json
|
|
146
300
|
{
|
|
147
|
-
"
|
|
148
|
-
|
|
301
|
+
"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"
|
|
308
|
+
}
|
|
149
309
|
}
|
|
150
310
|
```
|
|
151
311
|
|
|
152
|
-
|
|
312
|
+
## 🔄 Workflow Completi
|
|
153
313
|
|
|
154
|
-
|
|
314
|
+
### Sviluppo Locale
|
|
155
315
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
|
167
330
|
```
|
|
168
331
|
|
|
169
|
-
###
|
|
332
|
+
### Produzione
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
# Il daemon NON si avvia in produzione
|
|
336
|
+
NODE_ENV=production npm install
|
|
170
337
|
|
|
171
|
-
Esegui i test
|
|
338
|
+
# Esegui i test (se necessario)
|
|
339
|
+
npx playwright-test
|
|
172
340
|
|
|
173
|
-
|
|
174
|
-
```json
|
|
175
|
-
{
|
|
176
|
-
"reporter": "html",
|
|
177
|
-
"headed": false
|
|
178
|
-
}
|
|
341
|
+
# Il report sarà in playwright-report/ ma il daemon non sarà attivo
|
|
179
342
|
```
|
|
180
343
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
344
|
+
### CI/CD (GitHub Actions)
|
|
345
|
+
|
|
346
|
+
```yaml
|
|
347
|
+
name: E2E Tests
|
|
348
|
+
on: [push]
|
|
349
|
+
|
|
350
|
+
jobs:
|
|
351
|
+
test:
|
|
352
|
+
runs-on: ubuntu-latest
|
|
353
|
+
steps:
|
|
354
|
+
- uses: actions/checkout@v3
|
|
355
|
+
- uses: actions/setup-node@v3
|
|
356
|
+
with:
|
|
357
|
+
node-version: 18
|
|
358
|
+
|
|
359
|
+
- name: Install
|
|
360
|
+
run: npm install
|
|
361
|
+
env:
|
|
362
|
+
CI: true # Daemon automaticamente skippato
|
|
363
|
+
|
|
364
|
+
- name: Install browsers
|
|
365
|
+
run: npx playwright install --with-deps chromium
|
|
366
|
+
|
|
367
|
+
- name: Run tests
|
|
368
|
+
run: npx playwright-test
|
|
369
|
+
|
|
370
|
+
- name: Upload report
|
|
371
|
+
if: always()
|
|
372
|
+
uses: actions/upload-artifact@v3
|
|
373
|
+
with:
|
|
374
|
+
name: playwright-report
|
|
375
|
+
path: playwright-report/
|
|
188
376
|
```
|
|
189
377
|
|
|
190
|
-
|
|
378
|
+
## 🛠️ Gestione Daemon
|
|
191
379
|
|
|
192
|
-
|
|
380
|
+
### Comandi Daemon
|
|
193
381
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
|
201
404
|
```
|
|
202
405
|
|
|
203
|
-
###
|
|
406
|
+
### Troubleshooting Daemon
|
|
204
407
|
|
|
205
|
-
|
|
408
|
+
```bash
|
|
409
|
+
# Processo zombie sulla porta 9324
|
|
410
|
+
lsof -ti:9324 | xargs kill -9
|
|
206
411
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
{
|
|
210
|
-
"success": true,
|
|
211
|
-
"message": "Report UI fermato"
|
|
212
|
-
}
|
|
412
|
+
# Riavvia il daemon
|
|
413
|
+
npx playwright-daemon
|
|
213
414
|
```
|
|
214
415
|
|
|
215
|
-
##
|
|
416
|
+
## 📚 Guide Complete
|
|
216
417
|
|
|
217
|
-
|
|
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
|
|
218
425
|
|
|
219
|
-
|
|
220
|
-
import { test, expect } from '@playwright/test';
|
|
426
|
+
## 🚨 Troubleshooting Rapido
|
|
221
427
|
|
|
222
|
-
|
|
223
|
-
await page.goto('https://playwright.dev/');
|
|
224
|
-
await expect(page).toHaveTitle(/Playwright/);
|
|
225
|
-
});
|
|
428
|
+
### Errore: "porta 9324 già in uso"
|
|
226
429
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
232
439
|
```
|
|
233
440
|
|
|
234
|
-
|
|
441
|
+
### Errore: "cartella tests non trovata"
|
|
235
442
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
4. Esegui i test via API: `POST http://localhost:3000/run`
|
|
240
|
-
5. Visualizza il report: `POST http://localhost:3000/report/show`
|
|
241
|
-
6. Apri il browser su `http://localhost:9323` per vedere il report UI
|
|
443
|
+
```bash
|
|
444
|
+
# Crea la cartella tests
|
|
445
|
+
mkdir tests
|
|
242
446
|
|
|
243
|
-
|
|
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`
|
|
244
457
|
|
|
458
|
+
Per forzare l'avvio:
|
|
245
459
|
```bash
|
|
246
|
-
|
|
247
|
-
|
|
460
|
+
PLAYWRIGHT_DAEMON_AUTO=true npm install
|
|
461
|
+
```
|
|
248
462
|
|
|
249
|
-
|
|
250
|
-
curl http://localhost:3000/tests
|
|
463
|
+
Consulta la [Guida Troubleshooting](TROUBLESHOOTING.md) completa per altri problemi.
|
|
251
464
|
|
|
252
|
-
|
|
253
|
-
curl -X POST http://localhost:3000/run \
|
|
254
|
-
-H "Content-Type: application/json" \
|
|
255
|
-
-d '{"reporter":"html","headed":false}'
|
|
465
|
+
## 🔧 Port Management Avanzato
|
|
256
466
|
|
|
257
|
-
|
|
258
|
-
curl -X POST http://localhost:3000/report/show
|
|
467
|
+
La libreria include **gestione intelligente delle porte**:
|
|
259
468
|
|
|
260
|
-
|
|
261
|
-
|
|
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
|
|
262
499
|
```
|
|
263
500
|
|
|
264
|
-
##
|
|
501
|
+
## 🚀 Pubblicazione (per Maintainer)
|
|
265
502
|
|
|
266
|
-
|
|
503
|
+
La libreria include uno script interattivo per gestire versioning e pubblicazione:
|
|
267
504
|
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
|
276
516
|
```
|
|
277
517
|
|
|
278
|
-
##
|
|
518
|
+
## ✅ Requisiti
|
|
519
|
+
|
|
520
|
+
- **Node.js** >= 18
|
|
521
|
+
- **TypeScript** >= 5.0 (per progetti TypeScript)
|
|
522
|
+
- **Playwright** - ✅ Incluso nella libreria!
|
|
279
523
|
|
|
280
|
-
|
|
524
|
+
## 📝 Versione Corrente
|
|
281
525
|
|
|
282
|
-
-
|
|
283
|
-
- ❌ Errore "cartella tests non trovata" → [Soluzione](TROUBLESHOOTING.md#errore-cartella-tests-non-trovata)
|
|
284
|
-
- ❌ Errore "playwright: command not found" → [Soluzione](TROUBLESHOOTING.md#errore-playwright-command-not-found)
|
|
285
|
-
- E molti altri...
|
|
526
|
+
**v1.0.9** - Include daemon server, port management, Web UI e CLI completi
|
|
286
527
|
|
|
287
|
-
##
|
|
528
|
+
## 🤝 Contributing
|
|
288
529
|
|
|
289
|
-
|
|
290
|
-
- 🔧 [SETUP_SEMPLIFICATO.md](SETUP_SEMPLIFICATO.md) - Setup zero-config
|
|
291
|
-
- 🌐 [WEB_UI_GUIDE.md](WEB_UI_GUIDE.md) - Guida all'interfaccia Web
|
|
292
|
-
- 🔗 [INTEGRATION.md](INTEGRATION.md) - Integrazione con framework (React, Vue, Angular, ecc.)
|
|
293
|
-
- 🧪 [LOCAL_TESTING_GUIDE.md](LOCAL_TESTING_GUIDE.md) - Testing locale con npm link
|
|
530
|
+
Contributi benvenuti! Leggi [CONTRIBUTING.md](CONTRIBUTING.md) per le linee guida.
|
|
294
531
|
|
|
295
|
-
##
|
|
532
|
+
## 📄 License
|
|
296
533
|
|
|
297
|
-
|
|
298
|
-
- TypeScript >= 5.0 (per progetti TypeScript)
|
|
299
|
-
- **Playwright è incluso nella libreria** - NON serve installarlo!
|
|
534
|
+
MIT © Giovanni Cannone
|
|
300
535
|
|
|
301
|
-
|
|
536
|
+
---
|
|
302
537
|
|
|
303
|
-
|
|
538
|
+
**Made with ❤️ for the Playwright community**
|