0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
posthog/cypress/integration/trends_elements.js
Eric Duong b172eee920
Insight history (#1379)
* add insight history

* add table

* edit format

* links working

* add modal

* add tab switch

* saving insights

* remove insights model

* no model for insight history

* initial working

* remove wrong typegen

* made the history per user

* missing param

* added funnel support

* add details

* add delete saved insight functionality

* add line break logic and funnel name

* fix reload logic

* fix rendering error

* add pagination component

* fix bugs

* add backend tests

* add insight-history-panel check

* add drawer and replace table

* add loading next

* add date

* add callback

* update test

* use table

* fix spacing

* fix rows

* adjust spacing

* fix spacing and styling

* fix spacing and styling

* .

* add missing package

* Funnel refactor (#1381)

* main funnel-insight page working

* consolidated funnels

* refactor funnel dashboard item

* dashboard modals working

* update demo creation

* updated migration

* fix frontend for funnels

* remove funnel code and fix bugs

* fix test and remove caching temp

* remove old tests

* fix types

* added panel for past funnels

* implement polling for funnel refactor

* .

* fix dashbaord item bug

* add params

* fix params

* clean up caching functionality

* fix types

* caching working properly

* fix dashboard update bug

* fix migrations

* fix check

* update caching to work properly

* Fix default

* fix api and styling for insight history

* more spacing

* update funnel automatically

* update tests

* fix clear condition

* merge insight history

* return save functionality

* remove file

* added extra save functionality
2020-08-24 17:02:13 -04:00

122 lines
4.2 KiB
JavaScript

describe('Trends actions & events', () => {
beforeEach(() => {
// given
cy.visit('/')
})
it('Insight History Panel Rendered', () => {
cy.get('[data-attr=insight-history-button]').click()
cy.get('[data-attr=insight-history-panel]').should('exist')
})
it('Add a pageview action filter', () => {
// when
cy.contains('Add action/event').click()
cy.get('[data-attr=trend-element-subject-1]').click()
cy.contains('Pageviews').click()
// then
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('DAU on 1 element', () => {
cy.get('[data-attr=math-selector-0]').click()
cy.get('[data-attr=math-dau-0]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Show property select dynamically', () => {
cy.get('[data-attr=math-property-selector-0]').should('not.exist')
cy.get('[data-attr=math-selector-0]').click()
cy.get('[data-attr=math-avg-0]').click()
cy.get('[data-attr=math-property-selector-0]').should('exist')
})
it('Apply specific filter on default pageview event', () => {
cy.get('[data-attr=show-prop-filter-0]').click()
cy.get('[data-attr=new-prop-filter-0-\\$pageview-filter]').click()
cy.get('[data-attr=prop-filter-event-1]').click()
cy.get('[data-attr=prop-val]').click()
cy.get('[data-attr=prop-val-0]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply 1 overall filter', () => {
cy.get('[data-attr=new-prop-filter-trends-filters]').click()
cy.get('[data-attr=prop-filter-event-1]').click()
cy.get('[data-attr=prop-val]').click()
cy.get('[data-attr=prop-val-0]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply interval filter', () => {
cy.get('[data-attr=interval-filter]').click()
cy.contains('Weekly').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply chart filter', () => {
cy.get('[data-attr=chart-filter]').click()
cy.contains('Pie').click()
cy.get('[data-attr=trend-pie-graph]').should('exist')
})
it('Apply table filter', () => {
cy.get('[data-attr=chart-filter]').click()
cy.contains('Table').click()
cy.get('[data-attr=trend-table-graph]').should('exist')
})
it('Apply date filter', () => {
cy.get('[data-attr=date-filter]').click()
cy.contains('Last 30 days').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply volume filter', () => {
cy.get('[data-attr=shownas-filter]').click()
cy.get('[data-attr=shownas-volume-option]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply stickiness filter', () => {
cy.get('[data-attr=shownas-filter]').click()
cy.get('[data-attr=shownas-stickiness-option]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply property breakdown', () => {
cy.get('[data-attr=add-breakdown-button]').click()
cy.get('[data-attr=prop-breakdown-select]').click()
cy.get('[data-attr=prop-breakdown-3]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply all users cohort breakdown', () => {
cy.get('[data-attr=add-breakdown-button]').click()
cy.contains('Cohort').click()
cy.get('[data-attr=cohort-breakdown-select]').click()
cy.get('[data-attr=cohort-breakdown-all-users]').click()
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Save to dashboard', () => {
cy.get('[data-attr=save-to-dashboard-button]').click()
cy.get('.ant-input').type('Pageviews')
cy.get('form > .ant-select > .ant-select-selector').click()
cy.get(':nth-child(1) > .ant-select-item-option-content').click()
cy.contains('Add panel to dashboard').click()
cy.wait(300) // not ideal but toast has a delay render
cy.get('[data-attr=success-toast]', { timeout: 7000 }).should('exist')
})
})