Skip to content

Commit

Permalink
Merge branch 'master' into improve-3000-profile-picture-opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Dec 6, 2023
2 parents ccec343 + 6a388f2 commit 224046e
Show file tree
Hide file tree
Showing 318 changed files with 4,851 additions and 6,019 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
20 changes: 9 additions & 11 deletions ee/clickhouse/queries/test/test_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
from posthog.models.group.util import create_group
from posthog.models.group_type_mapping import GroupTypeMapping
from posthog.models.person import Person
from posthog.queries.test.test_lifecycle import assertLifecycleResults
from posthog.queries.test.test_lifecycle import TestLifecycleBase
from posthog.queries.trends.trends import Trends
from posthog.test.base import (
APIBaseTest,
ClickhouseTestMixin,
also_test_with_materialized_columns,
snapshot_clickhouse_queries,
)
Expand All @@ -29,7 +27,7 @@ def _create_action(**kwargs):
return action


class TestClickhouseLifecycle(ClickhouseTestMixin, APIBaseTest):
class TestClickhouseLifecycle(TestLifecycleBase):
@snapshot_clickhouse_queries
def test_test_account_filters_with_groups(self):
self.team.test_account_filters = [{"key": "key", "type": "group", "value": "value", "group_type_index": 0}]
Expand Down Expand Up @@ -98,7 +96,7 @@ def test_test_account_filters_with_groups(self):
self.team,
)

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0, -1, 0, 0, -1, 0, 0, 0]},
Expand Down Expand Up @@ -139,7 +137,7 @@ def test_lifecycle_edge_cases(self):
self.team,
)

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0, 0, 0, -1, 0, 0, -1, 0]},
Expand All @@ -156,7 +154,7 @@ def test_interval_dates_days(self):

result = self._run_lifecycle({"date_from": "-7d", "interval": "day"})

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0] * 8},
Expand Down Expand Up @@ -186,7 +184,7 @@ def test_interval_dates_weeks(self):

result = self._run_lifecycle({"date_from": "-30d", "interval": "week"})

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0] * 5},
Expand All @@ -207,7 +205,7 @@ def test_interval_dates_months(self):

result = self._run_lifecycle({"date_from": "-90d", "interval": "month"})

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0] * 4},
Expand Down Expand Up @@ -235,7 +233,7 @@ def test_lifecycle_hogql_event_properties(self):
],
}
)
assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0] * 8},
Expand Down Expand Up @@ -263,7 +261,7 @@ def test_lifecycle_hogql_person_properties(self):
}
)

assertLifecycleResults(
self.assertLifecycleResults(
result,
[
{"status": "dormant", "data": [0] * 8},
Expand Down
Loading

0 comments on commit 224046e

Please sign in to comment.