2021-11-09 16:35:41 +01:00
|
|
|
const createAction = (actionName) => {
|
|
|
|
cy.get('[data-attr=create-action]').click()
|
|
|
|
cy.get('.ant-card-head-title').should('contain', 'event or pageview')
|
|
|
|
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-07-28 18:04:27 +02:00
|
|
|
cy.contains('Calculated event saved').should('exist')
|
2021-11-09 16:35:41 +01:00
|
|
|
}
|
|
|
|
|
2022-07-28 18:04:27 +02:00
|
|
|
function navigateToEventsTab() {
|
2022-03-14 19:31:59 +01:00
|
|
|
cy.clickNavMenu('datamanagement')
|
2022-07-28 18:04:27 +02:00
|
|
|
cy.get('[data-attr=data-management-events-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-07-28 18:04:27 +02:00
|
|
|
navigateToEventsTab()
|
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')
|
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-07-28 18:04:27 +02:00
|
|
|
navigateToEventsTab()
|
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-07-28 18:04:27 +02:00
|
|
|
cy.contains('Calculated event 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-07-28 18:04:27 +02:00
|
|
|
it('Click on an action event', () => {
|
|
|
|
cy.get('[data-attr=events-definition-table]').should('exist')
|
|
|
|
cy.get('[data-attr=event-type-filter]').click()
|
|
|
|
cy.get('[data-attr=event-type-option-action-event]').click()
|
|
|
|
cy.get(
|
|
|
|
'[data-row-key="0"] > .definition-column-name > .definition-column-name-content > :nth-child(1) > a'
|
|
|
|
).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
|
|
|
})
|
|
|
|
})
|