0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
posthog/cypress/e2e/funnels.js
Paul D'Ambra d613f4bd06
chore: upgrade cypress to v10x (#9650)
* 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
2022-06-09 11:14:21 +01:00

76 lines
2.8 KiB
JavaScript

const TIMEOUT = 30000 // increase timeout for funnel viz as sometimes github actions can be slow
describe.skip('Funnels', () => {
beforeEach(() => {
// :TRICKY: Race condition populating the first dropdown in funnel
cy.get('[data-test-filters-loading]').should('not.exist')
cy.get('[data-attr=insight-funnels-tab]').click()
cy.wait(200)
})
it('Add only events to funnel', () => {
cy.get('[data-attr=add-action-event-button]').first().click()
cy.get('[data-attr=save-funnel-button]').click() // `save-funnel-button` is actually calculate, keeping around to avoid losing data
cy.get('[data-attr=funnel-bar-graph]', { timeout: TIMEOUT }).should('exist')
})
it('Add 1 action to funnel and navigate to persons', () => {
cy.get('[data-attr=add-action-event-button]').first().click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.get('[data-attr=taxonomic-tab-actions]').click()
cy.wait(200)
cy.contains('Hogflix homepage view').click()
cy.get('[data-attr=save-funnel-button]').click()
cy.get('[data-attr=funnel-bar-graph]', { timeout: TIMEOUT }).should('exist')
cy.get('[data-attr="funnel-person"] a')
.filter(':contains("@")')
.first()
.then(($match) => {
const email = $match.text()
cy.wrap($match).click()
cy.url().should('include', '/person/')
cy.contains(email).should('exist')
})
})
it('Apply date filter to funnel', () => {
cy.get('[data-attr=add-action-event-button]').first().click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.get('[data-attr=taxonomic-tab-actions]').click()
cy.contains('Hogflix homepage view').click()
cy.get('[data-attr=save-funnel-button]').click()
cy.get('[data-attr=date-filter]').click()
cy.contains('Last 30 days').click()
cy.get('[data-attr=date-filter]').click()
cy.contains('Last 30 days').click()
cy.get('[data-attr=funnel-bar-graph]', { timeout: TIMEOUT }).should('exist')
})
it('Add 2 actions to funnel', () => {
cy.get('[data-attr=add-action-event-button]').first().click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.get('[data-attr=taxonomic-tab-actions]').click()
cy.contains('Hogflix homepage view').click()
cy.get('[data-attr=add-action-event-button]').first().click()
cy.get('[data-attr=trend-element-subject-1]').click()
cy.get('[data-attr=taxonomic-tab-actions]').click()
cy.contains('Hogflix paid').click()
cy.get('[data-attr=save-funnel-button]').click()
cy.get('[data-attr=funnel-bar-graph]', { timeout: TIMEOUT }).should('exist')
})
})