Skip to content

Commit

Permalink
cypress leaving too quickly
Browse files Browse the repository at this point in the history
  • Loading branch information
liyiy committed Jan 30, 2024
1 parent eefa9c6 commit 35d4847
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cypress/e2e/surveys.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,12 @@ describe('Surveys', () => {
// first capture is $pageview
cy.wait('@capture-assertion')
cy.get('.PostHogSurvey123').shadow().find('.cancel-btn-wrapper').click()
cy.wait(500)
cy.wait('@capture-assertion').then(async ({ request }) => {
const captures = await getBase64EncodedPayload(request)
expect(captures.map(({ event }) => event)).to.deep.equal([
// 'survey shown',
// 'survey dismissed',
'survey shown',
'survey dismissed',
'$pageleave',
])
})
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/surveys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export function Surveys({ posthog, survey, style }: { posthog: PostHog; survey:
localStorage.setItem(`lastSeenSurveyDate`, new Date().toISOString())

window.addEventListener('PHSurveyClosed', () => {
localStorage.setItem(`seenSurvey_${survey.id}`, 'true')
posthog.capture('survey dismissed', {
$survey_name: survey.name,
$survey_id: survey.id,
Expand All @@ -240,6 +239,7 @@ export function Surveys({ posthog, survey, style }: { posthog: PostHog; survey:
},
})
setShowSurveyQuestion(false)
localStorage.setItem(`seenSurvey_${survey.id}`, 'true')
})

window.addEventListener('PHSurveySent', () => {
Expand Down

0 comments on commit 35d4847

Please sign in to comment.