cbrowser 7.1.0 → 7.2.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.1.0 ║
17
+ ║ CBrowser CLI v7.2.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.1.0)
235
+ CROSS-BROWSER VISUAL TESTING (v7.2.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,6 +258,38 @@ CROSS-BROWSER VISUAL TESTING (v7.1.0)
258
258
  "options": { "browsers": ["chromium", "firefox"] }
259
259
  }
260
260
 
261
+ RESPONSIVE VISUAL TESTING (v7.2.0)
262
+ responsive <url> Test visual rendering across viewport sizes
263
+ --viewports <list> Viewports to test (default: mobile,tablet,desktop)
264
+ --wait <ms> Wait before screenshot (ms)
265
+ --wait-for <selector> Wait for selector before screenshot
266
+ --sensitivity <level> Comparison sensitivity: low, medium, high
267
+ --html Generate HTML report
268
+ --output <file> Save JSON report to file
269
+ Examples:
270
+ cbrowser responsive "https://example.com"
271
+ cbrowser responsive "https://example.com" --viewports mobile,tablet,desktop-lg
272
+ cbrowser responsive "https://example.com" --html --output report.html
273
+
274
+ responsive suite <file.json> Run responsive test suite
275
+ --html Generate HTML report
276
+ --output <file> Save JSON report to file
277
+
278
+ responsive viewports List available viewport presets
279
+
280
+ Suite file format:
281
+ {
282
+ "name": "My Site Responsive",
283
+ "urls": ["https://example.com", "https://example.com/about"],
284
+ "options": { "viewports": ["mobile", "tablet", "desktop"] }
285
+ }
286
+
287
+ Available viewport presets:
288
+ mobile-sm (320x568) mobile (375x667) mobile-lg (414x896)
289
+ mobile-xl (428x926) tablet (768x1024) tablet-lg (1024x1366)
290
+ desktop-sm (1280x800) desktop (1440x900) desktop-lg (1920x1080)
291
+ desktop-xl (2560x1440)
292
+
261
293
  ACCESSIBILITY (v2.5.0)
262
294
  a11y audit Run WCAG accessibility audit
263
295
  --url <url> Navigate to URL first
@@ -2142,7 +2174,7 @@ async function main() {
2142
2174
  break;
2143
2175
  }
2144
2176
  // =========================================================================
2145
- // Cross-Browser Visual Testing (v7.1.0)
2177
+ // Cross-Browser Visual Testing (v7.2.0)
2146
2178
  // =========================================================================
2147
2179
  case "cross-browser": {
2148
2180
  const subcommand = args[0];
@@ -2244,6 +2276,132 @@ async function main() {
2244
2276
  break;
2245
2277
  }
2246
2278
  // =========================================================================
2279
+ // Responsive Visual Testing (v7.2.0)
2280
+ // =========================================================================
2281
+ case "responsive": {
2282
+ const subcommand = args[0];
2283
+ if (subcommand === "viewports") {
2284
+ // List viewport presets
2285
+ const presets = (0, browser_js_1.listViewportPresets)();
2286
+ console.log("\n📱 Available Viewport Presets\n");
2287
+ console.log("─".repeat(60));
2288
+ const byType = {
2289
+ mobile: [],
2290
+ tablet: [],
2291
+ desktop: [],
2292
+ };
2293
+ for (const preset of presets) {
2294
+ byType[preset.deviceType].push(preset);
2295
+ }
2296
+ for (const [type, typePresets] of Object.entries(byType)) {
2297
+ console.log(`\n${type.toUpperCase()}:`);
2298
+ for (const p of typePresets) {
2299
+ const touch = p.hasTouch ? " (touch)" : "";
2300
+ const device = p.deviceName ? ` - ${p.deviceName}` : "";
2301
+ console.log(` ${p.name.padEnd(15)} ${p.width}x${p.height}${touch}${device}`);
2302
+ }
2303
+ }
2304
+ console.log("");
2305
+ }
2306
+ else if (subcommand === "suite") {
2307
+ // Responsive suite
2308
+ const suiteFile = args[1];
2309
+ if (!suiteFile) {
2310
+ console.error("Usage: cbrowser responsive suite <file.json> [options]");
2311
+ console.error(" --html Generate HTML report");
2312
+ console.error(" --output <file> Save report to file");
2313
+ process.exit(1);
2314
+ }
2315
+ const fs = await import("fs");
2316
+ if (!fs.existsSync(suiteFile)) {
2317
+ console.error(`Suite file not found: ${suiteFile}`);
2318
+ process.exit(1);
2319
+ }
2320
+ const suite = JSON.parse(fs.readFileSync(suiteFile, "utf-8"));
2321
+ const result = await (0, browser_js_1.runResponsiveSuite)(suite);
2322
+ // Save outputs
2323
+ if (options.output && !options.html) {
2324
+ fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
2325
+ console.log(`\n📄 JSON report saved to: ${options.output}`);
2326
+ }
2327
+ if (options.html) {
2328
+ const htmlReport = (0, browser_js_1.generateResponsiveHtmlReport)(result);
2329
+ const outputPath = options.output || `responsive-${Date.now()}.html`;
2330
+ fs.writeFileSync(outputPath, htmlReport);
2331
+ console.log(`\n📄 HTML report saved to: ${outputPath}`);
2332
+ }
2333
+ // Summary
2334
+ console.log(`\n${"═".repeat(60)}`);
2335
+ console.log(` Results: ${result.summary.responsive} responsive, ${result.summary.minorIssues} minor, ${result.summary.majorIssues} major`);
2336
+ console.log(` Total issues: ${result.summary.totalIssues}`);
2337
+ console.log(`${"═".repeat(60)}\n`);
2338
+ if (result.summary.majorIssues > 0) {
2339
+ process.exit(1);
2340
+ }
2341
+ }
2342
+ else {
2343
+ // Single URL test
2344
+ const url = subcommand; // First arg is the URL
2345
+ if (!url || url.startsWith("--")) {
2346
+ console.error("Usage: cbrowser responsive <url> [options]");
2347
+ console.error(" cbrowser responsive suite <file.json>");
2348
+ console.error(" cbrowser responsive viewports");
2349
+ console.error("\nOptions:");
2350
+ console.error(" --viewports <list> mobile,tablet,desktop (default: mobile,tablet,desktop)");
2351
+ console.error(" --wait <ms> Wait before screenshot");
2352
+ console.error(" --wait-for <sel> Wait for selector");
2353
+ console.error(" --sensitivity <l> low, medium, high");
2354
+ console.error(" --html Generate HTML report");
2355
+ console.error(" --output <file> Save report");
2356
+ console.error("\nViewport presets: mobile-sm, mobile, mobile-lg, mobile-xl,");
2357
+ console.error(" tablet, tablet-lg, desktop-sm, desktop,");
2358
+ console.error(" desktop-lg, desktop-xl");
2359
+ process.exit(1);
2360
+ }
2361
+ const viewports = options.viewports
2362
+ ? options.viewports.split(",")
2363
+ : undefined;
2364
+ const result = await (0, browser_js_1.runResponsiveTest)(url, {
2365
+ viewports,
2366
+ waitBeforeCapture: options.wait ? parseInt(options.wait) : undefined,
2367
+ waitForSelector: options["wait-for"],
2368
+ sensitivity: options.sensitivity,
2369
+ });
2370
+ // Print report
2371
+ console.log("\n" + (0, browser_js_1.formatResponsiveReport)(result));
2372
+ // Save outputs
2373
+ const fs = await import("fs");
2374
+ if (options.output && !options.html) {
2375
+ fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
2376
+ console.log(`\n📄 JSON report saved to: ${options.output}`);
2377
+ }
2378
+ if (options.html) {
2379
+ const suiteResult = {
2380
+ suite: { name: "Single URL Test", urls: [url] },
2381
+ results: [result],
2382
+ summary: {
2383
+ total: 1,
2384
+ responsive: result.overallStatus === "responsive" ? 1 : 0,
2385
+ minorIssues: result.overallStatus === "minor_issues" ? 1 : 0,
2386
+ majorIssues: result.overallStatus === "major_issues" ? 1 : 0,
2387
+ totalIssues: result.issues.length,
2388
+ },
2389
+ commonIssues: result.issues,
2390
+ duration: result.duration,
2391
+ timestamp: result.timestamp,
2392
+ };
2393
+ const htmlReport = (0, browser_js_1.generateResponsiveHtmlReport)(suiteResult);
2394
+ const outputPath = options.output || `responsive-${Date.now()}.html`;
2395
+ fs.writeFileSync(outputPath, htmlReport);
2396
+ console.log(`\n📄 HTML report saved to: ${outputPath}`);
2397
+ }
2398
+ if (result.overallStatus === "major_issues") {
2399
+ process.exit(1);
2400
+ }
2401
+ }
2402
+ break;
2403
+ }
2404
+ // =========================================================================
2247
2405
  // Accessibility (Tier 2)
2248
2406
  // =========================================================================
2249
2407
  case "a11y": {