0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/cypress/integration/trends_sessions.js
James Greenhill 1b689054bf
Fix cypress inconsistent tests with longer wait and purecomponents (#1078)
* Test lengthening the wait time for the toasts to see if they are less flakey

* use purecomponent hook to prevent unnecessary rerender

* test again

* test again x2

* change pagekey

* test x2

* test

* run on chrome

* remove chrome

Co-authored-by: Eric <eeoneric@gmail.com>
2020-06-25 13:53:13 -04:00

51 lines
1.6 KiB
JavaScript

describe('Trends sessions', () => {
beforeEach(() => {
// given
cy.visit('/')
cy.contains('Sessions').click()
})
it('Navigate from distributed sessions to /trends', () => {
cy.get('[data-attr=sessions-filter]').click()
cy.get('[data-attr=sessions-filter-distribution]').click()
cy.get('[data-attr=trend-table-graph]').should('exist')
cy.contains('Actions & Events').click()
cy.get('[data-attr=trend-line-graph] canvas').should('exist')
})
it('Sessions exists', () => {
// then
cy.get('[data-attr=trend-line-graph]').should('exist')
})
it('Apply 1 overall filter', () => {
cy.get('[data-attr=new-prop-filter-trends-sessions]').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 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('Save to dashboard', () => {
cy.get('[data-attr=save-to-dashboard-button]').click()
cy.contains('Add panel to dashboard').click()
cy.wait(700) // not ideal but toast has a delay render
cy.get('[data-attr=success-toast]').should('exist')
})
})