✨ Capture page URL in all JS client SDKs#220
Conversation
Send the current page URL as a screenshot property so the backend can link screenshots to deploy preview pages. Each client captures it in the idiomatic way for its runtime: - Static Site: page.url() via Playwright - Storybook: page.url() via Playwright - Vitest: page.url() via browser context - Ember: window.location.href in browser
This comment has been minimized.
This comment has been minimized.
Code Review: PR #220SummaryThis PR adds ✅ Strengths1. Consistent Implementation
2. Test Coverage 3. Proper Placement 🔍 Suggestions & Considerations1. Missing Test Verification (Medium Priority) // clients/static-site/tests/screenshot.test.js or sdk-integration.test.js
it('should include page URL in properties', async () => {
let mockPage = {
url: () => 'https://example.com/test-page',
screenshot: mock.fn(() => Buffer.from('fake'))
};
// ... verify vizzlyScreenshot was called with properties.url
});2. Ruby & Swift Clients (Question) 3. Ember Client URL Format (Minor)
This is likely fine, but worth noting if the backend expects consistent URL formats. 4. Error Handling (Low Priority) properties.url = page.url?.() ?? 'unknown';This protects against edge cases where 5. Documentation (Low Priority)
🔒 Security & PerformanceSecurity: ✅ No concerns. URLs are from trusted sources (test runtime). Performance: ✅ Negligible impact. 📋 Test Plan FeedbackThe PR's test plan shows:
Recommendation: Before merging, verify on staging that the 🎯 Overall AssessmentQuality: High - clean, consistent implementation across all clients The core implementation is solid. Consider addressing the test verification and potentially extending to non-JS clients for completeness, but neither is a blocker for merging. |
Vitest browser mode's page object doesn't have a url() method — it's not Playwright's page. Use window.location.href since the setup runs in browser context, same as the Ember client.
This comment has been minimized.
This comment has been minimized.
These tests duplicate what the E2E tests already cover (full flow with real browser, real testem, real screenshots) but with fragile manual wiring—polling loops, setTimeout fallbacks, and brittle setup that breaks in CI. The unit tests + E2E tests provide better coverage with less maintenance burden.
Vizzly - Visual Test ResultsCLI Reporter - 1 change needs review
|
## Summary
- The client SDK was sending the entire `options` object as
`properties`, causing double-nesting when SDKs passed `{ properties: {
url } }` — the server received `properties: { properties: { url } }`
making `url` unreachable
- Now destructures SDK-internal options (`fullPage`, `threshold`) out
and flattens `options.properties` into the top-level properties object
- Adds tests verifying properties flattening and that SDK options don't
leak into properties
- Closes #221 — this fixes the root cause instead of patching around it
server-side
## Context
After the URL capture change (#220), Storybook and Static Site SDKs
passed `{ properties: { url: page.url() } }` to `vizzlyScreenshot()`.
The client blindly forwarded the whole options object as `properties`,
double-nesting the data. A server-side fallback
(`properties.properties?.url`) was deployed as a stopgap — this fix
makes that fallback unnecessary.
## Test plan
- [x] `npm test` — 1894 pass, 0 fail
- [x] `npm run lint` — clean
- [x] New test: verifies `{ properties: { url } }` flattens to `{ url }`
in the payload
- [x] New test: verifies `fullPage` and `threshold` are excluded from
properties
- [x] Existing integration tests still pass (no breaking changes)

Summary
Sends the current page URL as a
urlproperty when capturing screenshots. This enables the backend to link individual screenshots to their corresponding deploy preview pages (preview-to-screenshot integration).properties.url = page.url()— Playwright page available incaptureAndSendScreenshot{ properties: { url: page.url() } }passed tovizzlyScreenshot— was previously sending no propertiesurl: page.url()added to the properties object built intoMatchScreenshoturl: window.location.hrefadded to browser-side properties payload — screenshot server forwards as-isAll placed before the user's
...customPropertiesspread so users can override if needed.Test plan
npm test— 1892 pass, 0 failnpm run lint— cleanurl()methodurlappears in screenshot records via Vizzly dashboard