Skip to content

Commit

Permalink
Merge branch 'master' into welcome-pane-artwork
Browse files Browse the repository at this point in the history
  • Loading branch information
corywatilo authored Dec 5, 2023
2 parents 4284982 + e5e803a commit 6d44210
Show file tree
Hide file tree
Showing 9 changed files with 497 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
DISABLE_SECURE_SSL_REDIRECT=1
SECURE_COOKIES=0
OPT_OUT_CAPTURE=0
SELF_CAPTURE=0
SELF_CAPTURE=1
E2E_TESTING=1
SKIP_SERVICE_VERSION_REQUIREMENTS=1
EMAIL_HOST=email.test.posthog.net
Expand Down
19 changes: 19 additions & 0 deletions cypress/e2e/billingv2.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import * as fflate from 'fflate'

const UNSUBSCRIBE_SURVEY_ID = '018b6e13-590c-0000-decb-c727a2b3f462'

describe('Billing', () => {
beforeEach(() => {
cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2.json' })

cy.visit('/organization/billing')

cy.intercept('POST', '**/e/?compression=gzip-js*').as('capture')
})

it('Show and submit unsubscribe survey', () => {
Expand All @@ -19,6 +25,19 @@ describe('Billing', () => {
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').type('Product analytics')
cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click()

cy.wait('@capture').then(({ request }) => {
const data = new Uint8Array(request.body)
const decoded = fflate.strFromU8(fflate.decompressSync(data))
const decodedJSON = JSON.parse(decoded)

// These should be a 'survey sent' event somewhere in the decodedJSON
const matchingEvents = decodedJSON.filter((event) => event.event === 'survey sent')
expect(matchingEvents.length).to.equal(1)
const matchingEvent = matchingEvents[0]
expect(matchingEvent.properties.$survey_id).to.equal(UNSUBSCRIBE_SURVEY_ID)
expect(matchingEvent.properties.$survey_response).to.equal('Product analytics')
expect(matchingEvent.properties.$survey_response_1).to.equal('product_analytics')
})
cy.get('.LemonModal').should('not.exist')
cy.wait(['@unsubscribeProductAnalytics'])
})
Expand Down
2 changes: 1 addition & 1 deletion latest_migrations.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contenttypes: 0002_remove_content_type_name
ee: 0015_add_verified_properties
otp_static: 0002_throttling
otp_totp: 0002_auto_20190420_0723
posthog: 0370_externaldatajob_workflow_id
posthog: 0371_pendingpersonoverride
sessions: 0001_initial
social_django: 0010_uid_db_index
two_factor: 0007_auto_20201201_1019
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Person } from 'types'

import { normalizeEvent } from '../../../utils/event'
import { status } from '../../../utils/status'
import { PersonState } from '../person-state'
import { PersonOverrideWriter, PersonState } from '../person-state'
import { parseEventTimestamp } from '../timestamps'
import { EventPipelineRunner } from './runner'

Expand All @@ -28,7 +28,7 @@ export async function processPersonsStep(
String(event.distinct_id),
timestamp,
runner.hub.db,
runner.poEEmbraceJoin
runner.poEEmbraceJoin ? new PersonOverrideWriter(runner.hub.db.postgres) : undefined
).update()

return [event, person]
Expand Down
Loading

0 comments on commit 6d44210

Please sign in to comment.