2020-05-22 18:34:48 +02:00
|
|
|
describe('Cohorts', () => {
|
|
|
|
beforeEach(() => {
|
2020-11-17 15:40:48 +01:00
|
|
|
cy.get('[data-attr=menu-item-cohorts]').click()
|
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()
|
2021-01-15 11:19:31 +01:00
|
|
|
cy.get('[data-attr="cohort-choice-definition"]').click()
|
2020-11-05 13:55:33 +01:00
|
|
|
cy.get('[data-attr="cohort-name"]').type('Test Cohort')
|
2020-10-23 15:52:59 +02:00
|
|
|
|
|
|
|
// select "add filter" and "property"
|
2020-11-05 13:55:33 +01:00
|
|
|
cy.get('.ant-radio-group > :nth-child(2)').click()
|
2020-10-23 15:52:59 +02:00
|
|
|
cy.get('[data-attr="new-prop-filter-cohort_0"]').click()
|
|
|
|
|
|
|
|
// select the first property
|
|
|
|
cy.get('[data-attr=property-filter-dropdown]').click()
|
2021-06-08 15:16:10 +02:00
|
|
|
cy.get('[data-attr=property-filter-dropdown]').type('is_demo')
|
2020-10-23 15:52:59 +02:00
|
|
|
cy.get('[data-attr=prop-filter-person-0]').click({ force: true })
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
// save
|
|
|
|
cy.get('[data-attr="save-cohort"]').click()
|
|
|
|
cy.get('[data-attr=success-toast]').should('exist')
|
|
|
|
|
|
|
|
// back to cohorts
|
2020-12-04 19:50:43 +01:00
|
|
|
cy.get('.ant-drawer-close').click({ force: true })
|
|
|
|
cy.get('.ant-table-tbody').contains('Test Cohort')
|
2021-03-25 16:24:36 +01:00
|
|
|
|
|
|
|
// Navigate to person and back again
|
|
|
|
cy.log('Can navigate to person and back again')
|
|
|
|
|
|
|
|
cy.get('[data-test-cohort-row]').first().click()
|
|
|
|
cy.get('[data-test-goto-person]').first().click()
|
|
|
|
cy.url().should('include', '/person/')
|
|
|
|
|
|
|
|
cy.get('[data-attr="persons-cohorts-tab"]').click()
|
|
|
|
cy.get('[data-test-cohort-row]').first().click()
|
|
|
|
|
|
|
|
cy.url().should('include', '/cohorts/')
|
|
|
|
cy.get('[data-attr="cohort-name"]').should('have.value', 'Test Cohort')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
})
|