2022-05-25 12:31:58 +02:00
|
|
|
function createDashboardFromTemplate(dashboardName) {
|
|
|
|
cy.get('[data-attr="new-dashboard"]').click()
|
|
|
|
cy.get('[data-attr=dashboard-name-input]').clear().type(dashboardName)
|
|
|
|
cy.get('[data-attr=copy-from-template]').click()
|
|
|
|
cy.get('[data-attr=dashboard-select-default-app]').click()
|
|
|
|
|
2022-08-08 08:27:00 +02:00
|
|
|
cy.get('[data-attr=dashboard-submit-and-go]').click()
|
2022-05-25 12:31:58 +02:00
|
|
|
|
|
|
|
cy.contains(dashboardName).should('exist')
|
|
|
|
}
|
|
|
|
|
2021-03-27 01:38:13 +01:00
|
|
|
describe('Dashboard', () => {
|
2020-05-19 20:48:10 +02:00
|
|
|
beforeEach(() => {
|
2021-06-09 16:58:34 +02:00
|
|
|
cy.clickNavMenu('dashboards')
|
2020-09-18 15:26:12 +02:00
|
|
|
cy.location('pathname').should('include', '/dashboard')
|
2020-05-19 20:48:10 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Dashboards loaded', () => {
|
|
|
|
cy.get('h1').should('contain', 'Dashboards')
|
2021-12-07 10:58:28 +01:00
|
|
|
// Breadcrumbs work
|
2021-12-14 15:34:01 +01:00
|
|
|
cy.get('[data-attr=breadcrumb-0]').should('contain', 'Hogflix')
|
|
|
|
cy.get('[data-attr=breadcrumb-1]').should('contain', 'Hogflix Demo App')
|
2021-12-07 10:58:28 +01:00
|
|
|
cy.get('[data-attr=breadcrumb-2]').should('have.text', 'Dashboards')
|
2020-05-19 20:48:10 +02:00
|
|
|
})
|
2020-05-22 18:34:48 +02:00
|
|
|
|
2021-12-10 17:15:37 +01:00
|
|
|
it('Adding new insight to dashboard works', () => {
|
|
|
|
cy.get('[data-attr=menu-item-insight]').click() // Create a new insight
|
|
|
|
cy.get('[data-attr="insight-save-button"]').click() // Save the insight
|
2022-03-22 11:25:10 +01:00
|
|
|
cy.wait(100)
|
|
|
|
cy.get('[data-attr="edit-prop-name"]').click({ force: true }) // Rename insight, out of view, must force
|
2021-12-10 17:15:37 +01:00
|
|
|
cy.focused().clear().type('Test Insight Zeus')
|
2022-01-22 01:27:30 +01:00
|
|
|
cy.get('button').contains('Save').click() // Save the new name
|
2021-12-10 17:15:37 +01:00
|
|
|
cy.get('[data-attr="save-to-dashboard-button"]').click() // Open the Save to dashboard modal
|
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')
|
|
|
|
cy.get('[data-attr="dashboard-list-item"] a').first().click({ force: true }) // Go to the dashboard
|
2021-12-10 17:15:37 +01:00
|
|
|
cy.get('[data-attr="insight-name"]').should('contain', 'Test Insight Zeus') // Check if the insight is there
|
|
|
|
})
|
|
|
|
|
2021-03-27 01:38:13 +01:00
|
|
|
it('Cannot see tags or description (non-FOSS feature)', () => {
|
|
|
|
cy.get('h1').should('contain', 'Dashboards')
|
2021-11-22 17:03:46 +01:00
|
|
|
cy.get('th').contains('Description').should('not.exist')
|
|
|
|
cy.get('th').contains('Tags').should('not.exist')
|
2021-03-27 01:38:13 +01:00
|
|
|
|
2021-06-29 22:20:02 +02:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('App Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard').should('exist')
|
2021-03-27 01:38:13 +01:00
|
|
|
cy.get('.dashboard-description').should('not.exist')
|
|
|
|
cy.get('[data-attr=dashboard-tags]').should('not.exist')
|
|
|
|
})
|
|
|
|
|
2021-02-04 10:53:00 +01:00
|
|
|
it('Pinned dashboards on menu', () => {
|
2022-01-14 18:34:24 +01:00
|
|
|
cy.clickNavMenu('events') // to make sure the dashboards menu item is not the active one
|
2021-11-11 21:20:01 +01:00
|
|
|
cy.get('[data-attr=menu-item-pinned-dashboards]').click()
|
2022-06-20 11:04:29 +02:00
|
|
|
cy.get('[data-attr=sidebar-pinned-dashboards]').should('be.visible')
|
2022-08-09 09:59:00 +02:00
|
|
|
cy.get('[data-attr=sidebar-pinned-dashboards] a').should('contain', 'App Analytics')
|
2021-02-04 10:53:00 +01:00
|
|
|
})
|
|
|
|
|
2022-06-30 18:44:11 +02:00
|
|
|
it('Share dashboard', () => {
|
2022-05-25 12:31:58 +02:00
|
|
|
createDashboardFromTemplate('to be shared')
|
|
|
|
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard').should('exist')
|
2020-07-23 10:41:59 +02:00
|
|
|
|
|
|
|
cy.get('[data-attr=dashboard-share-button]').click()
|
2022-06-30 13:58:58 +02:00
|
|
|
cy.get('[data-attr=sharing-switch]').click({ force: true })
|
2022-06-30 18:44:11 +02:00
|
|
|
|
|
|
|
cy.contains('Embed dashboard').should('be.visible')
|
|
|
|
cy.get('[data-attr=copy-code-button]').click()
|
|
|
|
cy.window().its('navigator.clipboard').invoke('readText').should('contain', '<iframe')
|
|
|
|
cy.window().its('navigator.clipboard').invoke('readText').should('contain', '/embedded/')
|
|
|
|
|
|
|
|
cy.contains('Copy share link').should('be.visible')
|
2022-06-30 13:58:58 +02:00
|
|
|
cy.get('[data-attr=sharing-link-button]').click()
|
2022-06-30 18:44:11 +02:00
|
|
|
cy.window().its('navigator.clipboard').invoke('readText').should('contain', '/shared/')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
2020-07-10 19:21:30 +02:00
|
|
|
|
2020-10-28 12:41:24 +01:00
|
|
|
it('Create an empty dashboard', () => {
|
|
|
|
cy.get('[data-attr="new-dashboard"]').click()
|
2021-03-22 14:22:00 +01:00
|
|
|
cy.get('[data-attr=dashboard-name-input]').clear().type('New Dashboard')
|
2020-10-28 12:41:24 +01:00
|
|
|
cy.get('button').contains('Create').click()
|
2020-07-10 19:21:30 +02:00
|
|
|
|
2021-03-22 14:22:00 +01:00
|
|
|
cy.contains('New Dashboard').should('exist')
|
|
|
|
cy.get('.empty-state').should('exist')
|
2021-08-02 22:27:39 +02:00
|
|
|
|
|
|
|
// Check that dashboard is not pinned by default
|
2022-08-25 18:25:59 +02:00
|
|
|
cy.get('.page-buttons [data-attr="dashboard-three-dots-options-menu"]').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('button').contains('Pin dashboard').should('exist')
|
2020-10-28 12:41:24 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Create dashboard from a template', () => {
|
2021-12-07 10:58:28 +01:00
|
|
|
const TEST_DASHBOARD_NAME = 'XDefault'
|
|
|
|
|
2022-05-25 12:31:58 +02:00
|
|
|
createDashboardFromTemplate(TEST_DASHBOARD_NAME)
|
2020-10-28 12:41:24 +01:00
|
|
|
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard').its('length').should('be.gte', 2)
|
2021-12-07 10:58:28 +01:00
|
|
|
// Breadcrumbs work
|
2021-12-14 15:34:01 +01:00
|
|
|
cy.get('[data-attr=breadcrumb-0]').should('contain', 'Hogflix')
|
|
|
|
cy.get('[data-attr=breadcrumb-1]').should('contain', 'Hogflix Demo App')
|
2021-12-07 10:58:28 +01:00
|
|
|
cy.get('[data-attr=breadcrumb-2]').should('have.text', 'Dashboards')
|
|
|
|
cy.get('[data-attr=breadcrumb-3]').should('have.text', TEST_DASHBOARD_NAME)
|
2020-07-10 19:21:30 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Click on a dashboard item dropdown and view graph', () => {
|
2021-01-28 12:50:01 +01:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=more-button]').first().click()
|
2022-08-09 09:59:00 +02:00
|
|
|
cy.get('a').contains('View').click()
|
2020-07-29 17:51:49 +02:00
|
|
|
cy.location('pathname').should('include', '/insights')
|
2020-07-10 19:21:30 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Rename dashboard item', () => {
|
2021-01-28 12:50:01 +01:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=more-button]').first().click()
|
|
|
|
cy.get('button').contains('Rename').click()
|
2020-07-10 19:21:30 +02:00
|
|
|
|
|
|
|
cy.get('[data-attr=modal-prompt]').clear().type('Test Name')
|
|
|
|
cy.contains('OK').click()
|
|
|
|
cy.contains('Test Name').should('exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Color dashboard item', () => {
|
2021-01-28 12:50:01 +01:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=more-button]').first().click()
|
|
|
|
cy.get('button').contains('Set color').click()
|
|
|
|
cy.get('button').contains('Green').click()
|
|
|
|
cy.get('.InsightCard .InsightMeta__ribbon').should('have.class', 'green')
|
2020-07-10 19:21:30 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Duplicate dashboard item', () => {
|
2021-01-28 12:50:01 +01:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=more-button]').first().click()
|
|
|
|
cy.get('button').contains('Duplicate').click()
|
2022-03-09 12:36:57 +01:00
|
|
|
cy.get('[data-attr=success-toast]').contains('Insight duplicated').should('exist')
|
2020-07-10 19:21:30 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Move dashboard item', () => {
|
2021-01-28 12:50:01 +01:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('Web Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=more-button]').first().click()
|
|
|
|
cy.get('button').contains('Move to').click()
|
|
|
|
cy.get('button').contains('App Analytics').click()
|
2022-03-09 12:36:57 +01:00
|
|
|
cy.get('[data-attr=success-toast]').contains('Insight moved').should('exist')
|
2020-07-10 19:21:30 +02:00
|
|
|
})
|
2021-04-09 00:57:12 +02:00
|
|
|
|
|
|
|
it('Opens dashboard item in insights', () => {
|
2021-06-29 22:20:02 +02:00
|
|
|
cy.get('[data-attr=dashboard-name]').contains('App Analytics').click()
|
2022-02-14 15:05:18 +01:00
|
|
|
cy.get('.InsightCard [data-attr=insight-card-title]').first().click()
|
2021-05-10 20:11:35 +02:00
|
|
|
cy.location('pathname').should('include', '/insights')
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=funnel-bar-graph]', { timeout: 30000 }).should('exist')
|
2021-04-09 00:57:12 +02:00
|
|
|
})
|
2022-03-21 21:55:16 +01:00
|
|
|
|
|
|
|
it('Add insight from empty dashboard', () => {
|
|
|
|
cy.get('[data-attr="new-dashboard"]').click()
|
|
|
|
cy.get('[data-attr=dashboard-name-input]').clear().type('Watermelon')
|
|
|
|
cy.get('button').contains('Create').click()
|
|
|
|
|
2022-04-04 20:50:33 +02:00
|
|
|
cy.get('[data-attr=dashboard-add-graph-header]').contains('Add insight').click()
|
2022-03-21 21:55:16 +01:00
|
|
|
cy.get('[data-attr=toast-close-button]').click()
|
|
|
|
cy.get('[data-attr=insight-save-button]').contains('Save & add to dashboard').click()
|
|
|
|
|
|
|
|
cy.wait(200)
|
|
|
|
cy.get('.page-title').contains('Watermelon').should('exist')
|
|
|
|
})
|
2020-05-19 20:48:10 +02:00
|
|
|
})
|