2022-12-30 11:23:09 +01:00
|
|
|
const createAction = (actionName: string): void => {
|
2021-11-09 16:35:41 +01:00
|
|
|
cy.get('[data-attr=create-action]').click()
|
2022-09-01 10:45:10 +02:00
|
|
|
cy.get('.LemonButton').should('contain', 'From event or pageview')
|
2021-11-09 16:35:41 +01:00
|
|
|
cy.get('[data-attr=new-action-pageview]').click()
|
2022-02-02 15:50:28 +01:00
|
|
|
cy.get('[data-attr=action-name-create]').should('exist')
|
2021-11-09 16:35:41 +01:00
|
|
|
|
2022-02-02 15:50:28 +01:00
|
|
|
cy.get('[data-attr=action-name-create]').type(actionName)
|
2021-11-09 16:35:41 +01:00
|
|
|
cy.get('.ant-radio-group > :nth-child(3)').click()
|
2022-08-18 17:37:10 +02:00
|
|
|
cy.get('[data-attr=edit-action-url-input]').click().type(Cypress.config().baseUrl)
|
2021-11-09 16:35:41 +01:00
|
|
|
|
|
|
|
cy.get('[data-attr=save-action-button]').click()
|
|
|
|
|
2022-09-20 14:46:40 +02:00
|
|
|
cy.contains('Action saved').should('exist')
|
2021-11-09 16:35:41 +01:00
|
|
|
}
|
|
|
|
|
2022-12-30 11:23:09 +01:00
|
|
|
function navigateToActionsTab(): void {
|
2022-03-14 19:31:59 +01:00
|
|
|
cy.clickNavMenu('datamanagement')
|
2022-09-20 14:46:40 +02:00
|
|
|
cy.get('[data-attr=data-management-actions-tab]').click()
|
2021-11-09 16:35:41 +01:00
|
|
|
}
|
|
|
|
|
2022-07-28 18:04:27 +02:00
|
|
|
describe('Action Events', () => {
|
2021-11-09 16:35:41 +01:00
|
|
|
let actionName
|
2020-05-22 18:34:48 +02:00
|
|
|
beforeEach(() => {
|
2022-09-20 14:46:40 +02:00
|
|
|
navigateToActionsTab()
|
2021-11-09 16:35:41 +01:00
|
|
|
actionName = Cypress._.random(0, 1e6)
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
|
2022-07-28 18:04:27 +02:00
|
|
|
it('Create action event', () => {
|
2021-11-09 16:35:41 +01:00
|
|
|
createAction(actionName)
|
2021-07-20 14:11:57 +02:00
|
|
|
|
|
|
|
// Test the action is immediately available
|
2021-11-25 15:39:49 +01:00
|
|
|
cy.clickNavMenu('insight')
|
2023-03-16 14:56:22 +01:00
|
|
|
cy.get('[data-attr="sidebar-new-insights-overlay"][data-attr-insight-type="TRENDS"]').click()
|
2021-07-20 14:11:57 +02:00
|
|
|
|
|
|
|
cy.contains('Add graph series').click()
|
2021-10-15 08:18:15 +02:00
|
|
|
cy.get('[data-attr=taxonomic-filter-searchfield]').type(actionName)
|
2021-07-22 20:40:49 +02:00
|
|
|
cy.get('[data-attr=taxonomic-tab-actions]').click()
|
|
|
|
cy.get('[data-attr=prop-filter-actions-0]').click()
|
2021-10-15 08:18:15 +02:00
|
|
|
cy.get('[data-attr=trend-element-subject-1] span').should('contain', actionName)
|
|
|
|
})
|
|
|
|
|
2022-07-28 18:04:27 +02:00
|
|
|
it('Notifies when an action event with this name already exists', () => {
|
2021-11-09 16:35:41 +01:00
|
|
|
createAction(actionName)
|
2022-09-20 14:46:40 +02:00
|
|
|
navigateToActionsTab()
|
2021-11-09 16:35:41 +01:00
|
|
|
createAction(actionName)
|
|
|
|
|
2021-10-15 08:18:15 +02:00
|
|
|
// Oh noes, there already is an action with name `actionName`
|
2022-09-20 14:46:40 +02:00
|
|
|
cy.contains('Action with this name already exists').should('exist')
|
2021-10-15 08:18:15 +02:00
|
|
|
// Let's see it
|
|
|
|
cy.contains('Click here to edit').click()
|
|
|
|
// We should now be seeing the action from "Create action"
|
|
|
|
cy.get('[data-attr=edit-action-url-input]').should('have.value', Cypress.config().baseUrl)
|
2021-07-20 14:11:57 +02:00
|
|
|
})
|
|
|
|
|
2022-09-20 14:46:40 +02:00
|
|
|
it('Click on an action', () => {
|
|
|
|
cy.get('[data-attr=actions-table]').should('exist')
|
|
|
|
cy.get('[data-attr=action-link-0]').click()
|
2022-02-02 15:50:28 +01:00
|
|
|
cy.get('[data-attr=action-name-edit]').should('exist')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
})
|