Skip to content

Commit

Permalink
chore: add clarifying test (#1246)
Browse files Browse the repository at this point in the history
* chore: add clarifying test

* but not distracted by my sandwich

* ignore new cypress file
  • Loading branch information
pauldambra committed Jun 14, 2024
1 parent b0e1140 commit b4b0050
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ test-result.json
yarn-error.log
stats.html
.eslintcache
cypress/downloads/downloads.html
33 changes: 33 additions & 0 deletions cypress/e2e/opting-out.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,39 @@ describe('opting out', () => {
pollPhCaptures('$snapshot').then(assertThatRecordingStarted)
})

it('can start recording when starting disabled', () => {
cy.posthogInit({ disable_session_recording: true })

assertWhetherPostHogRequestsWereCalled({
'@recorder': false,
'@decide': true,
'@session-recording': false,
})

cy.get('[data-cy-input]')
.type('hello posthog!')
.then(() => {
cy.phCaptures().then((captures) => {
expect(captures || []).to.deep.equal(['$pageview'])
})
})

cy.resetPhCaptures()
cy.posthog().invoke('startSessionRecording')

assertWhetherPostHogRequestsWereCalled({
'@recorder': true,
'@decide': true,
// no call to session-recording yet
})

cy.get('[data-cy-input]')
.type('hello posthog!')
.then(() => {
pollPhCaptures('$snapshot').then(assertThatRecordingStarted)
})
})

it('can override sampling when starting session recording', () => {
cy.intercept('POST', '/decide/*', {
autocapture_opt_out: true,
Expand Down

0 comments on commit b4b0050

Please sign in to comment.