2020-05-22 18:34:48 +02:00
|
|
|
describe('Cohorts', () => {
|
2023-11-08 16:16:05 +01:00
|
|
|
const goToCohorts = (): void => {
|
|
|
|
cy.clickNavMenu('personsmanagement')
|
|
|
|
cy.get('[data-attr=persons-management-cohorts-tab]').click()
|
|
|
|
}
|
|
|
|
|
2020-05-22 18:34:48 +02:00
|
|
|
beforeEach(() => {
|
2023-11-08 16:16:05 +01:00
|
|
|
goToCohorts()
|
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
|
2023-11-08 16:16:05 +01:00
|
|
|
cy.title().should('equal', 'Cohorts • People • PostHog')
|
2023-12-27 09:52:28 +01:00
|
|
|
cy.contains('Create your first cohort').should('exist')
|
2023-12-07 17:56:39 +01:00
|
|
|
cy.get('[data-attr="product-introduction-docs-link"]').should('contain', 'Learn more')
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// go to create a new cohort
|
2023-11-08 16:16:05 +01:00
|
|
|
cy.get('[data-attr="new-cohort"]').click()
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// 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
|
2023-11-08 16:16:05 +01:00
|
|
|
goToCohorts()
|
2021-11-26 15:29:30 +01:00
|
|
|
cy.get('tbody').contains('Test Cohort')
|
2023-12-27 09:52:28 +01:00
|
|
|
cy.contains('Create your first cohort').should('not.exist')
|
2021-03-25 16:24:36 +01:00
|
|
|
|
2023-10-06 12:18:20 +02:00
|
|
|
// back into cohort
|
|
|
|
cy.get('tbody').contains('Test Cohort').click()
|
|
|
|
|
|
|
|
// duplicate cohort (dynamic)
|
|
|
|
cy.get('[data-attr="more-button"]').click()
|
|
|
|
cy.get('.Popover__content').contains('Duplicate as dynamic cohort').click()
|
|
|
|
cy.get('.Toastify__toast-body').contains('View cohort').click()
|
|
|
|
|
|
|
|
// duplicate cohort (static)
|
|
|
|
cy.get('[data-attr="more-button"]').click()
|
|
|
|
cy.get('.Popover__content').contains('Duplicate as static cohort').click()
|
|
|
|
cy.get('.Toastify__toast-body').contains('View cohort').click()
|
|
|
|
|
|
|
|
// delete cohort
|
|
|
|
cy.get('[data-attr="more-button"]').click()
|
|
|
|
cy.get('.Popover__content').contains('Delete cohort').click()
|
2023-11-08 16:16:05 +01:00
|
|
|
goToCohorts()
|
2023-10-06 12:18:20 +02:00
|
|
|
cy.get('tbody').should('not.have.text', 'Test Cohort (dynamic copy) (static copy)')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
})
|