mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 18:07:17 +01:00
d613f4bd06
* update cypress * really click something that's actually there * obey cypress and use done * run cypress 9 in CI * no need for before each when only one test * no need to set window size to the default * get tests passing file by file * delay checking for a graph in a test * be more specific cypress * use cy command * select text like a human * silly cypress * try and avoid cypress deciding that a visible field is not valid * select delete button correctly * find save button differently * try and avoid not always typing the first character * better trends selections * use cy command to navigate * conitnue trying to get tests to pass in CI * another try at setting feature flag names in CI * can CI find undo button without a wait? * better assertion for cypress * up to v10 * fix splitting specs with v10 path * show cypress how to wait for the test to finish * remove redundant file * change return to satisfy new cypress * move import
52 lines
1.9 KiB
JavaScript
52 lines
1.9 KiB
JavaScript
describe('Cohorts', () => {
|
|
beforeEach(() => {
|
|
cy.clickNavMenu('cohorts')
|
|
})
|
|
|
|
it('Cohorts new and list', () => {
|
|
// load an empty page
|
|
cy.get('h1').should('contain', 'Cohorts')
|
|
cy.title().should('equal', 'Cohorts • PostHog')
|
|
|
|
// go to create a new cohort
|
|
cy.get('[data-attr="create-cohort"]').click()
|
|
|
|
// select "add filter" and "property"
|
|
cy.get('[data-attr="property-filter-0"] button').first().click()
|
|
|
|
// select the first property
|
|
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 })
|
|
cy.get('[data-attr=prop-val]').click()
|
|
cy.get('[data-attr=prop-val-0]').click({ force: true })
|
|
cy.get('[data-attr="cohort-name"]').click()
|
|
|
|
// set cohort name & description
|
|
cy.get('[data-attr="cohort-name"]').type('Test Cohort')
|
|
|
|
// save
|
|
cy.get('[data-attr="save-cohort"]').click()
|
|
cy.get('[data-attr=success-toast]').contains('Cohort saved').should('exist')
|
|
|
|
// back to cohorts
|
|
cy.clickNavMenu('cohorts')
|
|
cy.get('tbody').contains('Test Cohort')
|
|
|
|
it('Cohorts new and list', () => {
|
|
cy.get('[data-row-key]').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-row-key]').first().click()
|
|
|
|
cy.get('div:not(disabled) > [data-attr="persons-cohorts-tab"]').click()
|
|
cy.get('[data-row-key]').first().click()
|
|
|
|
cy.url().should('include', '/cohorts/')
|
|
cy.get('[data-attr="cohort-name"]').should('have.value', 'Test Cohort')
|
|
})
|
|
})
|
|
})
|