@vizzly-testing/cli 0.3.1 → 0.4.0
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 +26 -28
- package/dist/cli.js +18 -30
- package/dist/client/index.js +1 -1
- package/dist/commands/run.js +34 -9
- package/dist/commands/tdd.js +6 -1
- package/dist/commands/upload.js +52 -3
- package/dist/server/handlers/api-handler.js +83 -0
- package/dist/server/handlers/tdd-handler.js +138 -0
- package/dist/server/http-server.js +132 -0
- package/dist/services/api-service.js +40 -11
- package/dist/services/server-manager.js +45 -29
- package/dist/services/test-runner.js +64 -69
- package/dist/services/uploader.js +47 -82
- package/dist/types/commands/run.d.ts +4 -1
- package/dist/types/commands/tdd.d.ts +4 -1
- package/dist/types/sdk/index.d.ts +6 -6
- package/dist/types/server/handlers/api-handler.d.ts +49 -0
- package/dist/types/server/handlers/tdd-handler.d.ts +85 -0
- package/dist/types/server/http-server.d.ts +5 -0
- package/dist/types/services/api-service.d.ts +4 -2
- package/dist/types/services/server-manager.d.ts +148 -3
- package/dist/types/services/test-runner.d.ts +1 -0
- package/dist/types/utils/config-helpers.d.ts +1 -1
- package/dist/types/utils/console-ui.d.ts +1 -1
- package/dist/utils/console-ui.js +4 -14
- package/docs/api-reference.md +2 -5
- package/docs/getting-started.md +1 -1
- package/docs/tdd-mode.md +9 -9
- package/docs/test-integration.md +3 -17
- package/docs/upload-command.md +7 -0
- package/package.json +1 -1
- package/dist/screenshot-wrapper.js +0 -68
- package/dist/server/index.js +0 -522
- package/dist/services/service-utils.js +0 -171
- package/dist/types/index.js +0 -153
- package/dist/types/screenshot-wrapper.d.ts +0 -27
- package/dist/types/server/index.d.ts +0 -38
- package/dist/types/services/service-utils.d.ts +0 -45
- package/dist/types/types/index.d.ts +0 -373
- package/dist/types/utils/diagnostics.d.ts +0 -69
- package/dist/types/utils/error-messages.d.ts +0 -42
- package/dist/types/utils/framework-detector.d.ts +0 -5
- package/dist/types/utils/help.d.ts +0 -11
- package/dist/types/utils/image-comparison.d.ts +0 -42
- package/dist/types/utils/package.d.ts +0 -1
- package/dist/types/utils/project-detection.d.ts +0 -19
- package/dist/types/utils/ui-helpers.d.ts +0 -23
- package/dist/utils/diagnostics.js +0 -184
- package/dist/utils/error-messages.js +0 -34
- package/dist/utils/framework-detector.js +0 -40
- package/dist/utils/help.js +0 -66
- package/dist/utils/image-comparison.js +0 -172
- package/dist/utils/package.js +0 -9
- package/dist/utils/project-detection.js +0 -145
- package/dist/utils/ui-helpers.js +0 -86
|
@@ -11,7 +11,7 @@ import { createUploaderLogger } from '../utils/logger-factory.js';
|
|
|
11
11
|
import { ApiService } from './api-service.js';
|
|
12
12
|
import { getDefaultBranch } from '../utils/git.js';
|
|
13
13
|
import { UploadError, TimeoutError, ValidationError } from '../errors/vizzly-error.js';
|
|
14
|
-
const DEFAULT_BATCH_SIZE =
|
|
14
|
+
const DEFAULT_BATCH_SIZE = 50;
|
|
15
15
|
const DEFAULT_SHA_CHECK_BATCH_SIZE = 100;
|
|
16
16
|
const DEFAULT_TIMEOUT = 30000; // 30 seconds
|
|
17
17
|
|
|
@@ -80,51 +80,64 @@ export function createUploader({
|
|
|
80
80
|
}
|
|
81
81
|
onProgress({
|
|
82
82
|
phase: 'scanning',
|
|
83
|
+
message: `Found ${files.length} screenshots`,
|
|
83
84
|
total: files.length
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
// Process files to get metadata
|
|
87
88
|
const fileMetadata = await processFiles(files, signal, current => onProgress({
|
|
88
89
|
phase: 'processing',
|
|
90
|
+
message: `Processing files`,
|
|
89
91
|
current,
|
|
90
92
|
total: files.length
|
|
91
93
|
}));
|
|
92
94
|
|
|
93
|
-
//
|
|
95
|
+
// Create build first to get buildId for SHA checking
|
|
96
|
+
const buildInfo = {
|
|
97
|
+
name: buildName || `Upload ${new Date().toISOString()}`,
|
|
98
|
+
branch: branch || (await getDefaultBranch()) || 'main',
|
|
99
|
+
commitSha: commit,
|
|
100
|
+
commitMessage: message,
|
|
101
|
+
environment,
|
|
102
|
+
threshold
|
|
103
|
+
};
|
|
104
|
+
const build = await api.createBuild(buildInfo);
|
|
105
|
+
const buildId = build.id;
|
|
106
|
+
|
|
107
|
+
// Check which files need uploading (now with buildId)
|
|
94
108
|
const {
|
|
95
109
|
toUpload,
|
|
96
|
-
existing
|
|
97
|
-
|
|
110
|
+
existing,
|
|
111
|
+
screenshots
|
|
112
|
+
} = await checkExistingFiles(fileMetadata, api, signal, buildId);
|
|
98
113
|
onProgress({
|
|
99
114
|
phase: 'deduplication',
|
|
115
|
+
message: `Checking for duplicates (${toUpload.length} to upload, ${existing.length} existing)`,
|
|
100
116
|
toUpload: toUpload.length,
|
|
101
117
|
existing: existing.length,
|
|
102
118
|
total: files.length
|
|
103
119
|
});
|
|
104
120
|
|
|
105
|
-
//
|
|
121
|
+
// Upload remaining files
|
|
106
122
|
const result = await uploadFiles({
|
|
107
123
|
toUpload,
|
|
108
124
|
existing,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
commitSha: commit,
|
|
113
|
-
commitMessage: message,
|
|
114
|
-
environment,
|
|
115
|
-
threshold
|
|
116
|
-
},
|
|
125
|
+
screenshots,
|
|
126
|
+
buildId,
|
|
127
|
+
buildInfo,
|
|
117
128
|
api,
|
|
118
129
|
signal,
|
|
119
130
|
batchSize: batchSize,
|
|
120
131
|
onProgress: current => onProgress({
|
|
121
132
|
phase: 'uploading',
|
|
133
|
+
message: `Uploading screenshots`,
|
|
122
134
|
current,
|
|
123
135
|
total: toUpload.length
|
|
124
136
|
})
|
|
125
137
|
});
|
|
126
138
|
onProgress({
|
|
127
139
|
phase: 'completed',
|
|
140
|
+
message: `Upload completed`,
|
|
128
141
|
buildId: result.buildId,
|
|
129
142
|
url: result.url
|
|
130
143
|
});
|
|
@@ -260,9 +273,10 @@ async function processFiles(files, signal, onProgress) {
|
|
|
260
273
|
/**
|
|
261
274
|
* Check which files already exist on the server
|
|
262
275
|
*/
|
|
263
|
-
async function checkExistingFiles(fileMetadata, api, signal) {
|
|
276
|
+
async function checkExistingFiles(fileMetadata, api, signal, buildId) {
|
|
264
277
|
const allShas = fileMetadata.map(f => f.sha256);
|
|
265
278
|
const existingShas = new Set();
|
|
279
|
+
const allScreenshots = [];
|
|
266
280
|
|
|
267
281
|
// Check in batches
|
|
268
282
|
for (let i = 0; i < allShas.length; i += DEFAULT_SHA_CHECK_BATCH_SIZE) {
|
|
@@ -275,14 +289,17 @@ async function checkExistingFiles(fileMetadata, api, signal) {
|
|
|
275
289
|
'Content-Type': 'application/json'
|
|
276
290
|
},
|
|
277
291
|
body: JSON.stringify({
|
|
278
|
-
shas: batch
|
|
292
|
+
shas: batch,
|
|
293
|
+
buildId
|
|
279
294
|
}),
|
|
280
295
|
signal
|
|
281
296
|
});
|
|
282
297
|
const {
|
|
283
|
-
existing = []
|
|
298
|
+
existing = [],
|
|
299
|
+
screenshots = []
|
|
284
300
|
} = res || {};
|
|
285
301
|
existing.forEach(sha => existingShas.add(sha));
|
|
302
|
+
allScreenshots.push(...screenshots);
|
|
286
303
|
} catch (error) {
|
|
287
304
|
// Continue without deduplication on error
|
|
288
305
|
console.debug('SHA check failed, continuing without deduplication:', error.message);
|
|
@@ -290,7 +307,8 @@ async function checkExistingFiles(fileMetadata, api, signal) {
|
|
|
290
307
|
}
|
|
291
308
|
return {
|
|
292
309
|
toUpload: fileMetadata.filter(f => !existingShas.has(f.sha256)),
|
|
293
|
-
existing: fileMetadata.filter(f => existingShas.has(f.sha256))
|
|
310
|
+
existing: fileMetadata.filter(f => existingShas.has(f.sha256)),
|
|
311
|
+
screenshots: allScreenshots
|
|
294
312
|
};
|
|
295
313
|
}
|
|
296
314
|
|
|
@@ -299,49 +317,30 @@ async function checkExistingFiles(fileMetadata, api, signal) {
|
|
|
299
317
|
*/
|
|
300
318
|
async function uploadFiles({
|
|
301
319
|
toUpload,
|
|
302
|
-
|
|
303
|
-
buildInfo,
|
|
320
|
+
buildId,
|
|
304
321
|
api,
|
|
305
322
|
signal,
|
|
306
323
|
batchSize,
|
|
307
324
|
onProgress
|
|
308
325
|
}) {
|
|
309
|
-
let buildId = null;
|
|
310
326
|
let result = null;
|
|
311
327
|
|
|
312
|
-
// If all files exist,
|
|
328
|
+
// If all files exist, screenshot records were already created during SHA check
|
|
313
329
|
if (toUpload.length === 0) {
|
|
314
|
-
return
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
signal
|
|
319
|
-
});
|
|
330
|
+
return {
|
|
331
|
+
buildId,
|
|
332
|
+
url: null
|
|
333
|
+
}; // Build was already created
|
|
320
334
|
}
|
|
321
335
|
|
|
322
336
|
// Upload in batches
|
|
323
337
|
for (let i = 0; i < toUpload.length; i += batchSize) {
|
|
324
338
|
if (signal.aborted) throw new UploadError('Operation cancelled');
|
|
325
339
|
const batch = toUpload.slice(i, i + batchSize);
|
|
326
|
-
const isFirstBatch = i === 0;
|
|
327
340
|
const form = new FormData();
|
|
328
|
-
if (isFirstBatch) {
|
|
329
|
-
// First batch creates the build
|
|
330
|
-
form.append('build_name', buildInfo.name);
|
|
331
|
-
form.append('branch', buildInfo.branch);
|
|
332
|
-
form.append('environment', buildInfo.environment);
|
|
333
|
-
if (buildInfo.commitSha) form.append('commit_sha', buildInfo.commitSha);
|
|
334
|
-
if (buildInfo.commitMessage) form.append('commit_message', buildInfo.commitMessage);
|
|
335
|
-
if (buildInfo.threshold !== undefined) form.append('threshold', buildInfo.threshold.toString());
|
|
336
341
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
form.append('existing_shas', JSON.stringify(existing.map(f => f.sha256)));
|
|
340
|
-
}
|
|
341
|
-
} else {
|
|
342
|
-
// Subsequent batches add to existing build
|
|
343
|
-
form.append('build_id', buildId);
|
|
344
|
-
}
|
|
342
|
+
// All batches add to existing build (build was created earlier)
|
|
343
|
+
form.append('build_id', buildId);
|
|
345
344
|
|
|
346
345
|
// Add files
|
|
347
346
|
for (const file of batch) {
|
|
@@ -362,50 +361,16 @@ async function uploadFiles({
|
|
|
362
361
|
batch: i / batchSize + 1
|
|
363
362
|
});
|
|
364
363
|
}
|
|
365
|
-
if (isFirstBatch && result.build?.id) {
|
|
366
|
-
buildId = result.build.id;
|
|
367
|
-
}
|
|
368
364
|
onProgress(i + batch.length);
|
|
369
365
|
}
|
|
370
366
|
return {
|
|
371
|
-
buildId
|
|
372
|
-
url: result
|
|
367
|
+
buildId,
|
|
368
|
+
url: result?.build?.url || result?.url
|
|
373
369
|
};
|
|
374
370
|
}
|
|
375
371
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
*/
|
|
379
|
-
async function createBuildWithExisting({
|
|
380
|
-
existing,
|
|
381
|
-
buildInfo,
|
|
382
|
-
api,
|
|
383
|
-
signal
|
|
384
|
-
}) {
|
|
385
|
-
const form = new FormData();
|
|
386
|
-
form.append('build_name', buildInfo.name);
|
|
387
|
-
form.append('branch', buildInfo.branch);
|
|
388
|
-
form.append('environment', buildInfo.environment);
|
|
389
|
-
form.append('existing_shas', JSON.stringify(existing.map(f => f.sha256)));
|
|
390
|
-
if (buildInfo.commitSha) form.append('commit_sha', buildInfo.commitSha);
|
|
391
|
-
if (buildInfo.commitMessage) form.append('commit_message', buildInfo.commitMessage);
|
|
392
|
-
if (buildInfo.threshold !== undefined) form.append('threshold', buildInfo.threshold.toString());
|
|
393
|
-
let result;
|
|
394
|
-
try {
|
|
395
|
-
result = await api.request('/api/sdk/upload', {
|
|
396
|
-
method: 'POST',
|
|
397
|
-
body: form,
|
|
398
|
-
signal,
|
|
399
|
-
headers: {}
|
|
400
|
-
});
|
|
401
|
-
} catch (err) {
|
|
402
|
-
throw new UploadError(`Failed to create build: ${err.message}`);
|
|
403
|
-
}
|
|
404
|
-
return {
|
|
405
|
-
buildId: result.build?.id,
|
|
406
|
-
url: result.build?.url || result.url
|
|
407
|
-
};
|
|
408
|
-
}
|
|
372
|
+
// createBuildWithExisting function removed - no longer needed since
|
|
373
|
+
// builds are created first and /check-shas automatically creates screenshot records
|
|
409
374
|
|
|
410
375
|
/**
|
|
411
376
|
* Uploader class for handling screenshot uploads
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* @param {Object} options - Command options
|
|
5
5
|
* @param {Object} globalOptions - Global CLI options
|
|
6
6
|
*/
|
|
7
|
-
export function runCommand(testCommand: string, options?: any, globalOptions?: any): Promise<
|
|
7
|
+
export function runCommand(testCommand: string, options?: any, globalOptions?: any): Promise<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
exitCode: number;
|
|
10
|
+
}>;
|
|
8
11
|
/**
|
|
9
12
|
* Validate run options
|
|
10
13
|
* @param {string} testCommand - Test command to execute
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
* @param {Object} options - Command options
|
|
5
5
|
* @param {Object} globalOptions - Global CLI options
|
|
6
6
|
*/
|
|
7
|
-
export function tddCommand(testCommand: string, options?: any, globalOptions?: any): Promise<
|
|
7
|
+
export function tddCommand(testCommand: string, options?: any, globalOptions?: any): Promise<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
exitCode: number;
|
|
10
|
+
}>;
|
|
8
11
|
/**
|
|
9
12
|
* Validate TDD options
|
|
10
13
|
* @param {string} testCommand - Test command to execute
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* // Cleanup
|
|
32
32
|
* await vizzly.stop();
|
|
33
33
|
*/
|
|
34
|
-
export function createVizzly(config?:
|
|
34
|
+
export function createVizzly(config?: any, options?: {}): Promise<VizzlySDK>;
|
|
35
35
|
/**
|
|
36
36
|
* @typedef {Object} VizzlySDK
|
|
37
37
|
* @property {Function} start - Start the Vizzly server
|
|
@@ -54,8 +54,8 @@ export class VizzlySDK extends EventEmitter<[never]> {
|
|
|
54
54
|
* @param {import('../utils/logger').Logger} logger - Logger instance
|
|
55
55
|
* @param {Object} services - Service instances
|
|
56
56
|
*/
|
|
57
|
-
constructor(config:
|
|
58
|
-
config:
|
|
57
|
+
constructor(config: any, logger: import("../utils/logger").Logger, services: any);
|
|
58
|
+
config: any;
|
|
59
59
|
logger: import("../utils/logger.js").Logger;
|
|
60
60
|
services: any;
|
|
61
61
|
server: ScreenshotServer;
|
|
@@ -85,20 +85,20 @@ export class VizzlySDK extends EventEmitter<[never]> {
|
|
|
85
85
|
* @param {import('../types').ScreenshotOptions} [options] - Options
|
|
86
86
|
* @returns {Promise<void>}
|
|
87
87
|
*/
|
|
88
|
-
screenshot(name: string, imageBuffer: Buffer, options?:
|
|
88
|
+
screenshot(name: string, imageBuffer: Buffer, options?: any): Promise<void>;
|
|
89
89
|
/**
|
|
90
90
|
* Upload all captured screenshots
|
|
91
91
|
* @param {import('../types').UploadOptions} [options] - Upload options
|
|
92
92
|
* @returns {Promise<import('../types').UploadResult>} Upload result
|
|
93
93
|
*/
|
|
94
|
-
upload(options?:
|
|
94
|
+
upload(options?: any): Promise<any>;
|
|
95
95
|
/**
|
|
96
96
|
* Run local comparison in TDD mode
|
|
97
97
|
* @param {string} name - Screenshot name
|
|
98
98
|
* @param {Buffer} imageBuffer - Current image
|
|
99
99
|
* @returns {Promise<import('../types').ComparisonResult>} Comparison result
|
|
100
100
|
*/
|
|
101
|
-
compare(name: string, imageBuffer: Buffer): Promise<
|
|
101
|
+
compare(name: string, imageBuffer: Buffer): Promise<any>;
|
|
102
102
|
}
|
|
103
103
|
export { loadConfig } from "../utils/config-loader.js";
|
|
104
104
|
export { createLogger } from "../utils/logger.js";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function createApiHandler(apiService: any): {
|
|
2
|
+
handleScreenshot: (buildId: any, name: any, image: any, properties?: {}) => Promise<{
|
|
3
|
+
statusCode: number;
|
|
4
|
+
body: {
|
|
5
|
+
success: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
count: number;
|
|
8
|
+
message: string;
|
|
9
|
+
error?: undefined;
|
|
10
|
+
name?: undefined;
|
|
11
|
+
skipped?: undefined;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
statusCode: number;
|
|
15
|
+
body: {
|
|
16
|
+
error: string;
|
|
17
|
+
success?: undefined;
|
|
18
|
+
disabled?: undefined;
|
|
19
|
+
count?: undefined;
|
|
20
|
+
message?: undefined;
|
|
21
|
+
name?: undefined;
|
|
22
|
+
skipped?: undefined;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
statusCode: number;
|
|
26
|
+
body: {
|
|
27
|
+
success: boolean;
|
|
28
|
+
name: any;
|
|
29
|
+
skipped: any;
|
|
30
|
+
count: number;
|
|
31
|
+
disabled?: undefined;
|
|
32
|
+
message?: undefined;
|
|
33
|
+
error?: undefined;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
statusCode: number;
|
|
37
|
+
body: {
|
|
38
|
+
success: boolean;
|
|
39
|
+
name: any;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
message: string;
|
|
42
|
+
count?: undefined;
|
|
43
|
+
error?: undefined;
|
|
44
|
+
skipped?: undefined;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
getScreenshotCount: () => number;
|
|
48
|
+
cleanup: () => void;
|
|
49
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export function createTddHandler(config: any, workingDir: any, baselineBuild: any, baselineComparison: any): {
|
|
2
|
+
initialize: () => Promise<void>;
|
|
3
|
+
registerBuild: (buildId: any) => void;
|
|
4
|
+
handleScreenshot: (buildId: any, name: any, image: any, properties?: {}) => Promise<{
|
|
5
|
+
statusCode: number;
|
|
6
|
+
body: {
|
|
7
|
+
error: string;
|
|
8
|
+
details: string;
|
|
9
|
+
comparison: {
|
|
10
|
+
name: any;
|
|
11
|
+
status: string;
|
|
12
|
+
baseline: any;
|
|
13
|
+
current: any;
|
|
14
|
+
diff: any;
|
|
15
|
+
};
|
|
16
|
+
tddMode: boolean;
|
|
17
|
+
status?: undefined;
|
|
18
|
+
message?: undefined;
|
|
19
|
+
success?: undefined;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
statusCode: number;
|
|
23
|
+
body: {
|
|
24
|
+
status: string;
|
|
25
|
+
message: string;
|
|
26
|
+
comparison: {
|
|
27
|
+
name: any;
|
|
28
|
+
status: string;
|
|
29
|
+
baseline: any;
|
|
30
|
+
current: any;
|
|
31
|
+
diff?: undefined;
|
|
32
|
+
};
|
|
33
|
+
tddMode: boolean;
|
|
34
|
+
error?: undefined;
|
|
35
|
+
details?: undefined;
|
|
36
|
+
success?: undefined;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
statusCode: number;
|
|
40
|
+
body: {
|
|
41
|
+
error: string;
|
|
42
|
+
tddMode: boolean;
|
|
43
|
+
details?: undefined;
|
|
44
|
+
comparison?: undefined;
|
|
45
|
+
status?: undefined;
|
|
46
|
+
message?: undefined;
|
|
47
|
+
success?: undefined;
|
|
48
|
+
};
|
|
49
|
+
} | {
|
|
50
|
+
statusCode: number;
|
|
51
|
+
body: {
|
|
52
|
+
success: boolean;
|
|
53
|
+
comparison: {
|
|
54
|
+
name: any;
|
|
55
|
+
status: string;
|
|
56
|
+
baseline?: undefined;
|
|
57
|
+
current?: undefined;
|
|
58
|
+
diff?: undefined;
|
|
59
|
+
};
|
|
60
|
+
tddMode: boolean;
|
|
61
|
+
error?: undefined;
|
|
62
|
+
details?: undefined;
|
|
63
|
+
status?: undefined;
|
|
64
|
+
message?: undefined;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
getScreenshotCount: (buildId: any) => any;
|
|
68
|
+
finishBuild: (buildId: any) => Promise<{
|
|
69
|
+
id: any;
|
|
70
|
+
name: any;
|
|
71
|
+
tddMode: boolean;
|
|
72
|
+
results: {
|
|
73
|
+
total: number;
|
|
74
|
+
passed: number;
|
|
75
|
+
failed: number;
|
|
76
|
+
new: number;
|
|
77
|
+
errors: number;
|
|
78
|
+
comparisons: any[];
|
|
79
|
+
baseline: any;
|
|
80
|
+
};
|
|
81
|
+
url: any;
|
|
82
|
+
passed: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
cleanup: () => void;
|
|
85
|
+
};
|
|
@@ -5,6 +5,7 @@ export class ApiService {
|
|
|
5
5
|
constructor(options?: {});
|
|
6
6
|
baseUrl: any;
|
|
7
7
|
token: any;
|
|
8
|
+
uploadAll: any;
|
|
8
9
|
userAgent: string;
|
|
9
10
|
/**
|
|
10
11
|
* Make an API request
|
|
@@ -41,9 +42,10 @@ export class ApiService {
|
|
|
41
42
|
/**
|
|
42
43
|
* Check if SHAs already exist on the server
|
|
43
44
|
* @param {string[]} shas - Array of SHA256 hashes to check
|
|
44
|
-
* @
|
|
45
|
+
* @param {string} buildId - Build ID for screenshot record creation
|
|
46
|
+
* @returns {Promise<Object>} Response with existing SHAs and screenshot data
|
|
45
47
|
*/
|
|
46
|
-
checkShas(shas: string[]): Promise<
|
|
48
|
+
checkShas(shas: string[], buildId: string): Promise<any>;
|
|
47
49
|
/**
|
|
48
50
|
* Upload a screenshot with SHA checking
|
|
49
51
|
* @param {string} buildId - Build ID
|
|
@@ -1,8 +1,153 @@
|
|
|
1
1
|
export class ServerManager extends BaseService {
|
|
2
2
|
constructor(config: any, logger: any);
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
httpServer: {
|
|
4
|
+
start: () => Promise<any>;
|
|
5
|
+
stop: () => Promise<any>;
|
|
6
|
+
getServer: () => any;
|
|
7
|
+
};
|
|
8
|
+
handler: {
|
|
9
|
+
initialize: () => Promise<void>;
|
|
10
|
+
registerBuild: (buildId: any) => void;
|
|
11
|
+
handleScreenshot: (buildId: any, name: any, image: any, properties?: {}) => Promise<{
|
|
12
|
+
statusCode: number;
|
|
13
|
+
body: {
|
|
14
|
+
error: string;
|
|
15
|
+
details: string;
|
|
16
|
+
comparison: {
|
|
17
|
+
name: any;
|
|
18
|
+
status: string;
|
|
19
|
+
baseline: any;
|
|
20
|
+
current: any;
|
|
21
|
+
diff: any;
|
|
22
|
+
};
|
|
23
|
+
tddMode: boolean;
|
|
24
|
+
status?: undefined;
|
|
25
|
+
message?: undefined;
|
|
26
|
+
success?: undefined;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
statusCode: number;
|
|
30
|
+
body: {
|
|
31
|
+
status: string;
|
|
32
|
+
message: string;
|
|
33
|
+
comparison: {
|
|
34
|
+
name: any;
|
|
35
|
+
status: string;
|
|
36
|
+
baseline: any;
|
|
37
|
+
current: any;
|
|
38
|
+
diff?: undefined;
|
|
39
|
+
};
|
|
40
|
+
tddMode: boolean;
|
|
41
|
+
error?: undefined;
|
|
42
|
+
details?: undefined;
|
|
43
|
+
success?: undefined;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
statusCode: number;
|
|
47
|
+
body: {
|
|
48
|
+
error: string;
|
|
49
|
+
tddMode: boolean;
|
|
50
|
+
details?: undefined;
|
|
51
|
+
comparison?: undefined;
|
|
52
|
+
status?: undefined;
|
|
53
|
+
message?: undefined;
|
|
54
|
+
success?: undefined;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
statusCode: number;
|
|
58
|
+
body: {
|
|
59
|
+
success: boolean;
|
|
60
|
+
comparison: {
|
|
61
|
+
name: any;
|
|
62
|
+
status: string;
|
|
63
|
+
baseline?: undefined;
|
|
64
|
+
current?: undefined;
|
|
65
|
+
diff?: undefined;
|
|
66
|
+
};
|
|
67
|
+
tddMode: boolean;
|
|
68
|
+
error?: undefined;
|
|
69
|
+
details?: undefined;
|
|
70
|
+
status?: undefined;
|
|
71
|
+
message?: undefined;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
getScreenshotCount: (buildId: any) => any;
|
|
75
|
+
finishBuild: (buildId: any) => Promise<{
|
|
76
|
+
id: any;
|
|
77
|
+
name: any;
|
|
78
|
+
tddMode: boolean;
|
|
79
|
+
results: {
|
|
80
|
+
total: number;
|
|
81
|
+
passed: number;
|
|
82
|
+
failed: number;
|
|
83
|
+
new: number;
|
|
84
|
+
errors: number;
|
|
85
|
+
comparisons: any[];
|
|
86
|
+
baseline: any;
|
|
87
|
+
};
|
|
88
|
+
url: any;
|
|
89
|
+
passed: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
cleanup: () => void;
|
|
92
|
+
} | {
|
|
93
|
+
handleScreenshot: (buildId: any, name: any, image: any, properties?: {}) => Promise<{
|
|
94
|
+
statusCode: number;
|
|
95
|
+
body: {
|
|
96
|
+
success: boolean;
|
|
97
|
+
disabled: boolean;
|
|
98
|
+
count: number;
|
|
99
|
+
message: string;
|
|
100
|
+
error?: undefined;
|
|
101
|
+
name?: undefined;
|
|
102
|
+
skipped?: undefined;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
statusCode: number;
|
|
106
|
+
body: {
|
|
107
|
+
error: string;
|
|
108
|
+
success?: undefined;
|
|
109
|
+
disabled?: undefined;
|
|
110
|
+
count?: undefined;
|
|
111
|
+
message?: undefined;
|
|
112
|
+
name?: undefined;
|
|
113
|
+
skipped?: undefined;
|
|
114
|
+
};
|
|
115
|
+
} | {
|
|
116
|
+
statusCode: number;
|
|
117
|
+
body: {
|
|
118
|
+
success: boolean;
|
|
119
|
+
name: any;
|
|
120
|
+
skipped: any;
|
|
121
|
+
count: number;
|
|
122
|
+
disabled?: undefined;
|
|
123
|
+
message?: undefined;
|
|
124
|
+
error?: undefined;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
statusCode: number;
|
|
128
|
+
body: {
|
|
129
|
+
success: boolean;
|
|
130
|
+
name: any;
|
|
131
|
+
disabled: boolean;
|
|
132
|
+
message: string;
|
|
133
|
+
count?: undefined;
|
|
134
|
+
error?: undefined;
|
|
135
|
+
skipped?: undefined;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
getScreenshotCount: () => number;
|
|
139
|
+
cleanup: () => void;
|
|
140
|
+
};
|
|
141
|
+
emitter: EventEmitter<[never]>;
|
|
142
|
+
start(buildId?: any, tddMode?: boolean): Promise<void>;
|
|
143
|
+
buildId: any;
|
|
144
|
+
tddMode: boolean;
|
|
5
145
|
createApiService(): Promise<import("./api-service.js").ApiService>;
|
|
146
|
+
get server(): {
|
|
147
|
+
emitter: EventEmitter<[never]>;
|
|
148
|
+
getScreenshotCount: (buildId: any) => any;
|
|
149
|
+
finishBuild: (buildId: any) => any;
|
|
150
|
+
};
|
|
6
151
|
}
|
|
7
152
|
import { BaseService } from './base-service.js';
|
|
8
|
-
import {
|
|
153
|
+
import { EventEmitter } from 'events';
|
|
@@ -17,6 +17,7 @@ export class TestRunner extends BaseService {
|
|
|
17
17
|
testsFailed: number;
|
|
18
18
|
screenshotsCaptured: number;
|
|
19
19
|
}>;
|
|
20
|
+
createBuild(options: any, tdd: any): Promise<any>;
|
|
20
21
|
createApiService(): Promise<import("./api-service.js").ApiService>;
|
|
21
22
|
finalizeBuild(buildId: any, isTddMode: any, success: any, executionTime: any): Promise<void>;
|
|
22
23
|
executeTestCommand(testCommand: any, env: any): Promise<any>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('../types/index.js').VizzlyConfig} config
|
|
4
4
|
* @returns {import('../types/index.js').VizzlyConfig}
|
|
5
5
|
*/
|
|
6
|
-
export function defineConfig(config:
|
|
6
|
+
export function defineConfig(config: any): any;
|
|
@@ -45,11 +45,11 @@ export class ConsoleUI {
|
|
|
45
45
|
* Start a spinner with message
|
|
46
46
|
*/
|
|
47
47
|
startSpinner(message: any): void;
|
|
48
|
+
currentMessage: any;
|
|
48
49
|
/**
|
|
49
50
|
* Update spinner message and progress
|
|
50
51
|
*/
|
|
51
52
|
updateSpinner(message: any, current?: number, total?: number): void;
|
|
52
|
-
currentMessage: string;
|
|
53
53
|
/**
|
|
54
54
|
* Stop the spinner
|
|
55
55
|
*/
|