@vizzly-testing/cli 0.1.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/LICENSE +21 -0
- package/README.md +363 -0
- package/bin/vizzly.js +3 -0
- package/dist/cli.js +104 -0
- package/dist/client/index.js +237 -0
- package/dist/commands/doctor.js +158 -0
- package/dist/commands/init.js +102 -0
- package/dist/commands/run.js +224 -0
- package/dist/commands/status.js +164 -0
- package/dist/commands/tdd.js +212 -0
- package/dist/commands/upload.js +181 -0
- package/dist/container/index.js +184 -0
- package/dist/errors/vizzly-error.js +149 -0
- package/dist/index.js +31 -0
- package/dist/screenshot-wrapper.js +68 -0
- package/dist/sdk/index.js +364 -0
- package/dist/server/index.js +522 -0
- package/dist/services/api-service.js +215 -0
- package/dist/services/base-service.js +154 -0
- package/dist/services/build-manager.js +214 -0
- package/dist/services/screenshot-server.js +96 -0
- package/dist/services/server-manager.js +61 -0
- package/dist/services/service-utils.js +171 -0
- package/dist/services/tdd-service.js +444 -0
- package/dist/services/test-runner.js +210 -0
- package/dist/services/uploader.js +413 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/client/index.d.ts +76 -0
- package/dist/types/commands/doctor.d.ts +11 -0
- package/dist/types/commands/init.d.ts +14 -0
- package/dist/types/commands/run.d.ts +13 -0
- package/dist/types/commands/status.d.ts +13 -0
- package/dist/types/commands/tdd.d.ts +13 -0
- package/dist/types/commands/upload.d.ts +13 -0
- package/dist/types/container/index.d.ts +61 -0
- package/dist/types/errors/vizzly-error.d.ts +75 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +153 -0
- package/dist/types/screenshot-wrapper.d.ts +27 -0
- package/dist/types/sdk/index.d.ts +108 -0
- package/dist/types/server/index.d.ts +38 -0
- package/dist/types/services/api-service.d.ts +77 -0
- package/dist/types/services/base-service.d.ts +72 -0
- package/dist/types/services/build-manager.d.ts +68 -0
- package/dist/types/services/screenshot-server.d.ts +10 -0
- package/dist/types/services/server-manager.d.ts +8 -0
- package/dist/types/services/service-utils.d.ts +45 -0
- package/dist/types/services/tdd-service.d.ts +55 -0
- package/dist/types/services/test-runner.d.ts +25 -0
- package/dist/types/services/uploader.d.ts +34 -0
- package/dist/types/types/index.d.ts +373 -0
- package/dist/types/utils/colors.d.ts +12 -0
- package/dist/types/utils/config-helpers.d.ts +6 -0
- package/dist/types/utils/config-loader.d.ts +22 -0
- package/dist/types/utils/console-ui.d.ts +61 -0
- package/dist/types/utils/diagnostics.d.ts +69 -0
- package/dist/types/utils/environment-config.d.ts +54 -0
- package/dist/types/utils/environment.d.ts +36 -0
- package/dist/types/utils/error-messages.d.ts +42 -0
- package/dist/types/utils/fetch-utils.d.ts +1 -0
- package/dist/types/utils/framework-detector.d.ts +5 -0
- package/dist/types/utils/git.d.ts +44 -0
- package/dist/types/utils/help.d.ts +11 -0
- package/dist/types/utils/image-comparison.d.ts +42 -0
- package/dist/types/utils/logger-factory.d.ts +26 -0
- package/dist/types/utils/logger.d.ts +79 -0
- package/dist/types/utils/package-info.d.ts +15 -0
- package/dist/types/utils/package.d.ts +1 -0
- package/dist/types/utils/project-detection.d.ts +19 -0
- package/dist/types/utils/ui-helpers.d.ts +23 -0
- package/dist/utils/colors.js +66 -0
- package/dist/utils/config-helpers.js +8 -0
- package/dist/utils/config-loader.js +120 -0
- package/dist/utils/console-ui.js +226 -0
- package/dist/utils/diagnostics.js +184 -0
- package/dist/utils/environment-config.js +93 -0
- package/dist/utils/environment.js +109 -0
- package/dist/utils/error-messages.js +34 -0
- package/dist/utils/fetch-utils.js +9 -0
- package/dist/utils/framework-detector.js +40 -0
- package/dist/utils/git.js +226 -0
- package/dist/utils/help.js +66 -0
- package/dist/utils/image-comparison.js +172 -0
- package/dist/utils/logger-factory.js +76 -0
- package/dist/utils/logger.js +231 -0
- package/dist/utils/package-info.js +38 -0
- package/dist/utils/package.js +9 -0
- package/dist/utils/project-detection.js +145 -0
- package/dist/utils/ui-helpers.js +86 -0
- package/package.json +103 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ServiceOptions
|
|
3
|
+
* @property {Object} logger - Logger instance
|
|
4
|
+
* @property {AbortSignal} [signal] - Abort signal for cancellation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base class for all services
|
|
8
|
+
* @extends EventEmitter
|
|
9
|
+
*/
|
|
10
|
+
export class BaseService extends EventEmitter<[never]> {
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} config - Service configuration
|
|
13
|
+
* @param {ServiceOptions} options - Service options
|
|
14
|
+
*/
|
|
15
|
+
constructor(config: any, options?: ServiceOptions);
|
|
16
|
+
config: any;
|
|
17
|
+
logger: any;
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
started: boolean;
|
|
20
|
+
stopping: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Start the service
|
|
23
|
+
* @returns {Promise<void>}
|
|
24
|
+
*/
|
|
25
|
+
start(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop the service
|
|
28
|
+
* @returns {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
stop(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Hook for service-specific start logic
|
|
33
|
+
* @protected
|
|
34
|
+
* @returns {Promise<void>}
|
|
35
|
+
*/
|
|
36
|
+
protected onStart(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Hook for service-specific stop logic
|
|
39
|
+
* @protected
|
|
40
|
+
* @returns {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
protected onStop(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Emit a progress event
|
|
45
|
+
* @param {string} phase - Progress phase
|
|
46
|
+
* @param {string} message - Progress message
|
|
47
|
+
* @param {Object} [data] - Additional data
|
|
48
|
+
*/
|
|
49
|
+
emitProgress(phase: string, message: string, data?: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* Check if service is running
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
isRunning(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Wait for service to be ready
|
|
57
|
+
* @param {number} [timeout=30000] - Timeout in milliseconds
|
|
58
|
+
* @returns {Promise<void>}
|
|
59
|
+
*/
|
|
60
|
+
waitForReady(timeout?: number): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export type ServiceOptions = {
|
|
63
|
+
/**
|
|
64
|
+
* - Logger instance
|
|
65
|
+
*/
|
|
66
|
+
logger: any;
|
|
67
|
+
/**
|
|
68
|
+
* - Abort signal for cancellation
|
|
69
|
+
*/
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
};
|
|
72
|
+
import { EventEmitter } from 'events';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate unique build ID for local build management only.
|
|
3
|
+
* Note: The API generates its own UUIDs for actual builds - this local ID
|
|
4
|
+
* is only used for CLI internal tracking and is not sent to the API.
|
|
5
|
+
* @returns {string} Build ID
|
|
6
|
+
*/
|
|
7
|
+
export function generateBuildId(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Create build object
|
|
10
|
+
* @param {Object} buildOptions - Build configuration
|
|
11
|
+
* @returns {Object} Build object
|
|
12
|
+
*/
|
|
13
|
+
export function createBuildObject(buildOptions: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* Update build with new status and data
|
|
16
|
+
* @param {Object} build - Current build
|
|
17
|
+
* @param {string} status - New status
|
|
18
|
+
* @param {Object} updates - Additional updates
|
|
19
|
+
* @returns {Object} Updated build
|
|
20
|
+
*/
|
|
21
|
+
export function updateBuild(build: any, status: string, updates?: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* Add screenshot to build
|
|
24
|
+
* @param {Object} build - Current build
|
|
25
|
+
* @param {Object} screenshot - Screenshot data
|
|
26
|
+
* @returns {Object} Updated build
|
|
27
|
+
*/
|
|
28
|
+
export function addScreenshotToBuild(build: any, screenshot: any): any;
|
|
29
|
+
/**
|
|
30
|
+
* Finalize build with result
|
|
31
|
+
* @param {Object} build - Current build
|
|
32
|
+
* @param {Object} result - Build result
|
|
33
|
+
* @returns {Object} Finalized build
|
|
34
|
+
*/
|
|
35
|
+
export function finalizeBuildObject(build: any, result?: any): any;
|
|
36
|
+
/**
|
|
37
|
+
* Create queued build item
|
|
38
|
+
* @param {Object} buildOptions - Build options
|
|
39
|
+
* @returns {Object} Queued build item
|
|
40
|
+
*/
|
|
41
|
+
export function createQueuedBuild(buildOptions: any): any;
|
|
42
|
+
/**
|
|
43
|
+
* Validate build options
|
|
44
|
+
* @param {Object} buildOptions - Build options to validate
|
|
45
|
+
* @returns {Object} Validation result
|
|
46
|
+
*/
|
|
47
|
+
export function validateBuildOptions(buildOptions: any): any;
|
|
48
|
+
export class BuildManager extends BaseService {
|
|
49
|
+
constructor(config: any, logger: any);
|
|
50
|
+
currentBuild: any;
|
|
51
|
+
buildQueue: any[];
|
|
52
|
+
createBuild(buildOptions: any): Promise<any>;
|
|
53
|
+
updateBuildStatus(buildId: any, status: any, updates?: {}): Promise<any>;
|
|
54
|
+
addScreenshot(buildId: any, screenshot: any): Promise<any>;
|
|
55
|
+
finalizeBuild(buildId: any, result?: {}): Promise<any>;
|
|
56
|
+
getCurrentBuild(): any;
|
|
57
|
+
queueBuild(buildOptions: any): void;
|
|
58
|
+
processNextBuild(): Promise<any>;
|
|
59
|
+
getQueueStatus(): {
|
|
60
|
+
length: number;
|
|
61
|
+
items: {
|
|
62
|
+
name: any;
|
|
63
|
+
branch: any;
|
|
64
|
+
queuedAt: any;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
import { BaseService } from './base-service.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class ScreenshotServer extends BaseService {
|
|
2
|
+
constructor(config: any, logger: any, buildManager: any);
|
|
3
|
+
buildManager: any;
|
|
4
|
+
server: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
5
|
+
onStart(): Promise<any>;
|
|
6
|
+
onStop(): Promise<any>;
|
|
7
|
+
handleRequest(req: any, res: any): Promise<void>;
|
|
8
|
+
parseRequestBody(req: any): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
import { BaseService } from './base-service.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class ServerManager extends BaseService {
|
|
2
|
+
constructor(config: any, logger: any);
|
|
3
|
+
server: VizzlyServer;
|
|
4
|
+
start(buildId?: any, buildInfo?: any, mode?: string): Promise<void>;
|
|
5
|
+
createApiService(): Promise<import("./api-service.js").ApiService>;
|
|
6
|
+
}
|
|
7
|
+
import { BaseService } from './base-service.js';
|
|
8
|
+
import { VizzlyServer } from '../server/index.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an event emitter with enhanced functionality
|
|
3
|
+
* @returns {EventEmitter} Enhanced event emitter
|
|
4
|
+
*/
|
|
5
|
+
export function createEventEmitter(): EventEmitter;
|
|
6
|
+
/**
|
|
7
|
+
* Create a cleanup manager
|
|
8
|
+
* @returns {Object} Cleanup manager with add/execute methods
|
|
9
|
+
*/
|
|
10
|
+
export function createCleanupManager(): any;
|
|
11
|
+
/**
|
|
12
|
+
* Create signal handlers for graceful shutdown
|
|
13
|
+
* @param {Function} onSignal - Function to call on signal
|
|
14
|
+
* @returns {Function} Cleanup function to remove handlers
|
|
15
|
+
*/
|
|
16
|
+
export function createSignalHandlers(onSignal: Function): Function;
|
|
17
|
+
/**
|
|
18
|
+
* Higher-order function to add error handling to any function
|
|
19
|
+
* @param {Function} fn - Function to wrap
|
|
20
|
+
* @param {Object} options - Error handling options
|
|
21
|
+
* @returns {Function} Wrapped function with error handling
|
|
22
|
+
*/
|
|
23
|
+
export function withErrorHandling(fn: Function, options?: any): Function;
|
|
24
|
+
/**
|
|
25
|
+
* Higher-order function to add logging to any function
|
|
26
|
+
* @param {Function} fn - Function to wrap
|
|
27
|
+
* @param {Object} logger - Logger instance
|
|
28
|
+
* @param {string} operation - Operation name for logging
|
|
29
|
+
* @returns {Function} Wrapped function with logging
|
|
30
|
+
*/
|
|
31
|
+
export function withLogging(fn: Function, logger: any, operation: string): Function;
|
|
32
|
+
/**
|
|
33
|
+
* Compose multiple functions together
|
|
34
|
+
* @param {...Function} fns - Functions to compose
|
|
35
|
+
* @returns {Function} Composed function
|
|
36
|
+
*/
|
|
37
|
+
export function compose(...fns: Function[]): Function;
|
|
38
|
+
/**
|
|
39
|
+
* Create a service context with shared functionality
|
|
40
|
+
* @param {Object} config - Service configuration
|
|
41
|
+
* @param {Object} options - Service options
|
|
42
|
+
* @returns {Object} Service context
|
|
43
|
+
*/
|
|
44
|
+
export function createServiceContext(config: any, options?: any): any;
|
|
45
|
+
import { EventEmitter } from 'events';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new TDD service instance
|
|
3
|
+
*/
|
|
4
|
+
export function createTDDService(config: any, options?: {}): TddService;
|
|
5
|
+
export class TddService {
|
|
6
|
+
constructor(config: any, workingDir?: string);
|
|
7
|
+
config: any;
|
|
8
|
+
api: ApiService;
|
|
9
|
+
workingDir: string;
|
|
10
|
+
baselinePath: string;
|
|
11
|
+
currentPath: string;
|
|
12
|
+
diffPath: string;
|
|
13
|
+
baselineData: any;
|
|
14
|
+
comparisons: any[];
|
|
15
|
+
threshold: any;
|
|
16
|
+
downloadBaselines(environment?: string, branch?: any, buildId?: any, comparisonId?: any): Promise<any>;
|
|
17
|
+
loadBaseline(): Promise<any>;
|
|
18
|
+
compareScreenshot(name: any, imageBuffer: any, properties?: {}): Promise<{
|
|
19
|
+
name: any;
|
|
20
|
+
status: string;
|
|
21
|
+
baseline: any;
|
|
22
|
+
current: any;
|
|
23
|
+
diff: any;
|
|
24
|
+
properties: any;
|
|
25
|
+
}>;
|
|
26
|
+
getResults(): {
|
|
27
|
+
total: number;
|
|
28
|
+
passed: number;
|
|
29
|
+
failed: number;
|
|
30
|
+
new: number;
|
|
31
|
+
errors: number;
|
|
32
|
+
comparisons: any[];
|
|
33
|
+
baseline: any;
|
|
34
|
+
};
|
|
35
|
+
printResults(): {
|
|
36
|
+
total: number;
|
|
37
|
+
passed: number;
|
|
38
|
+
failed: number;
|
|
39
|
+
new: number;
|
|
40
|
+
errors: number;
|
|
41
|
+
comparisons: any[];
|
|
42
|
+
baseline: any;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Update baselines with current screenshots (accept changes)
|
|
46
|
+
* @returns {number} Number of baselines updated
|
|
47
|
+
*/
|
|
48
|
+
updateBaselines(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Update a single baseline with current screenshot
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private updateSingleBaseline;
|
|
54
|
+
}
|
|
55
|
+
import { ApiService } from '../services/api-service.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class TestRunner extends BaseService {
|
|
2
|
+
constructor(config: any, logger: any, buildManager: any, serverManager: any, tddService: any);
|
|
3
|
+
buildManager: any;
|
|
4
|
+
serverManager: any;
|
|
5
|
+
tddService: any;
|
|
6
|
+
testProcess: import("child_process").ChildProcess;
|
|
7
|
+
run(options: any): Promise<{
|
|
8
|
+
testsPassed: number;
|
|
9
|
+
testsFailed: number;
|
|
10
|
+
screenshotsCaptured: number;
|
|
11
|
+
buildId?: undefined;
|
|
12
|
+
url?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
buildId: any;
|
|
15
|
+
url: any;
|
|
16
|
+
testsPassed: number;
|
|
17
|
+
testsFailed: number;
|
|
18
|
+
screenshotsCaptured: number;
|
|
19
|
+
}>;
|
|
20
|
+
createApiService(): Promise<import("./api-service.js").ApiService>;
|
|
21
|
+
finalizeBuild(buildId: any, isTddMode: any, success: any, executionTime: any): Promise<void>;
|
|
22
|
+
executeTestCommand(testCommand: any, env: any): Promise<any>;
|
|
23
|
+
cancel(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
import { BaseService } from './base-service.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new uploader instance
|
|
3
|
+
*/
|
|
4
|
+
export function createUploader({ apiKey, apiUrl, userAgent, command, upload: uploadConfig }: {
|
|
5
|
+
apiKey: any;
|
|
6
|
+
apiUrl: any;
|
|
7
|
+
userAgent: any;
|
|
8
|
+
command: any;
|
|
9
|
+
upload?: {};
|
|
10
|
+
}, options?: {}): {
|
|
11
|
+
upload: ({ screenshotsDir, buildName, branch, commit, message, environment, threshold, onProgress, }: {
|
|
12
|
+
screenshotsDir: any;
|
|
13
|
+
buildName: any;
|
|
14
|
+
branch: any;
|
|
15
|
+
commit: any;
|
|
16
|
+
message: any;
|
|
17
|
+
environment?: string;
|
|
18
|
+
threshold: any;
|
|
19
|
+
onProgress?: () => void;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
success: boolean;
|
|
22
|
+
buildId: any;
|
|
23
|
+
url: any;
|
|
24
|
+
stats: {
|
|
25
|
+
total: number;
|
|
26
|
+
uploaded: any;
|
|
27
|
+
skipped: any;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
waitForBuild: (buildId: any, timeout?: number) => Promise<{
|
|
31
|
+
status: string;
|
|
32
|
+
build: any;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
3
|
+
export type VizzlyConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* - API key for authentication
|
|
6
|
+
*/
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
/**
|
|
9
|
+
* - API base URL
|
|
10
|
+
*/
|
|
11
|
+
apiUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* - Server configuration
|
|
14
|
+
*/
|
|
15
|
+
server?: ServerConfig;
|
|
16
|
+
/**
|
|
17
|
+
* - Build configuration
|
|
18
|
+
*/
|
|
19
|
+
build?: BuildConfig;
|
|
20
|
+
/**
|
|
21
|
+
* - Upload configuration
|
|
22
|
+
*/
|
|
23
|
+
upload?: UploadConfig;
|
|
24
|
+
/**
|
|
25
|
+
* - Comparison configuration
|
|
26
|
+
*/
|
|
27
|
+
comparison?: ComparisonConfig;
|
|
28
|
+
};
|
|
29
|
+
export type ServerConfig = {
|
|
30
|
+
/**
|
|
31
|
+
* - Server port
|
|
32
|
+
*/
|
|
33
|
+
port?: number;
|
|
34
|
+
/**
|
|
35
|
+
* - Server host
|
|
36
|
+
*/
|
|
37
|
+
host?: string;
|
|
38
|
+
/**
|
|
39
|
+
* - Use HTTPS
|
|
40
|
+
*/
|
|
41
|
+
https?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* - Path to SSL certificate
|
|
44
|
+
*/
|
|
45
|
+
certPath?: string;
|
|
46
|
+
/**
|
|
47
|
+
* - Path to SSL key
|
|
48
|
+
*/
|
|
49
|
+
keyPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* - Screenshot POST endpoint path
|
|
52
|
+
*/
|
|
53
|
+
screenshotPath?: string;
|
|
54
|
+
};
|
|
55
|
+
export type BuildConfig = {
|
|
56
|
+
/**
|
|
57
|
+
* - Build name
|
|
58
|
+
*/
|
|
59
|
+
name?: string;
|
|
60
|
+
/**
|
|
61
|
+
* - Git branch
|
|
62
|
+
*/
|
|
63
|
+
branch?: string;
|
|
64
|
+
/**
|
|
65
|
+
* - Git commit SHA
|
|
66
|
+
*/
|
|
67
|
+
commit?: string;
|
|
68
|
+
/**
|
|
69
|
+
* - Commit message
|
|
70
|
+
*/
|
|
71
|
+
message?: string;
|
|
72
|
+
/**
|
|
73
|
+
* - Environment name
|
|
74
|
+
*/
|
|
75
|
+
environment?: string;
|
|
76
|
+
/**
|
|
77
|
+
* - Additional metadata
|
|
78
|
+
*/
|
|
79
|
+
metadata?: {
|
|
80
|
+
[x: string]: any;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type UploadConfig = {
|
|
84
|
+
/**
|
|
85
|
+
* - Directory containing screenshots
|
|
86
|
+
*/
|
|
87
|
+
screenshotsDir?: string;
|
|
88
|
+
/**
|
|
89
|
+
* - Upload batch size
|
|
90
|
+
*/
|
|
91
|
+
batchSize?: number;
|
|
92
|
+
/**
|
|
93
|
+
* - Upload timeout in ms
|
|
94
|
+
*/
|
|
95
|
+
timeout?: number;
|
|
96
|
+
/**
|
|
97
|
+
* - Number of retries
|
|
98
|
+
*/
|
|
99
|
+
retries?: number;
|
|
100
|
+
/**
|
|
101
|
+
* - Enable deduplication
|
|
102
|
+
*/
|
|
103
|
+
deduplication?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export type ComparisonConfig = {
|
|
106
|
+
/**
|
|
107
|
+
* - Default comparison threshold (0-1)
|
|
108
|
+
*/
|
|
109
|
+
threshold?: number;
|
|
110
|
+
/**
|
|
111
|
+
* - Ignore antialiasing differences
|
|
112
|
+
*/
|
|
113
|
+
ignoreAntialiasing?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* - Ignore color differences
|
|
116
|
+
*/
|
|
117
|
+
ignoreColors?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* - Color for diff highlighting
|
|
120
|
+
*/
|
|
121
|
+
diffColor?: string;
|
|
122
|
+
};
|
|
123
|
+
export type Screenshot = {
|
|
124
|
+
/**
|
|
125
|
+
* - Screenshot name
|
|
126
|
+
*/
|
|
127
|
+
name: string;
|
|
128
|
+
/**
|
|
129
|
+
* - Image buffer data
|
|
130
|
+
*/
|
|
131
|
+
image: Buffer;
|
|
132
|
+
/**
|
|
133
|
+
* - Additional properties
|
|
134
|
+
*/
|
|
135
|
+
properties?: {
|
|
136
|
+
[x: string]: any;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* - Comparison threshold override
|
|
140
|
+
*/
|
|
141
|
+
threshold?: number;
|
|
142
|
+
/**
|
|
143
|
+
* - Screenshot group/category
|
|
144
|
+
*/
|
|
145
|
+
group?: string;
|
|
146
|
+
/**
|
|
147
|
+
* - Screenshot tags
|
|
148
|
+
*/
|
|
149
|
+
tags?: string[];
|
|
150
|
+
};
|
|
151
|
+
export type UploadOptions = {
|
|
152
|
+
/**
|
|
153
|
+
* - Directory containing screenshots
|
|
154
|
+
*/
|
|
155
|
+
screenshotsDir: string;
|
|
156
|
+
/**
|
|
157
|
+
* - Name for this build
|
|
158
|
+
*/
|
|
159
|
+
buildName?: string;
|
|
160
|
+
/**
|
|
161
|
+
* - Git branch name
|
|
162
|
+
*/
|
|
163
|
+
branch?: string;
|
|
164
|
+
/**
|
|
165
|
+
* - Git commit SHA
|
|
166
|
+
*/
|
|
167
|
+
commit?: string;
|
|
168
|
+
/**
|
|
169
|
+
* - Commit message
|
|
170
|
+
*/
|
|
171
|
+
message?: string;
|
|
172
|
+
/**
|
|
173
|
+
* - Environment name
|
|
174
|
+
*/
|
|
175
|
+
environment?: string;
|
|
176
|
+
/**
|
|
177
|
+
* - Default comparison threshold
|
|
178
|
+
*/
|
|
179
|
+
threshold?: number;
|
|
180
|
+
/**
|
|
181
|
+
* - Progress callback
|
|
182
|
+
*/
|
|
183
|
+
onProgress?: ProgressCallback;
|
|
184
|
+
};
|
|
185
|
+
export type UploadResult = {
|
|
186
|
+
/**
|
|
187
|
+
* - Whether upload succeeded
|
|
188
|
+
*/
|
|
189
|
+
success: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* - Build ID if successful
|
|
192
|
+
*/
|
|
193
|
+
buildId?: string;
|
|
194
|
+
/**
|
|
195
|
+
* - Build URL if available
|
|
196
|
+
*/
|
|
197
|
+
url?: string;
|
|
198
|
+
/**
|
|
199
|
+
* - Upload statistics
|
|
200
|
+
*/
|
|
201
|
+
stats: UploadStats;
|
|
202
|
+
/**
|
|
203
|
+
* - Error message if failed
|
|
204
|
+
*/
|
|
205
|
+
error?: string;
|
|
206
|
+
};
|
|
207
|
+
export type UploadStats = {
|
|
208
|
+
/**
|
|
209
|
+
* - Total files found
|
|
210
|
+
*/
|
|
211
|
+
total: number;
|
|
212
|
+
/**
|
|
213
|
+
* - Files uploaded
|
|
214
|
+
*/
|
|
215
|
+
uploaded: number;
|
|
216
|
+
/**
|
|
217
|
+
* - Files skipped (duplicates)
|
|
218
|
+
*/
|
|
219
|
+
skipped: number;
|
|
220
|
+
/**
|
|
221
|
+
* - Files failed to upload
|
|
222
|
+
*/
|
|
223
|
+
failed: number;
|
|
224
|
+
};
|
|
225
|
+
export type ProgressEvent = {
|
|
226
|
+
/**
|
|
227
|
+
* - Current phase
|
|
228
|
+
*/
|
|
229
|
+
phase: "scanning" | "processing" | "deduplication" | "uploading" | "completed" | "error";
|
|
230
|
+
/**
|
|
231
|
+
* - Current item being processed
|
|
232
|
+
*/
|
|
233
|
+
current?: number;
|
|
234
|
+
/**
|
|
235
|
+
* - Total items to process
|
|
236
|
+
*/
|
|
237
|
+
total?: number;
|
|
238
|
+
/**
|
|
239
|
+
* - Progress message
|
|
240
|
+
*/
|
|
241
|
+
message?: string;
|
|
242
|
+
/**
|
|
243
|
+
* - Files to upload (deduplication phase)
|
|
244
|
+
*/
|
|
245
|
+
toUpload?: number;
|
|
246
|
+
/**
|
|
247
|
+
* - Existing files (deduplication phase)
|
|
248
|
+
*/
|
|
249
|
+
existing?: number;
|
|
250
|
+
/**
|
|
251
|
+
* - Build ID (completed phase)
|
|
252
|
+
*/
|
|
253
|
+
buildId?: string;
|
|
254
|
+
/**
|
|
255
|
+
* - Build URL (completed phase)
|
|
256
|
+
*/
|
|
257
|
+
url?: string;
|
|
258
|
+
};
|
|
259
|
+
export type ProgressCallback = (event: ProgressEvent) => void;
|
|
260
|
+
export type TDDOptions = {
|
|
261
|
+
/**
|
|
262
|
+
* - Baseline screenshots directory
|
|
263
|
+
*/
|
|
264
|
+
baselineDir?: string;
|
|
265
|
+
/**
|
|
266
|
+
* - Current screenshots directory
|
|
267
|
+
*/
|
|
268
|
+
currentDir?: string;
|
|
269
|
+
/**
|
|
270
|
+
* - Diff output directory
|
|
271
|
+
*/
|
|
272
|
+
diffDir?: string;
|
|
273
|
+
/**
|
|
274
|
+
* - Comparison threshold
|
|
275
|
+
*/
|
|
276
|
+
threshold?: number;
|
|
277
|
+
/**
|
|
278
|
+
* - Fail on any difference
|
|
279
|
+
*/
|
|
280
|
+
failOnDifference?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* - Update baseline on difference
|
|
283
|
+
*/
|
|
284
|
+
updateBaseline?: boolean;
|
|
285
|
+
};
|
|
286
|
+
export type ComparisonResult = {
|
|
287
|
+
/**
|
|
288
|
+
* - Screenshot name
|
|
289
|
+
*/
|
|
290
|
+
name: string;
|
|
291
|
+
/**
|
|
292
|
+
* - Whether comparison passed
|
|
293
|
+
*/
|
|
294
|
+
passed: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* - Difference percentage (0-1)
|
|
297
|
+
*/
|
|
298
|
+
difference?: number;
|
|
299
|
+
/**
|
|
300
|
+
* - Path to diff image
|
|
301
|
+
*/
|
|
302
|
+
diffPath?: string;
|
|
303
|
+
/**
|
|
304
|
+
* - Error message if comparison failed
|
|
305
|
+
*/
|
|
306
|
+
error?: string;
|
|
307
|
+
};
|
|
308
|
+
export type BuildInfo = {
|
|
309
|
+
/**
|
|
310
|
+
* - Build ID
|
|
311
|
+
*/
|
|
312
|
+
id: string;
|
|
313
|
+
/**
|
|
314
|
+
* - Build name
|
|
315
|
+
*/
|
|
316
|
+
name: string;
|
|
317
|
+
/**
|
|
318
|
+
* - Build status
|
|
319
|
+
*/
|
|
320
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
321
|
+
/**
|
|
322
|
+
* - Git branch
|
|
323
|
+
*/
|
|
324
|
+
branch: string;
|
|
325
|
+
/**
|
|
326
|
+
* - Git commit SHA
|
|
327
|
+
*/
|
|
328
|
+
commit?: string;
|
|
329
|
+
/**
|
|
330
|
+
* - Environment name
|
|
331
|
+
*/
|
|
332
|
+
environment: string;
|
|
333
|
+
/**
|
|
334
|
+
* - Creation timestamp
|
|
335
|
+
*/
|
|
336
|
+
createdAt: Date;
|
|
337
|
+
/**
|
|
338
|
+
* - Completion timestamp
|
|
339
|
+
*/
|
|
340
|
+
completedAt?: Date;
|
|
341
|
+
/**
|
|
342
|
+
* - Number of screenshots
|
|
343
|
+
*/
|
|
344
|
+
screenshotCount: number;
|
|
345
|
+
/**
|
|
346
|
+
* - Additional metadata
|
|
347
|
+
*/
|
|
348
|
+
metadata?: {
|
|
349
|
+
[x: string]: any;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export type CLIOptions = {
|
|
353
|
+
/**
|
|
354
|
+
* - Enable verbose logging
|
|
355
|
+
*/
|
|
356
|
+
verbose?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* - Log level
|
|
359
|
+
*/
|
|
360
|
+
logLevel?: string;
|
|
361
|
+
/**
|
|
362
|
+
* - Suppress all output
|
|
363
|
+
*/
|
|
364
|
+
quiet?: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* - Output JSON instead of text
|
|
367
|
+
*/
|
|
368
|
+
json?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* - Path to config file
|
|
371
|
+
*/
|
|
372
|
+
config?: string;
|
|
373
|
+
};
|