@testivai/witness-cdp 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.

Potentially problematic release.


This version of @testivai/witness-cdp might be problematic. Click here for more details.

Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +405 -0
  3. package/dist/__tests__/setup.d.ts +4 -0
  4. package/dist/__tests__/setup.d.ts.map +1 -0
  5. package/dist/__tests__/setup.js +24 -0
  6. package/dist/__tests__/setup.js.map +1 -0
  7. package/dist/cdp/binding.d.ts +44 -0
  8. package/dist/cdp/binding.d.ts.map +1 -0
  9. package/dist/cdp/binding.js +183 -0
  10. package/dist/cdp/binding.js.map +1 -0
  11. package/dist/cdp/capture.d.ts +42 -0
  12. package/dist/cdp/capture.d.ts.map +1 -0
  13. package/dist/cdp/capture.js +235 -0
  14. package/dist/cdp/capture.js.map +1 -0
  15. package/dist/cdp/client.d.ts +63 -0
  16. package/dist/cdp/client.d.ts.map +1 -0
  17. package/dist/cdp/client.js +279 -0
  18. package/dist/cdp/client.js.map +1 -0
  19. package/dist/cdp/discovery.d.ts +33 -0
  20. package/dist/cdp/discovery.d.ts.map +1 -0
  21. package/dist/cdp/discovery.js +157 -0
  22. package/dist/cdp/discovery.js.map +1 -0
  23. package/dist/commands/auth.d.ts +3 -0
  24. package/dist/commands/auth.d.ts.map +1 -0
  25. package/dist/commands/auth.js +122 -0
  26. package/dist/commands/auth.js.map +1 -0
  27. package/dist/commands/capture.d.ts +3 -0
  28. package/dist/commands/capture.d.ts.map +1 -0
  29. package/dist/commands/capture.js +143 -0
  30. package/dist/commands/capture.js.map +1 -0
  31. package/dist/commands/init.d.ts +3 -0
  32. package/dist/commands/init.d.ts.map +1 -0
  33. package/dist/commands/init.js +140 -0
  34. package/dist/commands/init.js.map +1 -0
  35. package/dist/commands/run.d.ts +3 -0
  36. package/dist/commands/run.d.ts.map +1 -0
  37. package/dist/commands/run.js +307 -0
  38. package/dist/commands/run.js.map +1 -0
  39. package/dist/index.d.ts +20 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +77 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/types.d.ts +244 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +7 -0
  46. package/dist/types.js.map +1 -0
  47. package/dist/utils/file-naming.d.ts +31 -0
  48. package/dist/utils/file-naming.d.ts.map +1 -0
  49. package/dist/utils/file-naming.js +137 -0
  50. package/dist/utils/file-naming.js.map +1 -0
  51. package/dist/utils/framework-detect.d.ts +31 -0
  52. package/dist/utils/framework-detect.d.ts.map +1 -0
  53. package/dist/utils/framework-detect.js +379 -0
  54. package/dist/utils/framework-detect.js.map +1 -0
  55. package/dist/utils/logger.d.ts +29 -0
  56. package/dist/utils/logger.d.ts.map +1 -0
  57. package/dist/utils/logger.js +114 -0
  58. package/dist/utils/logger.js.map +1 -0
  59. package/dist/utils/process.d.ts +61 -0
  60. package/dist/utils/process.d.ts.map +1 -0
  61. package/dist/utils/process.js +208 -0
  62. package/dist/utils/process.js.map +1 -0
  63. package/package.json +64 -0
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.runCommand = void 0;
40
+ const commander_1 = require("commander");
41
+ const chalk_1 = __importDefault(require("chalk"));
42
+ const client_1 = require("../cdp/client");
43
+ const binding_1 = require("../cdp/binding");
44
+ const discovery_1 = require("../cdp/discovery");
45
+ const common_1 = require("@testivai/common");
46
+ const process_1 = require("../utils/process");
47
+ const logger_1 = require("../utils/logger");
48
+ const simple_git_1 = __importDefault(require("simple-git"));
49
+ exports.runCommand = new commander_1.Command('run')
50
+ .description('Run visual tests with automatic capture')
51
+ .argument('<command>', 'Test command to execute (e.g., "npm test", "cypress run")')
52
+ .option('-p, --port <number>', 'Chrome DevTools Protocol port')
53
+ .option('-b, --batch-id <id>', 'Specify batch ID (auto-generated if not provided)')
54
+ .action(async (command, options) => {
55
+ let client = null;
56
+ let processManager = null;
57
+ let batchId = null;
58
+ // Setup signal handlers for cleanup
59
+ (0, process_1.setupSignalHandlers)(async () => {
60
+ logger_1.logger.info('Cleaning up...');
61
+ if (batchId) {
62
+ await finishBatch(batchId);
63
+ }
64
+ if (client) {
65
+ await client.disconnect();
66
+ }
67
+ if (processManager) {
68
+ processManager.kill();
69
+ }
70
+ });
71
+ try {
72
+ // Load configuration
73
+ const config = (0, common_1.loadConfig)();
74
+ const apiKey = (0, common_1.getApiKey)();
75
+ if (!apiKey) {
76
+ logger_1.logger.error('Not authenticated. Run "testivai auth <api-key>" first.');
77
+ process.exit(2);
78
+ }
79
+ // Validate API key
80
+ logger_1.logger.info('Validating API key...');
81
+ const apiClient = new common_1.CoreApiClient(apiKey);
82
+ const validation = await apiClient.validateApiKey();
83
+ if (!validation.valid) {
84
+ logger_1.logger.error(`Invalid API key: ${validation.error}`);
85
+ process.exit(2);
86
+ }
87
+ // Get CDP port from config or options
88
+ const resolvedConfig = await config;
89
+ const port = parseInt(options.port || resolvedConfig.cdpPort || '9222', 10);
90
+ // Connect to CDP
91
+ logger_1.logger.info('Connecting to Chrome DevTools Protocol...');
92
+ client = new client_1.CdpClient();
93
+ await client.connect(port);
94
+ // Get browser info
95
+ const browserInfo = await getBrowserInfo(client);
96
+ // Get git info
97
+ const gitInfo = await getGitInfo();
98
+ // Start batch
99
+ batchId = options.batchId || await startBatch(apiClient, gitInfo, browserInfo);
100
+ // Setup bindings
101
+ logger_1.logger.info('Setting up TestivAI bindings...');
102
+ const binding = new binding_1.CdpBinding(client);
103
+ await binding.setupBindings();
104
+ // Run the test command
105
+ logger_1.logger.info(`Running: ${chalk_1.default.cyan(command)}`);
106
+ processManager = new process_1.ProcessManager(command, [], {
107
+ cwd: process.cwd(),
108
+ inheritStdio: true,
109
+ });
110
+ await processManager.start();
111
+ const result = await processManager.wait();
112
+ // Get all captured snapshots
113
+ const snapshots = binding.getSnapshots();
114
+ logger_1.logger.info(`Captured ${snapshots.length} snapshot(s)`);
115
+ // Update batch with snapshots
116
+ if (snapshots.length > 0 && batchId) {
117
+ await updateBatch(apiClient, batchId, gitInfo, browserInfo, snapshots);
118
+ }
119
+ // Finish batch
120
+ if (batchId) {
121
+ await finishBatch(batchId);
122
+ }
123
+ // Print results
124
+ console.log(chalk_1.default.green('\n=== Test Results ==='));
125
+ console.log(`Batch ID: ${batchId}`);
126
+ console.log(`Snapshots: ${snapshots.length}`);
127
+ console.log(`Exit code: ${result.exitCode}`);
128
+ console.log(`Dashboard: https://dashboard.testiv.ai/projects/${validation.projectId}/batches/${batchId}`);
129
+ // Exit with same code as test command
130
+ process.exit(result.exitCode || 0);
131
+ }
132
+ catch (error) {
133
+ if (error instanceof discovery_1.CdpDiscoveryError) {
134
+ console.log(chalk_1.default.red(error.message));
135
+ console.log(...error.getInstructions());
136
+ process.exit(3);
137
+ }
138
+ else {
139
+ logger_1.logger.error('Run failed:', error);
140
+ process.exit(4);
141
+ }
142
+ }
143
+ });
144
+ /**
145
+ * Get browser information from CDP
146
+ */
147
+ async function getBrowserInfo(client) {
148
+ try {
149
+ const connectionInfo = client.getConnectionInfo();
150
+ const userAgent = await client.send('Runtime.evaluate', {
151
+ expression: 'navigator.userAgent',
152
+ returnByValue: true,
153
+ });
154
+ const viewport = await client.send('Runtime.evaluate', {
155
+ expression: `
156
+ (function() {
157
+ return {
158
+ width: window.innerWidth,
159
+ height: window.innerHeight
160
+ };
161
+ })()
162
+ `,
163
+ returnByValue: true,
164
+ });
165
+ return {
166
+ name: 'chrome',
167
+ version: connectionInfo?.browserVersion || 'unknown',
168
+ viewportWidth: viewport.result.value?.width || 0,
169
+ viewportHeight: viewport.result.value?.height || 0,
170
+ userAgent: userAgent.result.value || 'unknown',
171
+ os: 'unknown',
172
+ device: 'desktop',
173
+ };
174
+ }
175
+ catch (error) {
176
+ logger_1.logger.error('Failed to get browser info:', error);
177
+ return {
178
+ name: 'chrome',
179
+ version: 'unknown',
180
+ viewportWidth: 0,
181
+ viewportHeight: 0,
182
+ userAgent: 'unknown',
183
+ os: 'unknown',
184
+ device: 'desktop',
185
+ };
186
+ }
187
+ }
188
+ /**
189
+ * Get git information
190
+ */
191
+ async function getGitInfo() {
192
+ try {
193
+ const git = (0, simple_git_1.default)();
194
+ const [branch, commit, message, author] = await Promise.all([
195
+ git.revparse(['--abbrev-ref', 'HEAD']).catch(() => 'unknown'),
196
+ git.revparse(['HEAD']).catch(() => 'unknown'),
197
+ git.show(['-s', '--format=%s']).catch(() => ''),
198
+ git.show(['-s', '--format=%an']).catch(() => ''),
199
+ ]);
200
+ return {
201
+ branch,
202
+ commit,
203
+ message: message || undefined,
204
+ author: author || undefined,
205
+ };
206
+ }
207
+ catch (error) {
208
+ logger_1.logger.error('Failed to get git info:', error);
209
+ return {
210
+ branch: 'unknown',
211
+ commit: 'unknown',
212
+ };
213
+ }
214
+ }
215
+ /**
216
+ * Start a new batch
217
+ */
218
+ async function startBatch(apiClient, gitInfo, browserInfo) {
219
+ try {
220
+ const apiUrl = process.env.TESTIVAI_API_URL || common_1.DEFAULT_CORE_API_URL;
221
+ const response = await fetch(`${apiUrl}/api/v1/ingest/start-batch`, {
222
+ method: 'POST',
223
+ headers: {
224
+ 'Authorization': `Bearer ${(0, common_1.getApiKey)()}`,
225
+ 'Content-Type': 'application/json',
226
+ },
227
+ body: JSON.stringify({
228
+ git: gitInfo,
229
+ browser: browserInfo,
230
+ snapshots: [],
231
+ timestamp: Date.now(),
232
+ runId: process.env.CI_RUN_ID || null,
233
+ }),
234
+ });
235
+ if (!response.ok) {
236
+ throw new Error(`Failed to start batch: ${response.statusText}`);
237
+ }
238
+ const result = await response.json();
239
+ logger_1.logger.upload(result.batch_id);
240
+ return result.batch_id;
241
+ }
242
+ catch (error) {
243
+ logger_1.logger.error('Failed to start batch:', error);
244
+ throw error;
245
+ }
246
+ }
247
+ /**
248
+ * Update batch with snapshots
249
+ */
250
+ async function updateBatch(apiClient, batchId, gitInfo, browserInfo, snapshots) {
251
+ try {
252
+ const batchPayload = {
253
+ git: gitInfo,
254
+ browser: browserInfo,
255
+ snapshots,
256
+ timestamp: Date.now(),
257
+ runId: process.env.CI_RUN_ID || null,
258
+ };
259
+ // Compress if large
260
+ const compressionHelper = (await Promise.resolve().then(() => __importStar(require('@testivai/common')))).compressionHelper;
261
+ const payloadJson = JSON.stringify(batchPayload);
262
+ const compressionResult = await compressionHelper.compress(payloadJson);
263
+ const apiUrl = process.env.TESTIVAI_API_URL || common_1.DEFAULT_CORE_API_URL;
264
+ const response = await fetch(`${apiUrl}/api/v1/ingest/start-batch`, {
265
+ method: 'POST',
266
+ headers: {
267
+ 'Authorization': `Bearer ${(0, common_1.getApiKey)()}`,
268
+ 'Content-Type': 'application/json',
269
+ ...(compressionResult.compressionRatio > 0 && {
270
+ 'Content-Encoding': 'gzip',
271
+ }),
272
+ },
273
+ body: compressionResult.data,
274
+ });
275
+ if (!response.ok) {
276
+ throw new Error(`Failed to update batch: ${response.statusText}`);
277
+ }
278
+ }
279
+ catch (error) {
280
+ logger_1.logger.error('Failed to update batch:', error);
281
+ throw error;
282
+ }
283
+ }
284
+ /**
285
+ * Finish a batch
286
+ */
287
+ async function finishBatch(batchId) {
288
+ try {
289
+ const apiUrl = process.env.TESTIVAI_API_URL || common_1.DEFAULT_CORE_API_URL;
290
+ const response = await fetch(`${apiUrl}/api/v1/ingest/finish-batch/${batchId}`, {
291
+ method: 'POST',
292
+ headers: {
293
+ 'Authorization': `Bearer ${(0, common_1.getApiKey)()}`,
294
+ 'Content-Type': 'application/json',
295
+ },
296
+ });
297
+ if (!response.ok) {
298
+ throw new Error(`Failed to finish batch: ${response.statusText}`);
299
+ }
300
+ logger_1.logger.success(`Batch ${batchId} finished successfully`);
301
+ }
302
+ catch (error) {
303
+ logger_1.logger.error('Failed to finish batch:', error);
304
+ // Don't throw here - we want to exit even if finishing fails
305
+ }
306
+ }
307
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,0CAA0C;AAC1C,4CAA4C;AAC5C,gDAAmE;AACnE,6CAA8F;AAC9F,8CAAuE;AACvE,4CAAyC;AAEzC,4DAAkD;AAErC,QAAA,UAAU,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;KACzC,WAAW,CAAC,yCAAyC,CAAC;KACtD,QAAQ,CAAC,WAAW,EAAE,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AK,CAAC,2BAA2B,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,eAAM,CAAC,OAAO,CAAC,SAAS,OAAO,wBAAwB,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAC/C,6DAA6D;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * TestivAI CDP SDK
3
+ * Framework-agnostic visual regression testing using Chrome DevTools Protocol
4
+ */
5
+ export * from './types';
6
+ export { CdpClient } from './cdp/client';
7
+ export { CdpCapture } from './cdp/capture';
8
+ export { CdpBinding } from './cdp/binding';
9
+ export { CdpDiscovery, CdpDiscoveryError } from './cdp/discovery';
10
+ export { logger, createLogger } from './utils/logger';
11
+ export { toSafeFilename, generateUniqueFilename, extractNameFromUrl, sanitizeTestName, isSafeFilename } from './utils/file-naming';
12
+ export { ProcessManager, spawnProcess, setupSignalHandlers, commandExists } from './utils/process';
13
+ export { FrameworkDetector } from './utils/framework-detect';
14
+ export { authCommand } from './commands/auth';
15
+ export { initCommand } from './commands/init';
16
+ export { runCommand } from './commands/run';
17
+ export { captureCommand } from './commands/capture';
18
+ export { CoreApiClient, DEFAULT_CORE_API_URL, saveCredentials, loadCredentials, deleteCredentials, getApiKey, isAuthenticated, findConfigFile, loadConfig, configExists, getOutputDir, CompressionHelper, compressionHelper, } from '@testivai/common';
19
+ export declare const VERSION: any;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnI,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,OAAO,KAAwC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ /**
3
+ * TestivAI CDP SDK
4
+ * Framework-agnostic visual regression testing using Chrome DevTools Protocol
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.VERSION = exports.compressionHelper = exports.CompressionHelper = exports.getOutputDir = exports.configExists = exports.loadConfig = exports.findConfigFile = exports.isAuthenticated = exports.getApiKey = exports.deleteCredentials = exports.loadCredentials = exports.saveCredentials = exports.DEFAULT_CORE_API_URL = exports.CoreApiClient = exports.captureCommand = exports.runCommand = exports.initCommand = exports.authCommand = exports.FrameworkDetector = exports.commandExists = exports.setupSignalHandlers = exports.spawnProcess = exports.ProcessManager = exports.isSafeFilename = exports.sanitizeTestName = exports.extractNameFromUrl = exports.generateUniqueFilename = exports.toSafeFilename = exports.createLogger = exports.logger = exports.CdpDiscoveryError = exports.CdpDiscovery = exports.CdpBinding = exports.CdpCapture = exports.CdpClient = void 0;
22
+ // Export types
23
+ __exportStar(require("./types"), exports);
24
+ // Export CDP modules
25
+ var client_1 = require("./cdp/client");
26
+ Object.defineProperty(exports, "CdpClient", { enumerable: true, get: function () { return client_1.CdpClient; } });
27
+ var capture_1 = require("./cdp/capture");
28
+ Object.defineProperty(exports, "CdpCapture", { enumerable: true, get: function () { return capture_1.CdpCapture; } });
29
+ var binding_1 = require("./cdp/binding");
30
+ Object.defineProperty(exports, "CdpBinding", { enumerable: true, get: function () { return binding_1.CdpBinding; } });
31
+ var discovery_1 = require("./cdp/discovery");
32
+ Object.defineProperty(exports, "CdpDiscovery", { enumerable: true, get: function () { return discovery_1.CdpDiscovery; } });
33
+ Object.defineProperty(exports, "CdpDiscoveryError", { enumerable: true, get: function () { return discovery_1.CdpDiscoveryError; } });
34
+ // Export utilities
35
+ var logger_1 = require("./utils/logger");
36
+ Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
37
+ Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return logger_1.createLogger; } });
38
+ var file_naming_1 = require("./utils/file-naming");
39
+ Object.defineProperty(exports, "toSafeFilename", { enumerable: true, get: function () { return file_naming_1.toSafeFilename; } });
40
+ Object.defineProperty(exports, "generateUniqueFilename", { enumerable: true, get: function () { return file_naming_1.generateUniqueFilename; } });
41
+ Object.defineProperty(exports, "extractNameFromUrl", { enumerable: true, get: function () { return file_naming_1.extractNameFromUrl; } });
42
+ Object.defineProperty(exports, "sanitizeTestName", { enumerable: true, get: function () { return file_naming_1.sanitizeTestName; } });
43
+ Object.defineProperty(exports, "isSafeFilename", { enumerable: true, get: function () { return file_naming_1.isSafeFilename; } });
44
+ var process_1 = require("./utils/process");
45
+ Object.defineProperty(exports, "ProcessManager", { enumerable: true, get: function () { return process_1.ProcessManager; } });
46
+ Object.defineProperty(exports, "spawnProcess", { enumerable: true, get: function () { return process_1.spawnProcess; } });
47
+ Object.defineProperty(exports, "setupSignalHandlers", { enumerable: true, get: function () { return process_1.setupSignalHandlers; } });
48
+ Object.defineProperty(exports, "commandExists", { enumerable: true, get: function () { return process_1.commandExists; } });
49
+ var framework_detect_1 = require("./utils/framework-detect");
50
+ Object.defineProperty(exports, "FrameworkDetector", { enumerable: true, get: function () { return framework_detect_1.FrameworkDetector; } });
51
+ // Export commands (for programmatic use)
52
+ var auth_1 = require("./commands/auth");
53
+ Object.defineProperty(exports, "authCommand", { enumerable: true, get: function () { return auth_1.authCommand; } });
54
+ var init_1 = require("./commands/init");
55
+ Object.defineProperty(exports, "initCommand", { enumerable: true, get: function () { return init_1.initCommand; } });
56
+ var run_1 = require("./commands/run");
57
+ Object.defineProperty(exports, "runCommand", { enumerable: true, get: function () { return run_1.runCommand; } });
58
+ var capture_2 = require("./commands/capture");
59
+ Object.defineProperty(exports, "captureCommand", { enumerable: true, get: function () { return capture_2.captureCommand; } });
60
+ // Re-export common utilities
61
+ var common_1 = require("@testivai/common");
62
+ Object.defineProperty(exports, "CoreApiClient", { enumerable: true, get: function () { return common_1.CoreApiClient; } });
63
+ Object.defineProperty(exports, "DEFAULT_CORE_API_URL", { enumerable: true, get: function () { return common_1.DEFAULT_CORE_API_URL; } });
64
+ Object.defineProperty(exports, "saveCredentials", { enumerable: true, get: function () { return common_1.saveCredentials; } });
65
+ Object.defineProperty(exports, "loadCredentials", { enumerable: true, get: function () { return common_1.loadCredentials; } });
66
+ Object.defineProperty(exports, "deleteCredentials", { enumerable: true, get: function () { return common_1.deleteCredentials; } });
67
+ Object.defineProperty(exports, "getApiKey", { enumerable: true, get: function () { return common_1.getApiKey; } });
68
+ Object.defineProperty(exports, "isAuthenticated", { enumerable: true, get: function () { return common_1.isAuthenticated; } });
69
+ Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return common_1.findConfigFile; } });
70
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return common_1.loadConfig; } });
71
+ Object.defineProperty(exports, "configExists", { enumerable: true, get: function () { return common_1.configExists; } });
72
+ Object.defineProperty(exports, "getOutputDir", { enumerable: true, get: function () { return common_1.getOutputDir; } });
73
+ Object.defineProperty(exports, "CompressionHelper", { enumerable: true, get: function () { return common_1.CompressionHelper; } });
74
+ Object.defineProperty(exports, "compressionHelper", { enumerable: true, get: function () { return common_1.compressionHelper; } });
75
+ // Version
76
+ exports.VERSION = require('../../package.json').version;
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,eAAe;AACf,0CAAwB;AAExB,qBAAqB;AACrB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,yCAA2C;AAAlC,qGAAA,UAAU,OAAA;AACnB,yCAA2C;AAAlC,qGAAA,UAAU,OAAA;AACnB,6CAAkE;AAAzD,yGAAA,YAAY,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAExC,mBAAmB;AACnB,yCAAsD;AAA7C,gGAAA,MAAM,OAAA;AAAE,sGAAA,YAAY,OAAA;AAC7B,mDAAmI;AAA1H,6GAAA,cAAc,OAAA;AAAE,qHAAA,sBAAsB,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAAE,6GAAA,cAAc,OAAA;AACrG,2CAAmG;AAA1F,yGAAA,cAAc,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,wGAAA,aAAa,OAAA;AACzE,6DAA6D;AAApD,qHAAA,iBAAiB,OAAA;AAE1B,yCAAyC;AACzC,wCAA8C;AAArC,mGAAA,WAAW,OAAA;AACpB,wCAA8C;AAArC,mGAAA,WAAW,OAAA;AACpB,sCAA4C;AAAnC,iGAAA,UAAU,OAAA;AACnB,8CAAoD;AAA3C,yGAAA,cAAc,OAAA;AAEvB,6BAA6B;AAC7B,2CAc0B;AAbxB,uGAAA,aAAa,OAAA;AACb,8GAAA,oBAAoB,OAAA;AACpB,yGAAA,eAAe,OAAA;AACf,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,mGAAA,SAAS,OAAA;AACT,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AACd,oGAAA,UAAU,OAAA;AACV,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA;AACZ,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AAGnB,UAAU;AACG,QAAA,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC"}
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Types for TestivAI CDP SDK
3
+ * Extends types from @testivai/common with CDP-specific additions
4
+ */
5
+ import { TestivaiConfig } from '@testivai/common';
6
+ /**
7
+ * CDP-specific configuration extending the base TestivaiConfig
8
+ */
9
+ export interface CdpConfig extends TestivaiConfig {
10
+ /** Chrome DevTools Protocol port */
11
+ cdpPort?: number;
12
+ /** Project ID from TestivAI dashboard */
13
+ projectId?: string;
14
+ /** Auto-launch Chrome if not running */
15
+ autoLaunch?: boolean;
16
+ /** Chrome executable path (for auto-launch) */
17
+ chromePath?: string;
18
+ /** Additional Chrome launch arguments */
19
+ chromeArgs?: string[];
20
+ /** Timeout for CDP connections (ms) */
21
+ connectionTimeout?: number;
22
+ /** Retry attempts for CDP connection */
23
+ connectionRetries?: number;
24
+ }
25
+ /**
26
+ * Git information for batch context
27
+ */
28
+ export interface GitInfo {
29
+ /** Current branch name */
30
+ branch: string;
31
+ /** Current commit hash */
32
+ commit: string;
33
+ /** Repository URL (optional) */
34
+ repository?: string;
35
+ /** Commit message (optional) */
36
+ message?: string;
37
+ /** Author name (optional) */
38
+ author?: string;
39
+ }
40
+ /**
41
+ * Browser context information
42
+ */
43
+ export interface BrowserInfo {
44
+ /** Browser name (chromium, firefox, webkit) */
45
+ name: string;
46
+ /** Browser version */
47
+ version: string;
48
+ /** Viewport width */
49
+ viewportWidth: number;
50
+ /** Viewport height */
51
+ viewportHeight: number;
52
+ /** User agent string */
53
+ userAgent: string;
54
+ /** Operating system */
55
+ os?: string;
56
+ /** Device type (desktop, mobile, tablet) */
57
+ device?: string;
58
+ }
59
+ /**
60
+ * DOM snapshot data
61
+ */
62
+ export interface DOMData {
63
+ /** Serialized HTML of the element */
64
+ html: string;
65
+ /** Computed styles (optional) */
66
+ styles?: Record<string, string>;
67
+ }
68
+ /**
69
+ * Layout/Bounding box data for an element
70
+ */
71
+ export interface LayoutData {
72
+ /** X coordinate */
73
+ x: number;
74
+ /** Y coordinate */
75
+ y: number;
76
+ /** Width */
77
+ width: number;
78
+ /** Height */
79
+ height: number;
80
+ /** Top position */
81
+ top: number;
82
+ /** Left position */
83
+ left: number;
84
+ /** Right position */
85
+ right: number;
86
+ /** Bottom position */
87
+ bottom: number;
88
+ }
89
+ /**
90
+ * Performance timing metrics
91
+ */
92
+ export interface PerformanceTimings {
93
+ /** Navigation start time */
94
+ navigationStart?: number;
95
+ /** DOM content loaded time */
96
+ domContentLoaded?: number;
97
+ /** Page load complete time */
98
+ loadComplete?: number;
99
+ /** First contentful paint */
100
+ firstContentfulPaint?: number;
101
+ /** Largest contentful paint */
102
+ largestContentfulPaint?: number;
103
+ /** Time to interactive */
104
+ timeToInteractive?: number;
105
+ /** Total blocking time */
106
+ totalBlockingTime?: number;
107
+ /** Cumulative layout shift */
108
+ cumulativeLayoutShift?: number;
109
+ }
110
+ /**
111
+ * Lighthouse performance results
112
+ */
113
+ export interface LighthouseResults {
114
+ /** Performance score (0-100) */
115
+ performance?: number;
116
+ /** Accessibility score (0-100) */
117
+ accessibility?: number;
118
+ /** Best practices score (0-100) */
119
+ bestPractices?: number;
120
+ /** SEO score (0-100) */
121
+ seo?: number;
122
+ /** Core Web Vitals */
123
+ coreWebVitals?: {
124
+ lcp?: number;
125
+ fid?: number;
126
+ cls?: number;
127
+ };
128
+ }
129
+ /**
130
+ * Snapshot payload for a single evidence capture
131
+ */
132
+ export interface SnapshotPayload {
133
+ /** DOM data (HTML + styles) */
134
+ dom: DOMData;
135
+ /** Layout/bounding box data */
136
+ layout: LayoutData;
137
+ /** Timestamp when snapshot was taken */
138
+ timestamp: number;
139
+ /** Test name or identifier */
140
+ testName: string;
141
+ /** Snapshot name or identifier */
142
+ snapshotName: string;
143
+ /** URL of the page when snapshot was taken */
144
+ url?: string;
145
+ /** Viewport dimensions */
146
+ viewport?: {
147
+ width: number;
148
+ height: number;
149
+ };
150
+ /** TestivAI configuration for this snapshot */
151
+ testivaiConfig?: TestivaiConfig;
152
+ /** Base64-encoded screenshot data (PNG) */
153
+ screenshotData?: string;
154
+ /** Performance timing metrics (optional) */
155
+ performanceTimings?: PerformanceTimings;
156
+ /** Lighthouse results (optional) */
157
+ lighthouseResults?: LighthouseResults;
158
+ }
159
+ /**
160
+ * Batch payload containing all evidence for a test run
161
+ */
162
+ export interface BatchPayload {
163
+ /** Git information */
164
+ git: GitInfo;
165
+ /** Browser context information */
166
+ browser: BrowserInfo;
167
+ /** Collection of snapshots */
168
+ snapshots: SnapshotPayload[];
169
+ /** Timestamp when batch was created */
170
+ timestamp: number;
171
+ /** Unique identifier for a CI/CD run, to group sharded jobs */
172
+ runId?: string | null;
173
+ /** Additional metadata */
174
+ metadata?: Record<string, unknown>;
175
+ }
176
+ /**
177
+ * CDP connection information
178
+ */
179
+ export interface CdpConnectionInfo {
180
+ /** WebSocket URL for CDP connection */
181
+ webSocketDebuggerUrl: string;
182
+ /** Chrome devtools URL */
183
+ devtoolsFrontendUrl: string;
184
+ /** Browser ID */
185
+ id: string;
186
+ /** Browser title */
187
+ title?: string;
188
+ /** Browser URL */
189
+ url?: string;
190
+ /** Browser version */
191
+ browserVersion?: string;
192
+ /** Protocol version */
193
+ protocolVersion?: string;
194
+ /** User agent */
195
+ userAgent?: string;
196
+ /** V8 version */
197
+ v8Version?: string;
198
+ /** WebKit version */
199
+ webKitVersion?: string;
200
+ }
201
+ /**
202
+ * Framework detection result
203
+ */
204
+ export interface FrameworkDetection {
205
+ /** Detected framework */
206
+ framework: 'cypress' | 'webdriverio' | 'selenium-js' | 'selenium-python' | 'unknown';
207
+ /** Confidence level (0-1) */
208
+ confidence: number;
209
+ /** Evidence for detection */
210
+ evidence: string[];
211
+ /** Configuration files found */
212
+ configFiles: string[];
213
+ /** Instructions for setup */
214
+ instructions: string[];
215
+ }
216
+ /**
217
+ * Command execution result
218
+ */
219
+ export interface CommandResult {
220
+ /** Exit code */
221
+ exitCode: number;
222
+ /** Signal that terminated the process */
223
+ signal: string | null;
224
+ /** Standard output */
225
+ stdout: string;
226
+ /** Standard error */
227
+ stderr: string;
228
+ /** Duration in milliseconds */
229
+ duration: number;
230
+ }
231
+ /**
232
+ * Batch upload result
233
+ */
234
+ export interface BatchResult {
235
+ /** Batch ID */
236
+ batchId: string;
237
+ /** Number of snapshots uploaded */
238
+ snapshotCount: number;
239
+ /** Upload duration in milliseconds */
240
+ duration: number;
241
+ /** Dashboard URL */
242
+ dashboardUrl?: string;
243
+ }
244
+ //# sourceMappingURL=types.d.ts.map