2021-11-25 15:39:49 +01:00
|
|
|
import { urls } from 'scenes/urls'
|
|
|
|
|
2021-04-06 00:46:15 +02:00
|
|
|
describe('Trends', () => {
|
2020-10-13 15:44:56 +02:00
|
|
|
beforeEach(() => {
|
2021-11-25 15:39:49 +01:00
|
|
|
cy.visit(urls.insightNew())
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
|
2021-07-07 12:53:08 +02:00
|
|
|
it('Can load a graph from a URL directly', () => {
|
|
|
|
// regression test, the graph wouldn't load when going directly to a URL
|
|
|
|
cy.visit(
|
2021-11-25 15:39:49 +01:00
|
|
|
'/insights/new?insight=TRENDS&interval=day&display=ActionsLineGraph&events=%5B%7B"id"%3A"%24pageview"%2C"name"%3A"%24pageview"%2C"type"%3A"events"%2C"order"%3A0%7D%5D&filter_test_accounts=false&breakdown=%24referrer&breakdown_type=event&properties=%5B%7B"key"%3A"%24current_url"%2C"value"%3A"http%3A%2F%2Fhogflix.com"%2C"operator"%3A"icontains"%2C"type"%3A"event"%7D%5D'
|
2021-07-07 12:53:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
2020-10-13 15:44:56 +02:00
|
|
|
it('Add a pageview action filter', () => {
|
|
|
|
// when
|
2020-12-03 10:59:11 +01:00
|
|
|
cy.contains('Add graph series').click()
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=taxonomic-tab-actions]').click()
|
2022-06-24 12:44:54 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click().type('home')
|
2022-07-26 19:46:15 +02:00
|
|
|
cy.contains('Hogflix homepage view').click({ force: true })
|
2020-10-13 15:44:56 +02:00
|
|
|
|
|
|
|
// 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')
|
2020-11-05 13:55:33 +01:00
|
|
|
|
|
|
|
// Test that the math selector dropdown is shown on hover
|
2021-01-11 14:28:29 +01:00
|
|
|
cy.get('[data-attr=math-selector-0]').click()
|
2020-11-05 13:55:33 +01:00
|
|
|
cy.get('[data-attr=math-total-0]').should('be.visible')
|
|
|
|
|
|
|
|
// Use `force = true` because clicking the element without dragging the mouse makes the dropdown disappear
|
|
|
|
cy.get('[data-attr=math-avg-0]').click({ force: true })
|
2020-12-02 15:18:50 +01:00
|
|
|
cy.get('[data-attr=math-property-select]').should('exist')
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Apply specific filter on default pageview event', () => {
|
2021-04-08 19:51:37 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0]').click()
|
2022-06-24 12:44:54 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click().type('Pageview')
|
|
|
|
cy.get('.taxonomic-infinite-list').find('.taxonomic-list-row').contains('Pageview').click({ force: true })
|
2021-04-20 21:45:49 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0]').should('have.text', 'Pageview')
|
2021-06-24 17:14:08 +02:00
|
|
|
|
|
|
|
// Apply a property filter
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=show-prop-filter-0]').click()
|
2021-06-24 17:14:08 +02:00
|
|
|
cy.get('[data-attr=property-select-toggle-0]').click()
|
2022-05-27 14:31:17 +02:00
|
|
|
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })
|
2022-06-09 12:14:21 +02:00
|
|
|
|
2022-05-25 12:31:58 +02:00
|
|
|
cy.get('[data-attr=prop-val]').click({ force: true })
|
|
|
|
// cypress is odd and even though when a human clicks this the right dropdown opens
|
|
|
|
// in the test that doesn't happen
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('[data-attr=prop-val-0]').length === 0) {
|
2022-09-10 17:40:13 +02:00
|
|
|
cy.get('[data-attr=taxonomic-value-select]').click()
|
2022-05-25 12:31:58 +02:00
|
|
|
}
|
|
|
|
})
|
2021-04-08 22:40:29 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]', { timeout: 8000 }).should('exist')
|
|
|
|
})
|
|
|
|
|
2020-10-13 15:44:56 +02:00
|
|
|
it('Apply 1 overall filter', () => {
|
2021-04-08 19:51:37 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0]').click()
|
2022-06-24 12:44:54 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click().type('Pageview')
|
|
|
|
cy.get('.taxonomic-infinite-list').find('.taxonomic-list-row').contains('Pageview').click({ force: true })
|
2021-04-20 21:45:49 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-0]').should('have.text', 'Pageview')
|
2022-05-25 04:56:38 +02:00
|
|
|
|
2022-06-28 11:51:17 +02:00
|
|
|
cy.get('[data-attr=insight-filters-add-filter-group]').click()
|
2022-05-25 04:56:38 +02:00
|
|
|
cy.get('[data-attr=property-select-toggle-0]').click()
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
|
2022-05-27 14:31:17 +02:00
|
|
|
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })
|
2022-05-25 12:31:58 +02:00
|
|
|
cy.get('[data-attr=prop-val]').click({ force: true })
|
|
|
|
// cypress is odd and even though when a human clicks this the right dropdown opens
|
|
|
|
// in the test that doesn't happen
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('[data-attr=prop-val-0]').length === 0) {
|
2022-09-10 17:40:13 +02:00
|
|
|
cy.get('[data-attr=taxonomic-value-select]').click()
|
2022-05-25 12:31:58 +02:00
|
|
|
}
|
|
|
|
})
|
2020-10-23 15:52:59 +02:00
|
|
|
cy.get('[data-attr=prop-val-0]').click({ force: true })
|
2020-10-13 15:44:56 +02:00
|
|
|
|
|
|
|
cy.get('[data-attr=trend-line-graph]', { timeout: 8000 }).should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Apply interval filter', () => {
|
|
|
|
cy.get('[data-attr=interval-filter]').click()
|
2021-12-09 06:54:32 +01:00
|
|
|
cy.contains('Week').click()
|
2020-10-13 15:44:56 +02:00
|
|
|
|
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
2021-02-26 15:50:36 +01:00
|
|
|
it('Apply pie filter', () => {
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=chart-filter]').click()
|
2022-07-08 11:18:26 +02:00
|
|
|
cy.get('.Popup').find('.LemonButton').contains('Pie').click({ force: true })
|
2020-10-13 15:44:56 +02:00
|
|
|
|
|
|
|
cy.get('[data-attr=trend-pie-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Apply table filter', () => {
|
|
|
|
cy.get('[data-attr=chart-filter]').click()
|
2022-07-08 11:18:26 +02:00
|
|
|
cy.get('.Popup').find('.LemonButton').contains('Table').click({ force: true })
|
2020-10-13 15:44:56 +02:00
|
|
|
|
2021-06-10 05:30:51 +02:00
|
|
|
cy.get('[data-attr=insights-table-graph]').should('exist')
|
2021-06-21 23:21:00 +02:00
|
|
|
|
|
|
|
// Select Total Count math property
|
|
|
|
cy.get('[data-attr=math-selector-0]').click()
|
|
|
|
cy.get('[data-attr=math-total-0]').click()
|
|
|
|
|
|
|
|
// Should contain more than label column
|
2021-12-21 23:19:23 +01:00
|
|
|
cy.get('[data-attr=insights-table-graph]').find('td').its('length').should('be.gte', 1)
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Apply date filter', () => {
|
|
|
|
cy.get('[data-attr=date-filter]').click()
|
2022-07-04 13:46:12 +02:00
|
|
|
cy.get('div').contains('Yesterday').should('exist').click()
|
2021-12-01 15:56:36 +01:00
|
|
|
cy.get('[data-attr=trend-line-graph]', { timeout: 10000 }).should('exist')
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Apply property breakdown', () => {
|
|
|
|
cy.get('[data-attr=add-breakdown-button]').click()
|
2022-05-27 14:31:17 +02:00
|
|
|
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
2021-07-23 10:54:59 +02:00
|
|
|
it('Apply all users cohort breakdown', () => {
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=add-breakdown-button]').click()
|
2021-07-23 10:54:59 +02:00
|
|
|
cy.get('[data-attr=taxonomic-tab-cohorts_with_all]').click()
|
|
|
|
cy.contains('All Users*').click()
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=trend-line-graph]').should('exist')
|
|
|
|
})
|
|
|
|
|
2022-05-25 14:09:52 +02:00
|
|
|
it('Save to dashboard', () => {
|
2021-12-21 16:54:42 +01:00
|
|
|
// apply random filter
|
2022-06-28 11:51:17 +02:00
|
|
|
cy.get('[data-attr=insight-filters-add-filter-group]').click()
|
2022-05-25 04:56:38 +02:00
|
|
|
cy.get('[data-attr=property-select-toggle-0]').click()
|
2021-12-21 16:54:42 +01:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
|
2022-05-27 14:31:17 +02:00
|
|
|
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })
|
2022-05-25 12:31:58 +02:00
|
|
|
cy.get('[data-attr=prop-val]').click({ force: true })
|
|
|
|
// cypress is odd and even though when a human clicks this the right dropdown opens
|
|
|
|
// in the test that doesn't happen
|
|
|
|
cy.get('body').then(($body) => {
|
|
|
|
if ($body.find('[data-attr=prop-val-0]').length === 0) {
|
2022-09-10 17:40:13 +02:00
|
|
|
cy.get('[data-attr=taxonomic-value-select]').click()
|
2022-05-25 12:31:58 +02:00
|
|
|
}
|
|
|
|
})
|
2021-12-21 16:54:42 +01:00
|
|
|
|
2022-03-21 21:55:16 +01:00
|
|
|
cy.get('[data-attr=insight-save-button]').click()
|
2020-10-13 15:44:56 +02:00
|
|
|
cy.get('[data-attr=save-to-dashboard-button]').click()
|
2022-08-02 09:10:15 +02:00
|
|
|
cy.get('[data-attr="dashboard-list-item"] button').contains('Add to dashboard').first().click({ force: true }) // Add the insight to a dashboard
|
|
|
|
cy.get('[data-attr="dashboard-list-item"] button').first().contains('Added')
|
2022-03-22 18:30:43 +01:00
|
|
|
|
|
|
|
cy.wait(200)
|
2022-03-09 12:36:57 +01:00
|
|
|
cy.get('[data-attr=success-toast]').contains('Insight added to dashboard').should('exist')
|
2020-10-13 15:44:56 +02:00
|
|
|
})
|
|
|
|
})
|