cbrowser 7.2.0 → 7.3.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/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ const daemon_js_1 = require("./daemon.js");
14
14
  function showHelp() {
15
15
  console.log(`
16
16
  ╔══════════════════════════════════════════════════════════════════════════════╗
17
- ║ CBrowser CLI v7.2.0 ║
17
+ ║ CBrowser CLI v7.3.0 ║
18
18
  ║ AI-powered browser automation with cross-browser visual testing ║
19
19
  ╚══════════════════════════════════════════════════════════════════════════════╝
20
20
 
@@ -232,7 +232,7 @@ AI VISUAL REGRESSION (v7.0.0)
232
232
  ai-visual show <name> Show baseline details
233
233
  ai-visual delete <name> Delete a baseline
234
234
 
235
- CROSS-BROWSER VISUAL TESTING (v7.2.0)
235
+ CROSS-BROWSER VISUAL TESTING (v7.3.0)
236
236
  cross-browser <url> Compare visual rendering across browsers
237
237
  --browsers <list> Browsers to test: chromium,firefox,webkit (default: all)
238
238
  --width <n> Viewport width (default: 1920)
@@ -258,7 +258,7 @@ CROSS-BROWSER VISUAL TESTING (v7.2.0)
258
258
  "options": { "browsers": ["chromium", "firefox"] }
259
259
  }
260
260
 
261
- RESPONSIVE VISUAL TESTING (v7.2.0)
261
+ RESPONSIVE VISUAL TESTING (v7.3.0)
262
262
  responsive <url> Test visual rendering across viewport sizes
263
263
  --viewports <list> Viewports to test (default: mobile,tablet,desktop)
264
264
  --wait <ms> Wait before screenshot (ms)
@@ -290,6 +290,36 @@ RESPONSIVE VISUAL TESTING (v7.2.0)
290
290
  desktop-sm (1280x800) desktop (1440x900) desktop-lg (1920x1080)
291
291
  desktop-xl (2560x1440)
292
292
 
293
+ A/B VISUAL COMPARISON (v7.3.0)
294
+ ab <urlA> <urlB> Compare two URLs visually
295
+ --label-a <name> Label for URL A (default: "Version A")
296
+ --label-b <name> Label for URL B (default: "Version B")
297
+ --width <n> Viewport width (default: 1920)
298
+ --height <n> Viewport height (default: 1080)
299
+ --wait <ms> Wait before screenshot (ms)
300
+ --wait-for <selector> Wait for selector before screenshot
301
+ --sensitivity <level> Comparison sensitivity: low, medium, high
302
+ --html Generate HTML report
303
+ --output <file> Save JSON report to file
304
+ Examples:
305
+ cbrowser ab "https://staging.example.com" "https://example.com"
306
+ cbrowser ab "https://old.site.com" "https://new.site.com" --label-a "Old Design" --label-b "New Design"
307
+ cbrowser ab "https://site-a.com" "https://site-b.com" --html --output comparison.html
308
+
309
+ ab suite <file.json> Run A/B comparison suite
310
+ --html Generate HTML report
311
+ --output <file> Save JSON report to file
312
+
313
+ Suite file format:
314
+ {
315
+ "name": "Staging vs Production",
316
+ "pairs": [
317
+ { "urlA": "https://staging.example.com", "urlB": "https://example.com", "name": "Homepage" },
318
+ { "urlA": "https://staging.example.com/about", "urlB": "https://example.com/about", "name": "About" }
319
+ ],
320
+ "options": { "sensitivity": "medium" }
321
+ }
322
+
293
323
  ACCESSIBILITY (v2.5.0)
294
324
  a11y audit Run WCAG accessibility audit
295
325
  --url <url> Navigate to URL first
@@ -2174,7 +2204,7 @@ async function main() {
2174
2204
  break;
2175
2205
  }
2176
2206
  // =========================================================================
2177
- // Cross-Browser Visual Testing (v7.2.0)
2207
+ // Cross-Browser Visual Testing (v7.3.0)
2178
2208
  // =========================================================================
2179
2209
  case "cross-browser": {
2180
2210
  const subcommand = args[0];
@@ -2276,7 +2306,7 @@ async function main() {
2276
2306
  break;
2277
2307
  }
2278
2308
  // =========================================================================
2279
- // Responsive Visual Testing (v7.2.0)
2309
+ // Responsive Visual Testing (v7.3.0)
2280
2310
  // =========================================================================
2281
2311
  case "responsive": {
2282
2312
  const subcommand = args[0];
@@ -2402,6 +2432,111 @@ async function main() {
2402
2432
  break;
2403
2433
  }
2404
2434
  // =========================================================================
2435
+ // A/B Visual Comparison (v7.3.0)
2436
+ // =========================================================================
2437
+ case "ab": {
2438
+ const subcommand = args[0];
2439
+ if (subcommand === "suite") {
2440
+ // A/B suite
2441
+ const suiteFile = args[1];
2442
+ if (!suiteFile) {
2443
+ console.error("Usage: cbrowser ab suite <file.json> [options]");
2444
+ console.error(" --html Generate HTML report");
2445
+ console.error(" --output <file> Save report to file");
2446
+ process.exit(1);
2447
+ }
2448
+ const fs = await import("fs");
2449
+ if (!fs.existsSync(suiteFile)) {
2450
+ console.error(`Suite file not found: ${suiteFile}`);
2451
+ process.exit(1);
2452
+ }
2453
+ const suite = JSON.parse(fs.readFileSync(suiteFile, "utf-8"));
2454
+ const result = await (0, browser_js_1.runABSuite)(suite);
2455
+ // Save outputs
2456
+ if (options.output && !options.html) {
2457
+ fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
2458
+ console.log(`\n📄 JSON report saved to: ${options.output}`);
2459
+ }
2460
+ if (options.html) {
2461
+ const htmlReport = (0, browser_js_1.generateABHtmlReport)(result);
2462
+ const outputPath = options.output || `ab-comparison-${Date.now()}.html`;
2463
+ fs.writeFileSync(outputPath, htmlReport);
2464
+ console.log(`\n📄 HTML report saved to: ${outputPath}`);
2465
+ }
2466
+ // Summary
2467
+ console.log(`\n${"═".repeat(60)}`);
2468
+ console.log(` Results: ${result.summary.identical} identical, ${result.summary.similar} similar, ${result.summary.different} different, ${result.summary.veryDifferent} very different`);
2469
+ console.log(`${"═".repeat(60)}\n`);
2470
+ if (result.summary.veryDifferent > 0) {
2471
+ process.exit(1);
2472
+ }
2473
+ }
2474
+ else {
2475
+ // Single A/B comparison: ab <urlA> <urlB>
2476
+ const urlA = args[0];
2477
+ const urlB = args[1];
2478
+ if (!urlA || !urlB || urlA.startsWith("--") || urlB.startsWith("--")) {
2479
+ console.error("Usage: cbrowser ab <urlA> <urlB> [options]");
2480
+ console.error(" cbrowser ab suite <file.json>");
2481
+ console.error("\nOptions:");
2482
+ console.error(" --label-a <name> Label for URL A (default: 'Version A')");
2483
+ console.error(" --label-b <name> Label for URL B (default: 'Version B')");
2484
+ console.error(" --width <n> Viewport width (default: 1920)");
2485
+ console.error(" --height <n> Viewport height (default: 1080)");
2486
+ console.error(" --wait <ms> Wait before screenshot");
2487
+ console.error(" --wait-for <sel> Wait for selector");
2488
+ console.error(" --sensitivity <l> low, medium, high");
2489
+ console.error(" --html Generate HTML report");
2490
+ console.error(" --output <file> Save report");
2491
+ process.exit(1);
2492
+ }
2493
+ const result = await (0, browser_js_1.runABComparison)(urlA, urlB, {
2494
+ labels: options["label-a"] || options["label-b"] ? {
2495
+ a: options["label-a"] || "Version A",
2496
+ b: options["label-b"] || "Version B",
2497
+ } : undefined,
2498
+ viewport: options.width || options.height ? {
2499
+ width: parseInt(options.width) || 1920,
2500
+ height: parseInt(options.height) || 1080,
2501
+ } : undefined,
2502
+ waitBeforeCapture: options.wait ? parseInt(options.wait) : undefined,
2503
+ waitForSelector: options["wait-for"],
2504
+ sensitivity: options.sensitivity,
2505
+ });
2506
+ // Print report
2507
+ console.log("\n" + (0, browser_js_1.formatABReport)(result));
2508
+ // Save outputs
2509
+ const fs = await import("fs");
2510
+ if (options.output && !options.html) {
2511
+ fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
2512
+ console.log(`\n📄 JSON report saved to: ${options.output}`);
2513
+ }
2514
+ if (options.html) {
2515
+ const suiteResult = {
2516
+ suite: { name: "Single Comparison", pairs: [{ urlA, urlB }] },
2517
+ results: [result],
2518
+ summary: {
2519
+ total: 1,
2520
+ identical: result.overallStatus === "identical" ? 1 : 0,
2521
+ similar: result.overallStatus === "similar" ? 1 : 0,
2522
+ different: result.overallStatus === "different" ? 1 : 0,
2523
+ veryDifferent: result.overallStatus === "very_different" ? 1 : 0,
2524
+ },
2525
+ duration: result.duration,
2526
+ timestamp: result.timestamp,
2527
+ };
2528
+ const htmlReport = (0, browser_js_1.generateABHtmlReport)(suiteResult);
2529
+ const outputPath = options.output || `ab-comparison-${Date.now()}.html`;
2530
+ fs.writeFileSync(outputPath, htmlReport);
2531
+ console.log(`\n📄 HTML report saved to: ${outputPath}`);
2532
+ }
2533
+ if (result.overallStatus === "very_different") {
2534
+ process.exit(1);
2535
+ }
2536
+ }
2537
+ break;
2538
+ }
2539
+ // =========================================================================
2405
2540
  // Accessibility (Tier 2)
2406
2541
  // =========================================================================
2407
2542
  case "a11y": {