Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/client/src/feedback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,34 @@ describe('feedback overlay', () => {
expect(pushSpy.mock.calls[0]?.[2]).not.toHaveProperty('url')
})

it('shows a context-first status when screenshot support is disabled in config', async () => {
initFeedback(
resolveConfig({
endpoint: '/api/test-feedback',
feedback: {
enabled: true,
annotations: false,
allowScreenshotToggle: false,
allowContextToggle: true,
defaultIncludeScreenshot: false,
defaultIncludeContext: true,
},
}),
)

const target = createTarget()

showFeedbackDialog(target, 120, 80)
await flushUi()

const status = document.getElementById('__sf_status') as HTMLDivElement
const detailsToggle = document.getElementById('__sf_details_toggle') as HTMLButtonElement

expect(status.textContent).toBe('Page context will be attached to this report.')
expect(detailsToggle.textContent).toContain('Context on')
expect(detailsToggle.textContent).not.toContain('Screenshot')
})

it('expands and collapses the details disclosure', async () => {
const target = createTarget()

Expand Down
8 changes: 7 additions & 1 deletion packages/client/src/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,13 @@ export function showFeedbackDialog(
}

if (!snapshot.includeScreenshot) {
updateStatus('Screenshot will be skipped for this report.')
updateStatus(
screenshotControlVisible
? 'Screenshot will be skipped for this report.'
: snapshot.includeContext
? 'Page context will be attached to this report.'
: '',
)
schedulePosition()
return
}
Expand Down