cbrowser 7.0.0 → 7.1.1
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/browser.d.ts +17 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +418 -23
- package/dist/browser.js.map +1 -1
- package/dist/cli.js +130 -2
- package/dist/cli.js.map +1 -1
- package/dist/types.d.ts +91 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,8 @@ const daemon_js_1 = require("./daemon.js");
|
|
|
14
14
|
function showHelp() {
|
|
15
15
|
console.log(`
|
|
16
16
|
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
17
|
-
║ CBrowser CLI v7.
|
|
18
|
-
║ AI-powered browser automation with
|
|
17
|
+
║ CBrowser CLI v7.1.1 ║
|
|
18
|
+
║ AI-powered browser automation with cross-browser visual testing ║
|
|
19
19
|
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
20
20
|
|
|
21
21
|
NAVIGATION
|
|
@@ -232,6 +232,32 @@ 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.1)
|
|
236
|
+
cross-browser <url> Compare visual rendering across browsers
|
|
237
|
+
--browsers <list> Browsers to test: chromium,firefox,webkit (default: all)
|
|
238
|
+
--width <n> Viewport width (default: 1920)
|
|
239
|
+
--height <n> Viewport height (default: 1080)
|
|
240
|
+
--wait <ms> Wait before screenshot (ms)
|
|
241
|
+
--wait-for <selector> Wait for selector before screenshot
|
|
242
|
+
--sensitivity <level> Comparison sensitivity: low, medium, high
|
|
243
|
+
--html Generate HTML report
|
|
244
|
+
--output <file> Save JSON report to file
|
|
245
|
+
Examples:
|
|
246
|
+
cbrowser cross-browser "https://example.com"
|
|
247
|
+
cbrowser cross-browser "https://example.com" --browsers chromium,firefox
|
|
248
|
+
cbrowser cross-browser "https://example.com" --html --output report.html
|
|
249
|
+
|
|
250
|
+
cross-browser suite <file.json> Run cross-browser test suite
|
|
251
|
+
--html Generate HTML report
|
|
252
|
+
--output <file> Save JSON report to file
|
|
253
|
+
|
|
254
|
+
Suite file format:
|
|
255
|
+
{
|
|
256
|
+
"name": "My Site",
|
|
257
|
+
"urls": ["https://example.com", "https://example.com/about"],
|
|
258
|
+
"options": { "browsers": ["chromium", "firefox"] }
|
|
259
|
+
}
|
|
260
|
+
|
|
235
261
|
ACCESSIBILITY (v2.5.0)
|
|
236
262
|
a11y audit Run WCAG accessibility audit
|
|
237
263
|
--url <url> Navigate to URL first
|
|
@@ -2116,6 +2142,108 @@ async function main() {
|
|
|
2116
2142
|
break;
|
|
2117
2143
|
}
|
|
2118
2144
|
// =========================================================================
|
|
2145
|
+
// Cross-Browser Visual Testing (v7.1.1)
|
|
2146
|
+
// =========================================================================
|
|
2147
|
+
case "cross-browser": {
|
|
2148
|
+
const subcommand = args[0];
|
|
2149
|
+
if (subcommand === "suite") {
|
|
2150
|
+
// Cross-browser suite
|
|
2151
|
+
const suiteFile = args[1];
|
|
2152
|
+
if (!suiteFile) {
|
|
2153
|
+
console.error("Usage: cbrowser cross-browser suite <file.json> [options]");
|
|
2154
|
+
console.error(" --html Generate HTML report");
|
|
2155
|
+
console.error(" --output <file> Save report to file");
|
|
2156
|
+
process.exit(1);
|
|
2157
|
+
}
|
|
2158
|
+
const fs = await import("fs");
|
|
2159
|
+
if (!fs.existsSync(suiteFile)) {
|
|
2160
|
+
console.error(`Suite file not found: ${suiteFile}`);
|
|
2161
|
+
process.exit(1);
|
|
2162
|
+
}
|
|
2163
|
+
const suite = JSON.parse(fs.readFileSync(suiteFile, "utf-8"));
|
|
2164
|
+
const result = await (0, browser_js_1.runCrossBrowserSuite)(suite);
|
|
2165
|
+
// Save outputs
|
|
2166
|
+
if (options.output && !options.html) {
|
|
2167
|
+
fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
|
|
2168
|
+
console.log(`\n📄 JSON report saved to: ${options.output}`);
|
|
2169
|
+
}
|
|
2170
|
+
if (options.html) {
|
|
2171
|
+
const htmlReport = (0, browser_js_1.generateCrossBrowserHtmlReport)(result);
|
|
2172
|
+
const outputPath = options.output || `cross-browser-${Date.now()}.html`;
|
|
2173
|
+
fs.writeFileSync(outputPath, htmlReport);
|
|
2174
|
+
console.log(`\n📄 HTML report saved to: ${outputPath}`);
|
|
2175
|
+
}
|
|
2176
|
+
// Summary
|
|
2177
|
+
console.log(`\n${"═".repeat(60)}`);
|
|
2178
|
+
console.log(` Results: ${result.summary.consistent} consistent, ${result.summary.minorDifferences} minor, ${result.summary.majorDifferences} major`);
|
|
2179
|
+
console.log(`${"═".repeat(60)}\n`);
|
|
2180
|
+
if (result.summary.majorDifferences > 0) {
|
|
2181
|
+
process.exit(1);
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
else {
|
|
2185
|
+
// Single URL test
|
|
2186
|
+
const url = subcommand; // First arg is the URL
|
|
2187
|
+
if (!url || url.startsWith("--")) {
|
|
2188
|
+
console.error("Usage: cbrowser cross-browser <url> [options]");
|
|
2189
|
+
console.error(" cbrowser cross-browser suite <file.json>");
|
|
2190
|
+
console.error("\nOptions:");
|
|
2191
|
+
console.error(" --browsers <list> chromium,firefox,webkit (default: all)");
|
|
2192
|
+
console.error(" --width <n> Viewport width (default: 1920)");
|
|
2193
|
+
console.error(" --height <n> Viewport height (default: 1080)");
|
|
2194
|
+
console.error(" --wait <ms> Wait before screenshot");
|
|
2195
|
+
console.error(" --wait-for <sel> Wait for selector");
|
|
2196
|
+
console.error(" --sensitivity <l> low, medium, high");
|
|
2197
|
+
console.error(" --html Generate HTML report");
|
|
2198
|
+
console.error(" --output <file> Save report");
|
|
2199
|
+
process.exit(1);
|
|
2200
|
+
}
|
|
2201
|
+
const browsers = options.browsers
|
|
2202
|
+
? options.browsers.split(",")
|
|
2203
|
+
: undefined;
|
|
2204
|
+
const result = await (0, browser_js_1.runCrossBrowserTest)(url, {
|
|
2205
|
+
browsers,
|
|
2206
|
+
viewport: options.width || options.height ? {
|
|
2207
|
+
width: parseInt(options.width) || 1920,
|
|
2208
|
+
height: parseInt(options.height) || 1080,
|
|
2209
|
+
} : undefined,
|
|
2210
|
+
waitBeforeCapture: options.wait ? parseInt(options.wait) : undefined,
|
|
2211
|
+
waitForSelector: options["wait-for"],
|
|
2212
|
+
sensitivity: options.sensitivity,
|
|
2213
|
+
});
|
|
2214
|
+
// Print report
|
|
2215
|
+
console.log("\n" + (0, browser_js_1.formatCrossBrowserReport)(result));
|
|
2216
|
+
// Save outputs
|
|
2217
|
+
const fs = await import("fs");
|
|
2218
|
+
if (options.output && !options.html) {
|
|
2219
|
+
fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
|
|
2220
|
+
console.log(`\n📄 JSON report saved to: ${options.output}`);
|
|
2221
|
+
}
|
|
2222
|
+
if (options.html) {
|
|
2223
|
+
const suiteResult = {
|
|
2224
|
+
suite: { name: "Single URL Test", urls: [url] },
|
|
2225
|
+
results: [result],
|
|
2226
|
+
summary: {
|
|
2227
|
+
total: 1,
|
|
2228
|
+
consistent: result.overallStatus === "consistent" ? 1 : 0,
|
|
2229
|
+
minorDifferences: result.overallStatus === "minor_differences" ? 1 : 0,
|
|
2230
|
+
majorDifferences: result.overallStatus === "major_differences" ? 1 : 0,
|
|
2231
|
+
},
|
|
2232
|
+
duration: result.duration,
|
|
2233
|
+
timestamp: result.timestamp,
|
|
2234
|
+
};
|
|
2235
|
+
const htmlReport = (0, browser_js_1.generateCrossBrowserHtmlReport)(suiteResult);
|
|
2236
|
+
const outputPath = options.output || `cross-browser-${Date.now()}.html`;
|
|
2237
|
+
fs.writeFileSync(outputPath, htmlReport);
|
|
2238
|
+
console.log(`\n📄 HTML report saved to: ${outputPath}`);
|
|
2239
|
+
}
|
|
2240
|
+
if (result.overallStatus === "major_differences") {
|
|
2241
|
+
process.exit(1);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
break;
|
|
2245
|
+
}
|
|
2246
|
+
// =========================================================================
|
|
2119
2247
|
// Accessibility (Tier 2)
|
|
2120
2248
|
// =========================================================================
|
|
2121
2249
|
case "a11y": {
|