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()
|
|
|
|
cy.get('h1').should('contain', 'Creating action')
|
|
|
|
|
|
|
|
cy.get('[data-attr=edit-action-input]').type(actionName)
|
|
|
|
cy.get('.ant-radio-group > :nth-child(3)').click()
|
|
|
|
cy.get('[data-attr=edit-action-url-input]').type(Cypress.config().baseUrl)
|
|
|
|
cy.wait(300)
|
|
|
|
cy.focused().should('have.attr', 'data-attr', 'edit-action-url-input')
|
|
|
|
|
|
|
|
cy.get('[data-attr=save-action-button]').click()
|
|
|
|
|
|
|
|
cy.contains('Action saved').should('exist')
|
|
|
|
}
|
|
|
|
|
|
|
|
function navigateToActionsTab() {
|
2022-01-14 18:34:24 +01:00
|
|
|
cy.clickNavMenu('events')
|
2021-11-09 16:35:41 +01:00
|
|
|
cy.get('[data-attr=events-actions-tab]').click()
|
|
|
|
}
|
|
|
|
|
2020-05-22 18:34:48 +02:00
|
|
|
describe('Actions', () => {
|
2021-11-09 16:35:41 +01:00
|
|
|
let actionName
|
2020-05-22 18:34:48 +02:00
|
|
|
beforeEach(() => {
|
2021-11-09 16:35:41 +01:00
|
|
|
navigateToActionsTab()
|
|
|
|
actionName = Cypress._.random(0, 1e6)
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Create action', () => {
|
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()
|
|
|
|
cy.get('[data-attr=trend-element-subject-1]').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)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Notifies when an action with this name already exists', () => {
|
2021-11-09 16:35:41 +01:00
|
|
|
createAction(actionName)
|
|
|
|
navigateToActionsTab()
|
|
|
|
createAction(actionName)
|
|
|
|
|
2021-10-15 08:18:15 +02:00
|
|
|
// Oh noes, there already is an action with name `actionName`
|
|
|
|
cy.contains('Action with this name already exists').should('exist')
|
|
|
|
// 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
|
|
|
})
|
|
|
|
|
|
|
|
it('Click on an action', () => {
|
|
|
|
cy.get('[data-attr=actions-table]').should('exist')
|
|
|
|
cy.get('[data-attr=action-link-0]').click()
|
|
|
|
cy.get('h1').should('contain', 'Editing action')
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
})
|