cbrowser 7.4.18 → 7.9.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/README.md +28 -6
- package/dist/browser.d.ts +26 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +127 -4
- package/dist/browser.js.map +1 -1
- package/dist/cli.js +136 -6
- package/dist/cli.js.map +1 -1
- package/dist/mcp-server-remote.d.ts.map +1 -1
- package/dist/mcp-server-remote.js +20 -6
- package/dist/mcp-server-remote.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +18 -4
- package/dist/mcp-server.js.map +1 -1
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/examples/ci-cd/README.md +34 -0
- package/examples/ci-cd/github-actions.yml +57 -0
- package/examples/ci-cd/gitlab-ci.yml +63 -0
- package/examples/journeys/signup-flow.json +35 -0
- package/examples/natural-language-tests/README.md +77 -0
- package/examples/natural-language-tests/auth-flow-suite.txt +47 -0
- package/examples/natural-language-tests/e-commerce-suite.txt +96 -0
- package/examples/personas/accessibility-tester.json +53 -0
- package/examples/workflows/accessibility-audit.md +151 -0
- package/examples/workflows/chaos-resilience-testing.md +151 -0
- package/examples/workflows/e2e-login-checkout.md +106 -0
- package/examples/workflows/persona-comparison-report.md +153 -0
- package/examples/workflows/visual-regression-ci.md +123 -0
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Visual Regression Testing for CI
|
|
2
|
+
|
|
3
|
+
Catch unintended visual changes before they reach production. Capture baseline screenshots, run comparisons across browsers and viewports, and surface pixel-level diffs.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- Node.js 18+
|
|
8
|
+
- CBrowser installed: `npm install -g cbrowser`
|
|
9
|
+
- Target application deployed at `https://app.example.com`
|
|
10
|
+
|
|
11
|
+
## Step 1: Capture a Baseline
|
|
12
|
+
|
|
13
|
+
Take reference screenshots of your production pages to compare future changes against.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Capture baseline screenshots of key pages
|
|
17
|
+
npx cbrowser visual-baseline "https://app.example.com" --name production
|
|
18
|
+
|
|
19
|
+
# Optionally target specific pages
|
|
20
|
+
npx cbrowser visual-baseline "https://app.example.com/dashboard" --name production-dashboard
|
|
21
|
+
npx cbrowser visual-baseline "https://app.example.com/settings" --name production-settings
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This stores timestamped screenshots in `.cbrowser/baselines/production/`.
|
|
25
|
+
|
|
26
|
+
## Step 2: Run Visual Regression
|
|
27
|
+
|
|
28
|
+
After deploying a new build to staging, compare against the baseline.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx cbrowser visual-regression "https://staging.example.com" --baseline production
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Expected Diff Output
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Visual Regression Report: staging vs production
|
|
38
|
+
Generated: 2026-02-03T14:30:00Z
|
|
39
|
+
|
|
40
|
+
Page: /
|
|
41
|
+
Similarity: 99.7% [PASS]
|
|
42
|
+
Diff pixels: 342 of 2,073,600
|
|
43
|
+
|
|
44
|
+
Page: /dashboard
|
|
45
|
+
Similarity: 94.2% [FAIL - below 98% threshold]
|
|
46
|
+
Diff pixels: 120,432 of 2,073,600
|
|
47
|
+
Changes detected:
|
|
48
|
+
- Header region: navigation bar height changed (+4px)
|
|
49
|
+
- Sidebar: new icon added to menu
|
|
50
|
+
- Chart area: color palette shifted
|
|
51
|
+
|
|
52
|
+
Page: /settings
|
|
53
|
+
Similarity: 100.0% [PASS]
|
|
54
|
+
Diff pixels: 0 of 2,073,600
|
|
55
|
+
|
|
56
|
+
Summary: 2 passed, 1 failed
|
|
57
|
+
Diff images saved to: .cbrowser/diffs/staging-vs-production/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Step 3: Cross-Browser Testing
|
|
61
|
+
|
|
62
|
+
Verify rendering consistency across browser engines.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx cbrowser cross-browser "https://app.example.com"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Cross-Browser Report: https://app.example.com
|
|
70
|
+
Browsers: Chromium 122, Firefox 123, WebKit 17.4
|
|
71
|
+
|
|
72
|
+
Chromium vs Firefox: 99.1% similar [PASS]
|
|
73
|
+
Chromium vs WebKit: 97.3% similar [WARN - minor differences]
|
|
74
|
+
- Font rendering: anti-aliasing differs in body text
|
|
75
|
+
- Box shadow: 1px offset on card components
|
|
76
|
+
Firefox vs WebKit: 97.8% similar [WARN]
|
|
77
|
+
|
|
78
|
+
All browsers functionally equivalent. Minor rendering differences noted.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Step 4: Responsive Viewport Testing
|
|
82
|
+
|
|
83
|
+
Check layouts across common device widths.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx cbrowser responsive "https://app.example.com"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Responsive Report: https://app.example.com
|
|
91
|
+
Viewports: 375px (mobile), 768px (tablet), 1024px (laptop), 1440px (desktop)
|
|
92
|
+
|
|
93
|
+
375px (mobile): Layout OK, no horizontal overflow
|
|
94
|
+
768px (tablet): Layout OK, sidebar collapses correctly
|
|
95
|
+
1024px (laptop): Layout OK, all columns visible
|
|
96
|
+
1440px (desktop): Layout OK, max-width container centered
|
|
97
|
+
|
|
98
|
+
Issues found:
|
|
99
|
+
- 375px: "Export" button text truncated to "Exp..."
|
|
100
|
+
- 768px: Table rows require horizontal scroll (expected)
|
|
101
|
+
|
|
102
|
+
Responsive score: 9.2/10
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## CI Integration
|
|
106
|
+
|
|
107
|
+
Add to your pipeline (GitHub Actions example):
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
- name: Visual Regression
|
|
111
|
+
run: |
|
|
112
|
+
npx cbrowser visual-baseline "$PROD_URL" --name production
|
|
113
|
+
npx cbrowser visual-regression "$STAGING_URL" --baseline production --ci
|
|
114
|
+
npx cbrowser cross-browser "$STAGING_URL" --ci
|
|
115
|
+
npx cbrowser responsive "$STAGING_URL" --ci
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Next Steps
|
|
119
|
+
|
|
120
|
+
- Set custom thresholds: `--threshold 95` to allow more tolerance.
|
|
121
|
+
- Exclude dynamic regions: `--ignore-regions ".timestamp,.ad-banner"`.
|
|
122
|
+
- Generate HTML reports: add `--html` to produce a shareable diff viewer.
|
|
123
|
+
- Schedule nightly baseline updates after each production deploy.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbrowser",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.9.0",
|
|
4
4
|
"description": "AI-powered browser automation with constitutional safety, AI visual regression, persona testing, and natural language test suites. Modular architecture for visual, testing, analysis, and performance modules.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|