2020-05-22 18:34:48 +02:00
|
|
|
describe('Cohorts', () => {
|
|
|
|
beforeEach(() => {
|
2021-06-09 16:58:34 +02:00
|
|
|
cy.clickNavMenu('cohorts')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2020-10-23 15:52:59 +02:00
|
|
|
it('Cohorts new and list', () => {
|
|
|
|
// load an empty page
|
2020-05-22 18:34:48 +02:00
|
|
|
cy.get('h1').should('contain', 'Cohorts')
|
2020-11-13 17:50:23 +01:00
|
|
|
cy.title().should('equal', 'Cohorts • PostHog')
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// go to create a new cohort
|
|
|
|
cy.get('[data-attr="create-cohort"]').click()
|
|
|
|
|
|
|
|
// select "add filter" and "property"
|
2022-06-23 22:02:01 +02:00
|
|
|
cy.get('[data-attr="cohort-selector-field-value"]').click()
|
|
|
|
cy.get('[data-attr="cohort-personPropertyBehavioral-have_property-type"]').click()
|
|
|
|
cy.get('[data-attr="cohort-taxonomic-field-key"]').click()
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// select the first property
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
|
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').type('is_demo')
|
|
|
|
cy.get('[data-attr=prop-filter-person_properties-0]').click({ force: true })
|
2020-10-23 15:52:59 +02:00
|
|
|
cy.get('[data-attr=prop-val]').click()
|
|
|
|
cy.get('[data-attr=prop-val-0]').click({ force: true })
|
2021-02-25 15:54:55 +01:00
|
|
|
cy.get('[data-attr="cohort-name"]').click()
|
2020-10-23 15:52:59 +02:00
|
|
|
|
2021-09-09 17:13:35 +02:00
|
|
|
// set cohort name & description
|
|
|
|
cy.get('[data-attr="cohort-name"]').type('Test Cohort')
|
|
|
|
|
2020-10-23 15:52:59 +02:00
|
|
|
// save
|
|
|
|
cy.get('[data-attr="save-cohort"]').click()
|
2022-03-09 12:36:57 +01:00
|
|
|
cy.get('[data-attr=success-toast]').contains('Cohort saved').should('exist')
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// back to cohorts
|
2022-04-22 07:01:44 +02:00
|
|
|
cy.clickNavMenu('cohorts')
|
2021-11-26 15:29:30 +01:00
|
|
|
cy.get('tbody').contains('Test Cohort')
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2021-07-21 03:49:35 +02:00
|
|
|
it('Cohorts new and list', () => {
|
2021-11-26 15:29:30 +01:00
|
|
|
cy.get('[data-row-key]').first().click()
|
2021-07-21 03:49:35 +02:00
|
|
|
cy.get('[data-test-goto-person]').first().click()
|
|
|
|
cy.url().should('include', '/person/')
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2021-07-21 03:49:35 +02:00
|
|
|
cy.get('[data-attr="persons-cohorts-tab"]').click()
|
2021-11-26 15:29:30 +01:00
|
|
|
cy.get('[data-row-key]').first().click()
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2021-07-21 03:49:35 +02:00
|
|
|
cy.get('div:not(disabled) > [data-attr="persons-cohorts-tab"]').click()
|
2021-11-26 15:29:30 +01:00
|
|
|
cy.get('[data-row-key]').first().click()
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2021-07-21 03:49:35 +02:00
|
|
|
cy.url().should('include', '/cohorts/')
|
|
|
|
cy.get('[data-attr="cohort-name"]').should('have.value', 'Test Cohort')
|
|
|
|
})
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
})
|