Skip to content

Commit

Permalink
Add logging for test browser userAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack committed Sep 24, 2024
1 parent c3a972c commit 84aa018
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ export const snapshotSchema = {
type: 'array',
items: { type: 'string' }
},
cookies: { type: 'string' },
cookies: { oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }] },
userAgent: { type: 'string' },
width: { $ref: '/config/snapshot#/properties/widths/items' },
resources: {
type: 'array',
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ function debugSnapshotOptions(snapshot) {
debugProp(snapshot, 'clientInfo');
debugProp(snapshot, 'environmentInfo');
debugProp(snapshot, 'domSnapshot', Boolean);
if (snapshot.responsiveSnapshotCapture) {
debugProp(snapshot, 'domSnapshot.0.userAgent');
} else {
debugProp(snapshot, 'domSnapshot.userAgent');
}

for (let added of (snapshot.additionalSnapshots || [])) {
log.debug(`Additional snapshot: ${added.name}`, snapshot.meta);
Expand Down
1 change: 1 addition & 0 deletions packages/dom/src/serialize-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export function serializeDOM(options) {
let result = {
html: serializeHTML(ctx),
cookies: cookies,
userAgent: navigator.userAgent,
warnings: Array.from(ctx.warnings),
resources: Array.from(ctx.resources),
hints: Array.from(ctx.hints)
Expand Down

0 comments on commit 84aa018

Please sign in to comment.