@playwright-test-runner/core 1.0.10 → 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/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/dist/web-ui.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PlaywrightWebUI = void 0;
|
|
7
|
-
exports.createWebUI = createWebUI;
|
|
8
|
-
const express_1 = __importDefault(require("express"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const test_runner_1 = require("./test-runner");
|
|
11
|
-
const cors_1 = __importDefault(require("cors"));
|
|
12
|
-
class PlaywrightWebUI {
|
|
13
|
-
app;
|
|
14
|
-
port;
|
|
15
|
-
testRunner;
|
|
16
|
-
reportProcess = null;
|
|
17
|
-
constructor(options = {}) {
|
|
18
|
-
this.app = (0, express_1.default)();
|
|
19
|
-
this.port = options.port || 3001;
|
|
20
|
-
this.testRunner = new test_runner_1.PlaywrightTestRunner({
|
|
21
|
-
projectRoot: options.projectRoot || process.cwd(),
|
|
22
|
-
testsDir: options.testsDir || 'tests',
|
|
23
|
-
});
|
|
24
|
-
this.setupMiddleware();
|
|
25
|
-
this.setupRoutes();
|
|
26
|
-
}
|
|
27
|
-
setupMiddleware() {
|
|
28
|
-
this.app.use((0, cors_1.default)());
|
|
29
|
-
this.app.use(express_1.default.json());
|
|
30
|
-
this.app.use(express_1.default.static(path_1.default.join(__dirname, '../public')));
|
|
31
|
-
}
|
|
32
|
-
setupRoutes() {
|
|
33
|
-
// Serve the HTML UI
|
|
34
|
-
this.app.get('/', (req, res) => {
|
|
35
|
-
res.sendFile(path_1.default.join(__dirname, '../public/index.html'));
|
|
36
|
-
});
|
|
37
|
-
// API endpoints
|
|
38
|
-
this.app.get('/api/health', (req, res) => {
|
|
39
|
-
res.json({ status: 'ok', service: 'playwright-web-ui' });
|
|
40
|
-
});
|
|
41
|
-
this.app.get('/api/tests', async (req, res) => {
|
|
42
|
-
try {
|
|
43
|
-
const files = await this.testRunner.getTestFiles();
|
|
44
|
-
res.json({
|
|
45
|
-
success: true,
|
|
46
|
-
count: files.length,
|
|
47
|
-
files: files.map(f => path_1.default.relative(process.cwd(), f)),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
res.status(500).json({
|
|
52
|
-
success: false,
|
|
53
|
-
error: error.message,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
this.app.post('/api/run', async (req, res) => {
|
|
58
|
-
try {
|
|
59
|
-
const { reporter = 'html', headed = false } = req.body;
|
|
60
|
-
const result = await this.testRunner.runTests({
|
|
61
|
-
reporter,
|
|
62
|
-
headed,
|
|
63
|
-
});
|
|
64
|
-
res.json({
|
|
65
|
-
success: result.success,
|
|
66
|
-
output: result.output,
|
|
67
|
-
error: result.error,
|
|
68
|
-
reportPath: result.reportPath,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
res.status(500).json({
|
|
73
|
-
success: false,
|
|
74
|
-
error: error.message,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
this.app.post('/api/report/show', async (req, res) => {
|
|
79
|
-
try {
|
|
80
|
-
if (this.reportProcess) {
|
|
81
|
-
return res.json({
|
|
82
|
-
success: true,
|
|
83
|
-
message: 'Report già in esecuzione',
|
|
84
|
-
url: 'http://localhost:9323',
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const { url, process } = await this.testRunner.showReport();
|
|
88
|
-
this.reportProcess = process;
|
|
89
|
-
res.json({
|
|
90
|
-
success: true,
|
|
91
|
-
message: 'Report UI avviato',
|
|
92
|
-
url,
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
res.status(500).json({
|
|
97
|
-
success: false,
|
|
98
|
-
error: error.message,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
this.app.post('/api/report/stop', (req, res) => {
|
|
103
|
-
if (this.reportProcess) {
|
|
104
|
-
this.reportProcess.kill();
|
|
105
|
-
this.reportProcess = null;
|
|
106
|
-
res.json({
|
|
107
|
-
success: true,
|
|
108
|
-
message: 'Report UI fermato',
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
res.json({
|
|
113
|
-
success: false,
|
|
114
|
-
message: 'Nessun report in esecuzione',
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
start() {
|
|
120
|
-
this.app.listen(this.port, () => {
|
|
121
|
-
console.log(`\n🎭 Playwright Web UI`);
|
|
122
|
-
console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
|
|
123
|
-
console.log(`\n✨ Apri il browser su: http://localhost:${this.port}`);
|
|
124
|
-
console.log(`\n📁 Progetto: ${process.cwd()}`);
|
|
125
|
-
console.log(`📂 Cartella test: ${this.testRunner['testsDir']}`);
|
|
126
|
-
console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
|
|
127
|
-
console.log(`\nPremi Ctrl+C per fermare il server\n`);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
getApp() {
|
|
131
|
-
return this.app;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.PlaywrightWebUI = PlaywrightWebUI;
|
|
135
|
-
function createWebUI(options = {}) {
|
|
136
|
-
return new PlaywrightWebUI(options);
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=web-ui.js.map
|
package/dist/web-ui.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.js","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":";;;;;;AAiJA,kCAEC;AAnJD,sDAAqD;AACrD,gDAAwB;AACxB,+CAAqD;AACrD,gDAAwB;AAQxB,MAAa,eAAe;IAClB,GAAG,CAAsB;IACzB,IAAI,CAAS;IACb,UAAU,CAAuB;IACjC,aAAa,GAAQ,IAAI,CAAC;IAElC,YAAY,UAAwB,E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iBAAM,CAAC;gBACN,GAAG,CAAC,IAAI,CAAC;oBACP,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,6BAA6B;iBACvC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;YAC9B,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF;AApID,0CAoIC;AAED,SAAgB,WAAW,CAAC,UAAwB,EAAE;IACpD,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
|
package/public/index.html
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="it">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Playwright Test Runner - Web UI</title>
|
|
7
|
-
<style>
|
|
8
|
-
* {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body {
|
|
15
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
16
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
17
|
-
min-height: 100vh;
|
|
18
|
-
padding: 20px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.container {
|
|
22
|
-
max-width: 1200px;
|
|
23
|
-
margin: 0 auto;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.header {
|
|
27
|
-
text-align: center;
|
|
28
|
-
color: white;
|
|
29
|
-
margin-bottom: 40px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.header h1 {
|
|
33
|
-
font-size: 3em;
|
|
34
|
-
margin-bottom: 10px;
|
|
35
|
-
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.header .emoji {
|
|
39
|
-
font-size: 4em;
|
|
40
|
-
margin-bottom: 20px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.header p {
|
|
44
|
-
font-size: 1.2em;
|
|
45
|
-
opacity: 0.9;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.card {
|
|
49
|
-
background: white;
|
|
50
|
-
border-radius: 12px;
|
|
51
|
-
padding: 30px;
|
|
52
|
-
margin-bottom: 20px;
|
|
53
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.card h2 {
|
|
57
|
-
color: #333;
|
|
58
|
-
margin-bottom: 20px;
|
|
59
|
-
font-size: 1.8em;
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
gap: 10px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.info-grid {
|
|
66
|
-
display: grid;
|
|
67
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
68
|
-
gap: 15px;
|
|
69
|
-
margin-bottom: 20px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.info-item {
|
|
73
|
-
background: #f5f5f5;
|
|
74
|
-
padding: 15px;
|
|
75
|
-
border-radius: 8px;
|
|
76
|
-
border-left: 4px solid #667eea;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.info-item strong {
|
|
80
|
-
display: block;
|
|
81
|
-
color: #667eea;
|
|
82
|
-
margin-bottom: 5px;
|
|
83
|
-
font-size: 0.9em;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.info-item span {
|
|
87
|
-
color: #333;
|
|
88
|
-
font-size: 1.1em;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.test-list {
|
|
92
|
-
margin-top: 20px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.test-item {
|
|
96
|
-
background: #f9f9f9;
|
|
97
|
-
padding: 12px 15px;
|
|
98
|
-
margin: 8px 0;
|
|
99
|
-
border-radius: 6px;
|
|
100
|
-
border-left: 3px solid #4CAF50;
|
|
101
|
-
font-family: 'Courier New', monospace;
|
|
102
|
-
font-size: 0.95em;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.controls {
|
|
106
|
-
display: flex;
|
|
107
|
-
gap: 15px;
|
|
108
|
-
flex-wrap: wrap;
|
|
109
|
-
margin-top: 20px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.btn {
|
|
113
|
-
padding: 15px 30px;
|
|
114
|
-
border: none;
|
|
115
|
-
border-radius: 8px;
|
|
116
|
-
font-size: 1em;
|
|
117
|
-
font-weight: 600;
|
|
118
|
-
cursor: pointer;
|
|
119
|
-
transition: all 0.3s ease;
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: center;
|
|
122
|
-
gap: 10px;
|
|
123
|
-
flex: 1;
|
|
124
|
-
min-width: 200px;
|
|
125
|
-
justify-content: center;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.btn:hover {
|
|
129
|
-
transform: translateY(-2px);
|
|
130
|
-
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.btn:active {
|
|
134
|
-
transform: translateY(0);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.btn-primary {
|
|
138
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
139
|
-
color: white;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.btn-success {
|
|
143
|
-
background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
|
|
144
|
-
color: white;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.btn-info {
|
|
148
|
-
background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
|
|
149
|
-
color: white;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.btn-warning {
|
|
153
|
-
background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
|
|
154
|
-
color: white;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.btn:disabled {
|
|
158
|
-
opacity: 0.5;
|
|
159
|
-
cursor: not-allowed;
|
|
160
|
-
transform: none !important;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.output {
|
|
164
|
-
background: #1e1e1e;
|
|
165
|
-
color: #d4d4d4;
|
|
166
|
-
padding: 20px;
|
|
167
|
-
border-radius: 8px;
|
|
168
|
-
font-family: 'Courier New', monospace;
|
|
169
|
-
font-size: 0.9em;
|
|
170
|
-
max-height: 400px;
|
|
171
|
-
overflow-y: auto;
|
|
172
|
-
white-space: pre-wrap;
|
|
173
|
-
word-wrap: break-word;
|
|
174
|
-
margin-top: 20px;
|
|
175
|
-
line-height: 1.5;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.output:empty::before {
|
|
179
|
-
content: 'Output dei test apparirà qui...';
|
|
180
|
-
opacity: 0.5;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.spinner {
|
|
184
|
-
border: 3px solid #f3f3f3;
|
|
185
|
-
border-top: 3px solid #667eea;
|
|
186
|
-
border-radius: 50%;
|
|
187
|
-
width: 20px;
|
|
188
|
-
height: 20px;
|
|
189
|
-
animation: spin 1s linear infinite;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
@keyframes spin {
|
|
193
|
-
0% { transform: rotate(0deg); }
|
|
194
|
-
100% { transform: rotate(360deg); }
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.status {
|
|
198
|
-
padding: 10px 15px;
|
|
199
|
-
border-radius: 6px;
|
|
200
|
-
margin-top: 15px;
|
|
201
|
-
display: none;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.status.success {
|
|
205
|
-
background: #d4edda;
|
|
206
|
-
color: #155724;
|
|
207
|
-
border: 1px solid #c3e6cb;
|
|
208
|
-
display: block;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.status.error {
|
|
212
|
-
background: #f8d7da;
|
|
213
|
-
color: #721c24;
|
|
214
|
-
border: 1px solid #f5c6cb;
|
|
215
|
-
display: block;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.status.info {
|
|
219
|
-
background: #d1ecf1;
|
|
220
|
-
color: #0c5460;
|
|
221
|
-
border: 1px solid #bee5eb;
|
|
222
|
-
display: block;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.badge {
|
|
226
|
-
background: #667eea;
|
|
227
|
-
color: white;
|
|
228
|
-
padding: 4px 12px;
|
|
229
|
-
border-radius: 12px;
|
|
230
|
-
font-size: 0.85em;
|
|
231
|
-
font-weight: 600;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.options {
|
|
235
|
-
display: flex;
|
|
236
|
-
gap: 20px;
|
|
237
|
-
margin-top: 20px;
|
|
238
|
-
flex-wrap: wrap;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.option-group {
|
|
242
|
-
flex: 1;
|
|
243
|
-
min-width: 200px;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.option-group label {
|
|
247
|
-
display: block;
|
|
248
|
-
margin-bottom: 8px;
|
|
249
|
-
color: #555;
|
|
250
|
-
font-weight: 600;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.option-group select {
|
|
254
|
-
width: 100%;
|
|
255
|
-
padding: 10px;
|
|
256
|
-
border: 2px solid #ddd;
|
|
257
|
-
border-radius: 6px;
|
|
258
|
-
font-size: 1em;
|
|
259
|
-
background: white;
|
|
260
|
-
cursor: pointer;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.option-group select:focus {
|
|
264
|
-
outline: none;
|
|
265
|
-
border-color: #667eea;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.checkbox-option {
|
|
269
|
-
display: flex;
|
|
270
|
-
align-items: center;
|
|
271
|
-
gap: 10px;
|
|
272
|
-
margin-top: 25px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.checkbox-option input {
|
|
276
|
-
width: 20px;
|
|
277
|
-
height: 20px;
|
|
278
|
-
cursor: pointer;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.footer {
|
|
282
|
-
text-align: center;
|
|
283
|
-
color: white;
|
|
284
|
-
margin-top: 40px;
|
|
285
|
-
opacity: 0.8;
|
|
286
|
-
}
|
|
287
|
-
</style>
|
|
288
|
-
</head>
|
|
289
|
-
<body>
|
|
290
|
-
<div class="container">
|
|
291
|
-
<div class="header">
|
|
292
|
-
<div class="emoji">🎭</div>
|
|
293
|
-
<h1>Playwright Test Runner</h1>
|
|
294
|
-
<p>Interfaccia Web per eseguire i tuoi test Playwright</p>
|
|
295
|
-
</div>
|
|
296
|
-
|
|
297
|
-
<!-- Project Info Card -->
|
|
298
|
-
<div class="card">
|
|
299
|
-
<h2>📁 Informazioni Progetto</h2>
|
|
300
|
-
<div class="info-grid">
|
|
301
|
-
<div class="info-item">
|
|
302
|
-
<strong>Cartella Progetto</strong>
|
|
303
|
-
<span id="projectPath">Caricamento...</span>
|
|
304
|
-
</div>
|
|
305
|
-
<div class="info-item">
|
|
306
|
-
<strong>Cartella Test</strong>
|
|
307
|
-
<span id="testsDir">Caricamento...</span>
|
|
308
|
-
</div>
|
|
309
|
-
<div class="info-item">
|
|
310
|
-
<strong>Test Trovati</strong>
|
|
311
|
-
<span id="testCount">
|
|
312
|
-
<span class="badge">0</span>
|
|
313
|
-
</span>
|
|
314
|
-
</div>
|
|
315
|
-
</div>
|
|
316
|
-
<button class="btn btn-info" onclick="loadTests()">
|
|
317
|
-
🔄 Ricarica Test
|
|
318
|
-
</button>
|
|
319
|
-
</div>
|
|
320
|
-
|
|
321
|
-
<!-- Test List Card -->
|
|
322
|
-
<div class="card">
|
|
323
|
-
<h2>📋 File di Test</h2>
|
|
324
|
-
<div id="testList" class="test-list">
|
|
325
|
-
<p style="color: #999;">Clicca "Ricarica Test" per vedere i file disponibili</p>
|
|
326
|
-
</div>
|
|
327
|
-
</div>
|
|
328
|
-
|
|
329
|
-
<!-- Run Tests Card -->
|
|
330
|
-
<div class="card">
|
|
331
|
-
<h2>⚡ Esegui Test</h2>
|
|
332
|
-
|
|
333
|
-
<div class="options">
|
|
334
|
-
<div class="option-group">
|
|
335
|
-
<label for="reporter">Reporter:</label>
|
|
336
|
-
<select id="reporter">
|
|
337
|
-
<option value="html" selected>HTML Report (consigliato)</option>
|
|
338
|
-
<option value="json">JSON</option>
|
|
339
|
-
<option value="line">Line</option>
|
|
340
|
-
<option value="list">List</option>
|
|
341
|
-
</select>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<div class="checkbox-option">
|
|
345
|
-
<input type="checkbox" id="headed">
|
|
346
|
-
<label for="headed">Mostra browser durante i test (headed mode)</label>
|
|
347
|
-
</div>
|
|
348
|
-
</div>
|
|
349
|
-
|
|
350
|
-
<div class="controls">
|
|
351
|
-
<button class="btn btn-primary" onclick="runTests()" id="runBtn">
|
|
352
|
-
▶️ Esegui Tutti i Test
|
|
353
|
-
</button>
|
|
354
|
-
<button class="btn btn-success" onclick="showReport()" id="reportBtn">
|
|
355
|
-
📊 Mostra Report UI
|
|
356
|
-
</button>
|
|
357
|
-
<button class="btn btn-warning" onclick="stopReport()" id="stopBtn">
|
|
358
|
-
⏹️ Ferma Report UI
|
|
359
|
-
</button>
|
|
360
|
-
</div>
|
|
361
|
-
|
|
362
|
-
<div id="status" class="status"></div>
|
|
363
|
-
|
|
364
|
-
<div id="output" class="output"></div>
|
|
365
|
-
</div>
|
|
366
|
-
|
|
367
|
-
<div class="footer">
|
|
368
|
-
<p>Powered by Playwright Test Runner Library v1.0.0</p>
|
|
369
|
-
</div>
|
|
370
|
-
</div>
|
|
371
|
-
|
|
372
|
-
<script>
|
|
373
|
-
const API_BASE = '';
|
|
374
|
-
|
|
375
|
-
// Load project info and tests on page load
|
|
376
|
-
window.addEventListener('DOMContentLoaded', () => {
|
|
377
|
-
loadProjectInfo();
|
|
378
|
-
loadTests();
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
async function loadProjectInfo() {
|
|
382
|
-
try {
|
|
383
|
-
const response = await fetch(`${API_BASE}/api/health`);
|
|
384
|
-
const data = await response.json();
|
|
385
|
-
|
|
386
|
-
document.getElementById('projectPath').textContent = window.location.hostname === 'localhost'
|
|
387
|
-
? 'Progetto locale'
|
|
388
|
-
: 'Progetto remoto';
|
|
389
|
-
} catch (error) {
|
|
390
|
-
console.error('Error loading project info:', error);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
async function loadTests() {
|
|
395
|
-
const testList = document.getElementById('testList');
|
|
396
|
-
const testCount = document.getElementById('testCount');
|
|
397
|
-
|
|
398
|
-
testList.innerHTML = '<p style="color: #999;">Caricamento...</p>';
|
|
399
|
-
|
|
400
|
-
try {
|
|
401
|
-
const response = await fetch(`${API_BASE}/api/tests`);
|
|
402
|
-
const data = await response.json();
|
|
403
|
-
|
|
404
|
-
if (data.success) {
|
|
405
|
-
testCount.innerHTML = `<span class="badge">${data.count}</span>`;
|
|
406
|
-
|
|
407
|
-
if (data.files.length === 0) {
|
|
408
|
-
testList.innerHTML = '<p style="color: #999;">Nessun file di test trovato</p>';
|
|
409
|
-
} else {
|
|
410
|
-
testList.innerHTML = data.files
|
|
411
|
-
.map(file => `<div class="test-item">✓ ${file}</div>`)
|
|
412
|
-
.join('');
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
showStatus('Test caricati con successo!', 'success');
|
|
416
|
-
} else {
|
|
417
|
-
testList.innerHTML = `<p style="color: #e74c3c;">Errore: ${data.error}</p>`;
|
|
418
|
-
showStatus(`Errore: ${data.error}`, 'error');
|
|
419
|
-
}
|
|
420
|
-
} catch (error) {
|
|
421
|
-
testList.innerHTML = '<p style="color: #e74c3c;">Errore nel caricamento dei test</p>';
|
|
422
|
-
showStatus('Errore di connessione al server', 'error');
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
async function runTests() {
|
|
427
|
-
const runBtn = document.getElementById('runBtn');
|
|
428
|
-
const output = document.getElementById('output');
|
|
429
|
-
const reporter = document.getElementById('reporter').value;
|
|
430
|
-
const headed = document.getElementById('headed').checked;
|
|
431
|
-
|
|
432
|
-
runBtn.disabled = true;
|
|
433
|
-
runBtn.innerHTML = '<div class="spinner"></div> Test in esecuzione...';
|
|
434
|
-
output.textContent = 'Avvio test Playwright...\n\n';
|
|
435
|
-
|
|
436
|
-
try {
|
|
437
|
-
const response = await fetch(`${API_BASE}/api/run`, {
|
|
438
|
-
method: 'POST',
|
|
439
|
-
headers: {
|
|
440
|
-
'Content-Type': 'application/json',
|
|
441
|
-
},
|
|
442
|
-
body: JSON.stringify({ reporter, headed }),
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
const data = await response.json();
|
|
446
|
-
|
|
447
|
-
if (data.success) {
|
|
448
|
-
output.textContent += '✅ Test completati con successo!\n\n';
|
|
449
|
-
output.textContent += data.output;
|
|
450
|
-
|
|
451
|
-
showStatus(
|
|
452
|
-
`Test completati! ${data.reportPath ? 'Report salvato in: ' + data.reportPath : ''}`,
|
|
453
|
-
'success'
|
|
454
|
-
);
|
|
455
|
-
|
|
456
|
-
if (reporter === 'html') {
|
|
457
|
-
setTimeout(() => {
|
|
458
|
-
if (confirm('Vuoi aprire il report UI?')) {
|
|
459
|
-
showReport();
|
|
460
|
-
}
|
|
461
|
-
}, 1000);
|
|
462
|
-
}
|
|
463
|
-
} else {
|
|
464
|
-
output.textContent += '❌ Test falliti!\n\n';
|
|
465
|
-
if (data.error) {
|
|
466
|
-
output.textContent += 'Errore:\n' + data.error + '\n\n';
|
|
467
|
-
}
|
|
468
|
-
if (data.output) {
|
|
469
|
-
output.textContent += 'Output:\n' + data.output;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
showStatus('Test falliti. Controlla l\'output per i dettagli.', 'error');
|
|
473
|
-
}
|
|
474
|
-
} catch (error) {
|
|
475
|
-
output.textContent += '❌ Errore di connessione!\n\n' + error;
|
|
476
|
-
showStatus('Errore di connessione al server', 'error');
|
|
477
|
-
} finally {
|
|
478
|
-
runBtn.disabled = false;
|
|
479
|
-
runBtn.innerHTML = '▶️ Esegui Tutti i Test';
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async function showReport() {
|
|
484
|
-
const reportBtn = document.getElementById('reportBtn');
|
|
485
|
-
|
|
486
|
-
reportBtn.disabled = true;
|
|
487
|
-
reportBtn.innerHTML = '<div class="spinner"></div> Avvio report...';
|
|
488
|
-
|
|
489
|
-
try {
|
|
490
|
-
const response = await fetch(`${API_BASE}/api/report/show`, {
|
|
491
|
-
method: 'POST',
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
const data = await response.json();
|
|
495
|
-
|
|
496
|
-
if (data.success) {
|
|
497
|
-
showStatus(`Report UI disponibile su: ${data.url}`, 'success');
|
|
498
|
-
|
|
499
|
-
// Apri in una nuova finestra
|
|
500
|
-
window.open(data.url, '_blank');
|
|
501
|
-
} else {
|
|
502
|
-
showStatus(`Errore: ${data.error || data.message}`, 'error');
|
|
503
|
-
}
|
|
504
|
-
} catch (error) {
|
|
505
|
-
showStatus('Errore nell\'avvio del report UI', 'error');
|
|
506
|
-
} finally {
|
|
507
|
-
reportBtn.disabled = false;
|
|
508
|
-
reportBtn.innerHTML = '📊 Mostra Report UI';
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
async function stopReport() {
|
|
513
|
-
const stopBtn = document.getElementById('stopBtn');
|
|
514
|
-
|
|
515
|
-
stopBtn.disabled = true;
|
|
516
|
-
|
|
517
|
-
try {
|
|
518
|
-
const response = await fetch(`${API_BASE}/api/report/stop`, {
|
|
519
|
-
method: 'POST',
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
const data = await response.json();
|
|
523
|
-
showStatus(data.message, data.success ? 'info' : 'error');
|
|
524
|
-
} catch (error) {
|
|
525
|
-
showStatus('Errore nella chiusura del report UI', 'error');
|
|
526
|
-
} finally {
|
|
527
|
-
stopBtn.disabled = false;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
function showStatus(message, type) {
|
|
532
|
-
const status = document.getElementById('status');
|
|
533
|
-
status.textContent = message;
|
|
534
|
-
status.className = 'status ' + type;
|
|
535
|
-
|
|
536
|
-
setTimeout(() => {
|
|
537
|
-
status.className = 'status';
|
|
538
|
-
}, 5000);
|
|
539
|
-
}
|
|
540
|
-
</script>
|
|
541
|
-
</body>
|
|
542
|
-
</html>
|