2021-04-06 00:46:15 +02:00
|
|
|
// For tests related to trends please check trendsElements.js
|
|
|
|
describe('Insights', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/insights')
|
|
|
|
})
|
|
|
|
|
2021-08-02 18:44:44 +02:00
|
|
|
it('Opens insight with short URL', () => {
|
|
|
|
cy.visit('/i/TEST1234') // Insight `TEST1234` is created in demo data (revenue_data_generator.py)
|
|
|
|
cy.location('pathname').should('eq', '/insights') // User is taken to the insights page
|
2021-11-10 00:29:05 +01:00
|
|
|
cy.get('[data-attr=insight-edit-button]').click()
|
2021-08-02 18:44:44 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0]').contains('Entered Free Trial').should('exist') // Funnel is properly loaded
|
|
|
|
cy.get('[data-attr=trend-element-subject-1]').contains('Purchase').should('exist')
|
|
|
|
|
|
|
|
cy.get('[data-attr=funnel-bar-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Shows not found error with invalid short URL', () => {
|
|
|
|
cy.visit('/i/i_dont_exist')
|
|
|
|
cy.location('pathname').should('eq', '/i/i_dont_exist')
|
|
|
|
cy.get('h1.page-title').contains('Insight not found').should('exist')
|
|
|
|
cy.get('.not-found-component').get('.graphic').should('exist')
|
|
|
|
})
|
|
|
|
|
2021-04-06 00:46:15 +02:00
|
|
|
it('Stickiness graph', () => {
|
2021-05-07 04:26:42 +02:00
|
|
|
cy.get('.ant-tabs-tab').contains('Stickiness').click()
|
2021-04-06 00:46:15 +02:00
|
|
|
cy.get('[data-attr=add-action-event-button]').click()
|
|
|
|
cy.get('[data-attr=trend-element-subject-1]').should('exist')
|
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
cy.get('[data-attr=add-breakdown-button]').should('not.exist') // Can't do breakdown on this graph
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Lifecycle graph', () => {
|
2021-05-26 14:51:30 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist') // Wait until components are loaded
|
|
|
|
cy.get('body').type('l') // Tab is cut off on narrow screens; plus we test hotkeys too
|
|
|
|
cy.get('h4').contains('Lifecycle Toggles').should('exist')
|
2021-04-06 00:46:15 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
cy.get('[data-attr=add-breakdown-button]').should('not.exist') // Can't do breakdown on this graph
|
|
|
|
cy.get('[data-attr=add-action-event-button]').should('not.exist') // Can't add multiple series
|
|
|
|
})
|
2021-04-08 22:40:29 +02:00
|
|
|
|
|
|
|
it('Loads default filters correctly', () => {
|
|
|
|
cy.visit('/events') // Test that default params are set correctly even if the app doesn't start on insights
|
|
|
|
cy.reload()
|
|
|
|
|
2021-06-09 16:58:34 +02:00
|
|
|
cy.clickNavMenu('insights')
|
2021-04-20 21:45:49 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0] span').should('contain', 'Pageview')
|
2021-04-08 22:40:29 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
cy.contains('Add graph series').click()
|
|
|
|
cy.get('[data-attr=trend-element-subject-1]').should('exist')
|
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
})
|
2021-08-12 23:55:11 +02:00
|
|
|
|
|
|
|
xit('Cannot see tags or description (non-FOSS feature)', () => {
|
|
|
|
cy.get('h1').should('contain', 'Insights')
|
|
|
|
cy.get('.insight-description').should('not.exist')
|
|
|
|
cy.get('[data-attr=insight-tags]').should('not.exist')
|
|
|
|
})
|
2021-04-06 00:46:15 +02:00
|
|
|
})
|