Skip to content

Commit

Permalink
Merge branch 'master' into tom/trends-actor-query-breakdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbert09 authored Jan 26, 2024
2 parents 3f26c17 + 859b2bd commit 3c36abb
Show file tree
Hide file tree
Showing 190 changed files with 4,894 additions and 2,167 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ module.exports = {
},
{
name: 'antd',
importNames: ['Card', 'Col', 'Row', 'Alert', 'Tooltip'],
importNames: ['Card', 'Col', 'Row', 'Alert', 'Tooltip', 'Progress'],
message: 'please use the Lemon equivalent instead',
},
],
Expand Down Expand Up @@ -169,6 +169,10 @@ module.exports = {
element: 'LemonButtonWithDropdown',
message: 'use <LemonMenu> with a <LemonButton> child instead',
},
{
element: 'Progress',
message: 'use <LemonProgress> instead',
},
],
},
],
Expand Down Expand Up @@ -204,6 +208,10 @@ module.exports = {
element: 'Collapse',
message: 'use <LemonCollapse> instead',
},
{
element: 'Slider',
message: 'use <LemonSlider> instead',
},
{
element: 'Checkbox',
message: 'use <LemonCheckbox> instead',
Expand Down Expand Up @@ -245,6 +253,7 @@ module.exports = {
'no-constant-condition': 'off',
'no-prototype-builtins': 'off',
'no-irregular-whitespace': 'off',
'no-useless-rename': 'error',
'import/no-restricted-paths': [
'error',
{
Expand Down
2 changes: 1 addition & 1 deletion .run/Celery.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/env/bin/celery" />
<option name="PARAMETERS" value="-A posthog worker -B --scheduler redbeat.RedBeatScheduler --without-heartbeat --without-gossip --without-mingle --loglevel=DEBUG" />
<option name="PARAMETERS" value="-A posthog worker -B --scheduler redbeat.RedBeatScheduler --without-heartbeat --without-mingle --loglevel=DEBUG" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/auth-password-reset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Password Reset', () => {
it('Shows validation error if passwords do not match', () => {
cy.visit('/reset/e2e_test_user/e2e_test_token')
cy.get('[data-attr="password"]').type('12345678')
cy.get('.ant-progress-bg').should('be.visible')
cy.get('.LemonProgress__track').should('be.visible')
cy.get('[data-attr="password-confirm"]').type('1234567A')
cy.get('button[type=submit]').click()
cy.get('.text-danger').should('contain', 'Passwords do not match')
Expand Down
79 changes: 79 additions & 0 deletions cypress/e2e/experiments.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
describe('Experiments', () => {
let randomNum
let experimentName
let featureFlagKey

beforeEach(() => {
cy.intercept('/api/users/@me/', {
fixture: 'api/experiments/user',
})

cy.intercept('/api/projects/1/experiments?limit=1000', {
fixture: 'api/experiments/experiments',
})

cy.intercept('/api/projects/1/experiments/1234/', {
fixture: 'api/experiments/new-experiment',
})

cy.intercept('POST', '/api/projects/1/experiments/', (req) => {
req.reply({ fixture: 'api/experiments/new-experiment' })
})

randomNum = Math.floor(Math.random() * 10000000)
experimentName = `Experiment ${randomNum}`
featureFlagKey = `experiment-${randomNum}`
cy.visit('/experiments')
})

it('create experiment', () => {
cy.get('[data-attr=top-bar-name]').should('contain', 'A/B testing')

// Name, flag key, description
cy.get('[data-attr=create-experiment]').first().click()
cy.get('[data-attr=experiment-name]').click().type(`${experimentName}`).should('have.value', experimentName)
cy.get('[data-attr=experiment-feature-flag-key]')
.click()
.type(`${featureFlagKey}`)
.should('have.value', featureFlagKey)
cy.get('[data-attr=experiment-description]')
.click()
.type('This is the description of the experiment')
.should('have.value', 'This is the description of the experiment')

// Edit variants
cy.get('[data-attr="add-test-variant"]').click()
cy.get('input[data-attr="experiment-variant-key"][data-key-index="1"]')
.clear()
.type('test-variant-1')
.should('have.value', 'test-variant-1')
cy.get('input[data-attr="experiment-variant-key"][data-key-index="2"]')
.clear()
.type('test-variant-2')
.should('have.value', 'test-variant-2')

// Select goal type
cy.get('[data-attr="experiment-goal-type-select"]').click()
cy.contains('Trend').should('be.visible')
cy.contains('Conversion funnel').should('be.visible')

// Add secondary metric
const secondaryMetricName = `Secondary metric ${Math.floor(Math.random() * 10000000)}`
cy.get('[data-attr="add-secondary-metric-btn"]').click()
cy.get('[data-attr=secondary-metric-name]')
.click()
.type(secondaryMetricName)
.should('have.value', secondaryMetricName)
cy.get('[data-attr="metrics-selector"]').click()
cy.contains('Trends').should('be.visible')
cy.contains('Funnels').should('be.visible')
cy.get('[data-attr="create-annotation-submit"]').click()
cy.contains(secondaryMetricName).should('exist')

// Edit minimum acceptable improvement
cy.get('input[data-attr="min-acceptable-improvement"]').type('{selectall}20').should('have.value', '20')

// Save experiment
cy.get('[data-attr="save-experiment"]').first().click()
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/invites.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Invite Signup', () => {
cy.get('.BridgePage__left').should('contain', "You've been invited to join")
cy.get('input[type="email"]').should('have.value', target_email)
cy.get('[data-attr="password"]').type('12345678')
cy.get('.ant-progress-bg').should('not.have.css', 'width', '0px') // Password strength indicator is working
cy.get('.LemonProgress__track').should('not.have.css', 'width', '0px') // Password strength indicator is working
cy.get('[data-attr="first_name"]').type(randomString('Bob'))
cy.get('[data-attr=signup-role-at-organization]').click()
cy.get('.Popover li:first-child').click()
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/surveys.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Surveys', () => {
cy.get('[data-attr=prop-val] .ant-select-selector').click({ force: true })
cy.get('[data-attr=prop-val-0]').click({ force: true })

cy.get('[data-attr="rollout-percentage"]').type('{backspace}')
cy.get('[data-attr="rollout-percentage"]').type('100')

// save
cy.get('[data-attr="save-survey"]').click()
Expand Down
6 changes: 6 additions & 0 deletions cypress/fixtures/api/experiments/experiments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"count": 1,
"next": null,
"previous": null,
"results": []
}
90 changes: 90 additions & 0 deletions cypress/fixtures/api/experiments/new-experiment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"id": 1234,
"name": "Test experiment 1",
"description": "This is the description of Test experiment 1",
"start_date": null,
"end_date": null,
"feature_flag_key": "test-experiment-1",
"feature_flag": {
"id": 28367,
"team_id": 38354,
"name": "Feature Flag for Experiment Test experiment 1",
"key": "test-experiment-1",
"filters": {
"groups": [
{
"properties": [],
"rollout_percentage": null
}
],
"multivariate": {
"variants": [
{
"key": "control",
"rollout_percentage": 33
},
{
"key": "test-variant-1",
"rollout_percentage": 33
},
{
"key": "test-variant-2",
"rollout_percentage": 34
}
]
},
"aggregation_group_type_index": null
},
"deleted": false,
"active": false,
"ensure_experience_continuity": false
},
"parameters": {
"feature_flag_variants": [
{
"key": "control",
"rollout_percentage": 33
},
{
"key": "test-variant-1",
"rollout_percentage": 33
},
{
"key": "test-variant-2",
"rollout_percentage": 34
}
],
"recommended_sample_size": 0,
"recommended_running_time": 191.3
},
"secondary_metrics": [],
"filters": {
"events": [
{
"id": "$pageview",
"math": "total",
"name": "$pageview",
"type": "events",
"order": 0
}
],
"date_to": "2024-01-23T23:59",
"display": "ActionsLineGraph",
"insight": "TRENDS",
"interval": "day",
"date_from": "2024-01-09T09:00",
"entity_type": "events"
},
"archived": false,
"created_by": {
"id": 50136,
"uuid": "018a8e2f-f329-0000-7594-0cbb2cb03ed5",
"distinct_id": "3z5U5MNGsfbeqBKOwGs6dvlG0UFbiU78MfJYxyD1ahg",
"first_name": "Jane",
"last_name": "Doe",
"email": "[email protected]",
"is_email_verified": true
},
"created_at": "2024-01-23T08:01:20.564210Z",
"updated_at": "2024-01-23T08:01:20.564590Z"
}
56 changes: 56 additions & 0 deletions cypress/fixtures/api/experiments/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"id": "01788ed8-6d2d-0000-ccdb-d8e17589b1ea",
"distinct_id": "kOyAmTq2McfCD5XvqwjKf8m6GVecm9uN0L0ypEoRN50",
"first_name": "Jane",
"email": "[email protected]",
"email_opt_in": true,
"anonymize_data": false,
"toolbar_mode": "toolbar",
"has_password": true,
"is_staff": false,
"is_impersonated": false,
"team": {
"id": 1,
"uuid": "01787e47-55d7-0000-6976-b893a03aaba8",
"organization": "01787e47-5558-0000-bae1-6bc513b42abe",
"api_token": "dtrwW0uEC7LwVx64RmZmqog_XjU0nXWuEK1d1ZpjteQ",
"name": "Hogflix Demo App",
"completed_snippet_onboarding": true,
"ingested_event": true,
"is_demo": true,
"timezone": "UTC"
},
"organization": {
"id": "01787e47-5558-0000-bae1-6bc513b42abe",
"name": "Hogflix Movies",
"created_at": "2021-03-29T13:58:27.416616Z",
"updated_at": "2021-03-29T13:58:57.067131Z",
"membership_level": 15,
"plugins_access_level": 9,
"teams": [
{
"id": 1,
"uuid": "01787e47-55d7-0000-6976-b893a03aaba8",
"organization": "01787e47-5558-0000-bae1-6bc513b42abe",
"api_token": "dtrwW0uEC7LwVx64RmZmqog_XjU0nXWuEK1d1ZpjteQ",
"name": "Hogflix Demo App",
"completed_snippet_onboarding": true,
"ingested_event": true,
"is_demo": true,
"timezone": "UTC"
}
],
"available_features": [],
"available_product_features": [
{
"key": "experimentation",
"name": "A/B testing",
"note": null,
"unit": null,
"limit": null,
"description": "Test changes to your product and evaluate the impacts those changes make."
}
]
},
"organizations": [{ "id": "01787e47-5558-0000-bae1-6bc513b42abe", "name": "Hogflix Movies" }]
}
Loading

0 comments on commit 3c36abb

Please sign in to comment.