0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
posthog/cypress/integration/funnels.js
Karl-Aksel Puulmann eb7b361401
Fix: funnels & retention person links, funnel calculations (#3483)
* Fix links to people from Retention modal and Funnels.

More details under issue https://github.com/PostHog/posthog/issues/3480

* Fix funnel calculations on self-hosted

Broken by renames within https://github.com/PostHog/posthog/pull/3301

* Handle cached calculations in e2e test runner

When executing e2e tests, celery tasks are evaluated immediately. Previously
due to the caching the funnels never loaded as we overwrite the results immediately.

* Add test for navigating to persons from funnels

* Test for retention visualization and person navigation
2021-02-25 17:41:25 +02:00

61 lines
2.0 KiB
JavaScript

describe('Funnels', () => {
beforeEach(() => {
cy.get('[data-attr=insight-funnels-tab]').click()
cy.wait(200)
})
it('Add 1 action to funnel and navigate to persons', () => {
cy.get('[data-attr=add-action-event-button]').click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.wait(200)
// Double click: https://www.cypress.io/blog/2019/01/22/when-can-the-test-click/
cy.contains('HogFlix homepage view').click().click()
cy.get('[data-attr=save-funnel-button]').click()
cy.get('[data-attr=funnel-viz]').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]').click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.contains('HogFlix homepage view').click().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-viz]').should('exist')
})
it('Add 2 actions to funnel', () => {
cy.get('[data-attr=add-action-event-button]').click()
cy.get('[data-attr=trend-element-subject-0]').click()
cy.contains('HogFlix homepage view').click().click()
cy.get('[data-attr=add-action-event-button]').click()
cy.get('[data-attr=trend-element-subject-1]').click()
cy.contains('HogFlix paid').click().click()
cy.get('[data-attr=save-funnel-button]').click()
cy.get('[data-attr=funnel-viz]').should('exist')
})
})