@vizzly-testing/cli 0.20.0 → 0.20.1-beta.1
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/api/client.js +134 -0
- package/dist/api/core.js +341 -0
- package/dist/api/endpoints.js +314 -0
- package/dist/api/index.js +19 -0
- package/dist/auth/client.js +91 -0
- package/dist/auth/core.js +176 -0
- package/dist/auth/index.js +30 -0
- package/dist/auth/operations.js +148 -0
- package/dist/cli.js +178 -3
- package/dist/client/index.js +144 -77
- package/dist/commands/doctor.js +121 -36
- package/dist/commands/finalize.js +49 -18
- package/dist/commands/init.js +13 -18
- package/dist/commands/login.js +49 -55
- package/dist/commands/logout.js +17 -9
- package/dist/commands/project.js +100 -71
- package/dist/commands/run.js +189 -95
- package/dist/commands/status.js +101 -66
- package/dist/commands/tdd-daemon.js +61 -32
- package/dist/commands/tdd.js +104 -98
- package/dist/commands/upload.js +78 -34
- package/dist/commands/whoami.js +44 -42
- package/dist/config/core.js +438 -0
- package/dist/config/index.js +13 -0
- package/dist/config/operations.js +327 -0
- package/dist/index.js +1 -1
- package/dist/project/core.js +295 -0
- package/dist/project/index.js +13 -0
- package/dist/project/operations.js +393 -0
- package/dist/reporter/reporter-bundle.css +1 -1
- package/dist/reporter/reporter-bundle.iife.js +16 -16
- package/dist/screenshot-server/core.js +157 -0
- package/dist/screenshot-server/index.js +11 -0
- package/dist/screenshot-server/operations.js +183 -0
- package/dist/sdk/index.js +3 -2
- package/dist/server/handlers/api-handler.js +14 -5
- package/dist/server/handlers/tdd-handler.js +191 -53
- package/dist/server/http-server.js +9 -3
- package/dist/server/routers/baseline.js +58 -0
- package/dist/server/routers/dashboard.js +10 -6
- package/dist/server/routers/screenshot.js +32 -0
- package/dist/server-manager/core.js +186 -0
- package/dist/server-manager/index.js +81 -0
- package/dist/server-manager/operations.js +209 -0
- package/dist/services/build-manager.js +2 -69
- package/dist/services/index.js +21 -48
- package/dist/services/screenshot-server.js +40 -74
- package/dist/services/server-manager.js +45 -80
- package/dist/services/test-runner.js +90 -250
- package/dist/services/uploader.js +56 -358
- package/dist/tdd/core/hotspot-coverage.js +112 -0
- package/dist/tdd/core/signature.js +101 -0
- package/dist/tdd/index.js +19 -0
- package/dist/tdd/metadata/baseline-metadata.js +103 -0
- package/dist/tdd/metadata/hotspot-metadata.js +93 -0
- package/dist/tdd/services/baseline-downloader.js +151 -0
- package/dist/tdd/services/baseline-manager.js +166 -0
- package/dist/tdd/services/comparison-service.js +230 -0
- package/dist/tdd/services/hotspot-service.js +71 -0
- package/dist/tdd/services/result-service.js +123 -0
- package/dist/tdd/tdd-service.js +1145 -0
- package/dist/test-runner/core.js +255 -0
- package/dist/test-runner/index.js +13 -0
- package/dist/test-runner/operations.js +483 -0
- package/dist/types/client.d.ts +25 -2
- package/dist/uploader/core.js +396 -0
- package/dist/uploader/index.js +11 -0
- package/dist/uploader/operations.js +412 -0
- package/dist/utils/colors.js +187 -39
- package/dist/utils/config-loader.js +3 -6
- package/dist/utils/context.js +228 -0
- package/dist/utils/output.js +449 -14
- package/docs/api-reference.md +173 -8
- package/docs/tui-elements.md +560 -0
- package/package.json +13 -13
- package/dist/services/api-service.js +0 -412
- package/dist/services/auth-service.js +0 -226
- package/dist/services/config-service.js +0 -369
- package/dist/services/html-report-generator.js +0 -455
- package/dist/services/project-service.js +0 -326
- package/dist/services/report-generator/report.css +0 -411
- package/dist/services/report-generator/viewer.js +0 -102
- package/dist/services/static-report-generator.js +0 -207
- package/dist/services/tdd-service.js +0 -1437
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
document.addEventListener('DOMContentLoaded', () => {
|
|
2
|
-
// Handle view mode switching
|
|
3
|
-
document.querySelectorAll('.view-mode-btn').forEach(btn => {
|
|
4
|
-
btn.addEventListener('click', function () {
|
|
5
|
-
const comparison = this.closest('.comparison');
|
|
6
|
-
const mode = this.dataset.mode;
|
|
7
|
-
|
|
8
|
-
// Update active button
|
|
9
|
-
for (let b of comparison.querySelectorAll('.view-mode-btn')) {
|
|
10
|
-
b.classList.remove('active');
|
|
11
|
-
}
|
|
12
|
-
this.classList.add('active');
|
|
13
|
-
|
|
14
|
-
// Update viewer mode
|
|
15
|
-
const viewer = comparison.querySelector('.comparison-viewer');
|
|
16
|
-
viewer.dataset.mode = mode;
|
|
17
|
-
|
|
18
|
-
// Hide all mode containers
|
|
19
|
-
viewer.querySelectorAll('.mode-container').forEach(container => {
|
|
20
|
-
container.style.display = 'none';
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Show appropriate mode container
|
|
24
|
-
const activeContainer = viewer.querySelector(`.${mode}-mode`);
|
|
25
|
-
if (activeContainer) {
|
|
26
|
-
activeContainer.style.display = 'block';
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Handle onion skin drag-to-reveal
|
|
32
|
-
document.querySelectorAll('.onion-container').forEach(container => {
|
|
33
|
-
let isDragging = false;
|
|
34
|
-
function updateOnionSkin(x) {
|
|
35
|
-
const rect = container.getBoundingClientRect();
|
|
36
|
-
const percentage = Math.max(0, Math.min(100, (x - rect.left) / rect.width * 100));
|
|
37
|
-
const currentImg = container.querySelector('.onion-current');
|
|
38
|
-
const divider = container.querySelector('.onion-divider');
|
|
39
|
-
if (currentImg && divider) {
|
|
40
|
-
currentImg.style.clipPath = `inset(0 ${100 - percentage}% 0 0)`;
|
|
41
|
-
divider.style.left = `${percentage}%`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
container.addEventListener('mousedown', e => {
|
|
45
|
-
isDragging = true;
|
|
46
|
-
updateOnionSkin(e.clientX);
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
});
|
|
49
|
-
container.addEventListener('mousemove', e => {
|
|
50
|
-
if (isDragging) {
|
|
51
|
-
updateOnionSkin(e.clientX);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
document.addEventListener('mouseup', () => {
|
|
55
|
-
isDragging = false;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Touch events for mobile
|
|
59
|
-
container.addEventListener('touchstart', e => {
|
|
60
|
-
isDragging = true;
|
|
61
|
-
updateOnionSkin(e.touches[0].clientX);
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
});
|
|
64
|
-
container.addEventListener('touchmove', e => {
|
|
65
|
-
if (isDragging) {
|
|
66
|
-
updateOnionSkin(e.touches[0].clientX);
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
document.addEventListener('touchend', () => {
|
|
71
|
-
isDragging = false;
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Handle overlay mode clicking
|
|
76
|
-
document.querySelectorAll('.overlay-container').forEach(container => {
|
|
77
|
-
container.addEventListener('click', function () {
|
|
78
|
-
const diffImage = this.querySelector('.diff-image');
|
|
79
|
-
if (diffImage) {
|
|
80
|
-
// Toggle diff visibility
|
|
81
|
-
const isVisible = diffImage.style.opacity === '1';
|
|
82
|
-
diffImage.style.opacity = isVisible ? '0' : '1';
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// Handle toggle mode clicking
|
|
88
|
-
document.querySelectorAll('.toggle-container img').forEach(img => {
|
|
89
|
-
let isBaseline = true;
|
|
90
|
-
const comparison = img.closest('.comparison');
|
|
91
|
-
const baselineSrc = comparison.querySelector('.baseline-image').src;
|
|
92
|
-
const currentSrc = comparison.querySelector('.current-image').src;
|
|
93
|
-
img.addEventListener('click', function () {
|
|
94
|
-
isBaseline = !isBaseline;
|
|
95
|
-
this.src = isBaseline ? baselineSrc : currentSrc;
|
|
96
|
-
|
|
97
|
-
// Update cursor style to indicate interactivity
|
|
98
|
-
this.style.cursor = 'pointer';
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
console.log('Vizzly TDD Report loaded successfully');
|
|
102
|
-
});
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static Report Generator using React Reporter
|
|
3
|
-
* Generates a self-contained HTML file with the React dashboard and embedded data
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
7
|
-
import { copyFile, mkdir, writeFile } from 'node:fs/promises';
|
|
8
|
-
import { dirname, join } from 'node:path';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import * as output from '../utils/output.js';
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
const PROJECT_ROOT = join(__dirname, '..', '..');
|
|
14
|
-
export class StaticReportGenerator {
|
|
15
|
-
constructor(workingDir, config) {
|
|
16
|
-
this.workingDir = workingDir;
|
|
17
|
-
this.config = config;
|
|
18
|
-
this.reportDir = join(workingDir, '.vizzly', 'report');
|
|
19
|
-
this.reportPath = join(this.reportDir, 'index.html');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Generate static HTML report with React reporter bundle
|
|
24
|
-
* @param {Object} reportData - Complete report data (same format as live dashboard)
|
|
25
|
-
* @returns {Promise<string>} Path to generated report
|
|
26
|
-
*/
|
|
27
|
-
async generateReport(reportData) {
|
|
28
|
-
if (!reportData || typeof reportData !== 'object') {
|
|
29
|
-
throw new Error('Invalid report data provided');
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
// Ensure report directory exists
|
|
33
|
-
await mkdir(this.reportDir, {
|
|
34
|
-
recursive: true
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Copy React bundles to report directory
|
|
38
|
-
const bundlePath = join(PROJECT_ROOT, 'dist', 'reporter', 'reporter-bundle.iife.js');
|
|
39
|
-
const cssPath = join(PROJECT_ROOT, 'dist', 'reporter', 'reporter-bundle.css');
|
|
40
|
-
if (!existsSync(bundlePath) || !existsSync(cssPath)) {
|
|
41
|
-
throw new Error('Reporter bundles not found. Run "npm run build:reporter" first.');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Copy bundles to report directory for self-contained report
|
|
45
|
-
await copyFile(bundlePath, join(this.reportDir, 'reporter-bundle.js'));
|
|
46
|
-
await copyFile(cssPath, join(this.reportDir, 'reporter-bundle.css'));
|
|
47
|
-
|
|
48
|
-
// Generate HTML with embedded data
|
|
49
|
-
const htmlContent = this.generateHtmlTemplate(reportData);
|
|
50
|
-
await writeFile(this.reportPath, htmlContent, 'utf8');
|
|
51
|
-
output.debug('report', 'generated static report');
|
|
52
|
-
return this.reportPath;
|
|
53
|
-
} catch (error) {
|
|
54
|
-
output.error(`Failed to generate static report: ${error.message}`);
|
|
55
|
-
throw new Error(`Report generation failed: ${error.message}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Generate HTML template with embedded React app
|
|
61
|
-
* @param {Object} reportData - Report data to embed
|
|
62
|
-
* @returns {string} HTML content
|
|
63
|
-
*/
|
|
64
|
-
generateHtmlTemplate(reportData) {
|
|
65
|
-
// Serialize report data safely
|
|
66
|
-
const serializedData = JSON.stringify(reportData).replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026');
|
|
67
|
-
return `<!DOCTYPE html>
|
|
68
|
-
<html lang="en">
|
|
69
|
-
<head>
|
|
70
|
-
<meta charset="UTF-8">
|
|
71
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
72
|
-
<title>Vizzly Dev Report - ${new Date().toLocaleString()}</title>
|
|
73
|
-
<link rel="stylesheet" href="./reporter-bundle.css">
|
|
74
|
-
<style>
|
|
75
|
-
/* Loading spinner styles */
|
|
76
|
-
.reporter-loading {
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
min-height: 100vh;
|
|
81
|
-
background: #0f172a;
|
|
82
|
-
color: #f59e0b;
|
|
83
|
-
}
|
|
84
|
-
.spinner {
|
|
85
|
-
width: 48px;
|
|
86
|
-
height: 48px;
|
|
87
|
-
border: 4px solid rgba(245, 158, 11, 0.2);
|
|
88
|
-
border-top-color: #f59e0b;
|
|
89
|
-
border-radius: 50%;
|
|
90
|
-
animation: spin 1s linear infinite;
|
|
91
|
-
margin-bottom: 1rem;
|
|
92
|
-
}
|
|
93
|
-
@keyframes spin {
|
|
94
|
-
to { transform: rotate(360deg); }
|
|
95
|
-
}
|
|
96
|
-
</style>
|
|
97
|
-
</head>
|
|
98
|
-
<body>
|
|
99
|
-
<div id="vizzly-reporter-root">
|
|
100
|
-
<div class="reporter-loading">
|
|
101
|
-
<div style="text-align: center;">
|
|
102
|
-
<div class="spinner"></div>
|
|
103
|
-
<p>Loading Vizzly Report...</p>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<script>
|
|
109
|
-
// Embedded report data (static mode)
|
|
110
|
-
window.VIZZLY_REPORTER_DATA = ${serializedData};
|
|
111
|
-
window.VIZZLY_STATIC_MODE = true;
|
|
112
|
-
|
|
113
|
-
// Generate timestamp for "generated at" display
|
|
114
|
-
window.VIZZLY_REPORT_GENERATED_AT = "${new Date().toISOString()}";
|
|
115
|
-
|
|
116
|
-
console.log('Vizzly Static Report loaded');
|
|
117
|
-
console.log('Report data:', window.VIZZLY_REPORTER_DATA?.summary);
|
|
118
|
-
</script>
|
|
119
|
-
<script src="./reporter-bundle.js"></script>
|
|
120
|
-
</body>
|
|
121
|
-
</html>`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Generate a minimal HTML report when bundles are missing (fallback)
|
|
126
|
-
* @param {Object} reportData - Report data
|
|
127
|
-
* @returns {string} Minimal HTML content
|
|
128
|
-
*/
|
|
129
|
-
generateFallbackHtml(reportData) {
|
|
130
|
-
const summary = reportData.summary || {};
|
|
131
|
-
const comparisons = reportData.comparisons || [];
|
|
132
|
-
const failed = comparisons.filter(c => c.status === 'failed');
|
|
133
|
-
return `<!DOCTYPE html>
|
|
134
|
-
<html lang="en">
|
|
135
|
-
<head>
|
|
136
|
-
<meta charset="UTF-8">
|
|
137
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
138
|
-
<title>Vizzly Dev Report</title>
|
|
139
|
-
<style>
|
|
140
|
-
body {
|
|
141
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
142
|
-
background: #0f172a;
|
|
143
|
-
color: #e2e8f0;
|
|
144
|
-
padding: 2rem;
|
|
145
|
-
}
|
|
146
|
-
.container { max-width: 1200px; margin: 0 auto; }
|
|
147
|
-
.header { text-align: center; margin-bottom: 2rem; }
|
|
148
|
-
.summary {
|
|
149
|
-
display: flex;
|
|
150
|
-
gap: 2rem;
|
|
151
|
-
justify-content: center;
|
|
152
|
-
margin: 2rem 0;
|
|
153
|
-
}
|
|
154
|
-
.stat { text-align: center; }
|
|
155
|
-
.stat-number {
|
|
156
|
-
font-size: 3rem;
|
|
157
|
-
font-weight: bold;
|
|
158
|
-
display: block;
|
|
159
|
-
}
|
|
160
|
-
.warning {
|
|
161
|
-
background: #fef3c7;
|
|
162
|
-
color: #92400e;
|
|
163
|
-
padding: 1rem;
|
|
164
|
-
border-radius: 0.5rem;
|
|
165
|
-
margin: 2rem 0;
|
|
166
|
-
}
|
|
167
|
-
</style>
|
|
168
|
-
</head>
|
|
169
|
-
<body>
|
|
170
|
-
<div class="container">
|
|
171
|
-
<div class="header">
|
|
172
|
-
<h1>🐻 Vizzly Dev Report</h1>
|
|
173
|
-
<p>Generated: ${new Date().toLocaleString()}</p>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div class="summary">
|
|
177
|
-
<div class="stat">
|
|
178
|
-
<span class="stat-number">${summary.total || 0}</span>
|
|
179
|
-
<span>Total</span>
|
|
180
|
-
</div>
|
|
181
|
-
<div class="stat">
|
|
182
|
-
<span class="stat-number" style="color: #10b981;">${summary.passed || 0}</span>
|
|
183
|
-
<span>Passed</span>
|
|
184
|
-
</div>
|
|
185
|
-
<div class="stat">
|
|
186
|
-
<span class="stat-number" style="color: #ef4444;">${summary.failed || 0}</span>
|
|
187
|
-
<span>Failed</span>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
|
|
191
|
-
<div class="warning">
|
|
192
|
-
<strong>⚠️ Limited Report</strong>
|
|
193
|
-
<p>This is a fallback report. For the full interactive experience, ensure the reporter bundle is built:</p>
|
|
194
|
-
<code>npm run build:reporter</code>
|
|
195
|
-
</div>
|
|
196
|
-
|
|
197
|
-
${failed.length > 0 ? `
|
|
198
|
-
<h2>Failed Comparisons</h2>
|
|
199
|
-
<ul>
|
|
200
|
-
${failed.map(c => `<li>${c.name} - ${c.diffPercentage || 0}% difference</li>`).join('')}
|
|
201
|
-
</ul>
|
|
202
|
-
` : '<p style="text-align: center; font-size: 1.5rem;">✅ All tests passed!</p>'}
|
|
203
|
-
</div>
|
|
204
|
-
</body>
|
|
205
|
-
</html>`;
|
|
206
|
-
}
|
|
207
|
-
}
|