2020-05-22 18:34:48 +02:00
|
|
|
describe('Actions', () => {
|
2021-10-15 08:18:15 +02:00
|
|
|
let actionName = Cypress._.random(0, 1e6)
|
2020-05-22 18:34:48 +02:00
|
|
|
beforeEach(() => {
|
2021-06-09 16:58:34 +02:00
|
|
|
cy.clickNavMenu('events')
|
2020-11-13 14:59:08 +01:00
|
|
|
cy.get('[data-attr=events-actions-tab]').click()
|
2020-05-22 18:34:48 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Create action', () => {
|
|
|
|
cy.get('[data-attr=create-action]').click()
|
2020-05-27 12:26:36 +02:00
|
|
|
cy.get('.ant-card-head-title').should('contain', 'event or pageview')
|
|
|
|
cy.get('[data-attr=new-action-pageview]').click()
|
2020-11-05 13:55:33 +01:00
|
|
|
cy.get('h1').should('contain', 'Creating action')
|
2020-05-22 18:34:48 +02:00
|
|
|
|
2021-10-15 08:18:15 +02:00
|
|
|
cy.get('[data-attr=edit-action-input]').type(actionName)
|
2020-11-05 13:55:33 +01:00
|
|
|
cy.get('.ant-radio-group > :nth-child(3)').click()
|
2020-05-22 18:34:48 +02:00
|
|
|
cy.get('[data-attr=edit-action-url-input]').type(Cypress.config().baseUrl)
|
2021-08-18 20:13:43 +02:00
|
|
|
cy.wait(300)
|
|
|
|
cy.focused().should('have.attr', 'data-attr', 'edit-action-url-input')
|
|
|
|
|
2020-05-22 18:34:48 +02:00
|
|
|
cy.get('[data-attr=save-action-button]').click()
|
|
|
|
|
2020-05-27 12:26:36 +02:00
|
|
|
cy.contains('Action saved').should('exist')
|
2021-07-20 14:11:57 +02:00
|
|
|
|
|
|
|
// Test the action is immediately available
|
|
|
|
cy.clickNavMenu('insights')
|
|
|
|
|
|
|
|
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', () => {
|
|
|
|
// Let's create a whole new action, similarly to "Create action"
|
|
|
|
cy.get('[data-attr=create-action]').click()
|
|
|
|
cy.get('[data-attr=new-action-pageview]').click()
|
|
|
|
// This time we'll use a "Custom event" type match group
|
|
|
|
cy.get('[data-attr=edit-action-input]').type(actionName)
|
|
|
|
cy.get('.ant-radio-group > :nth-child(2)').click()
|
|
|
|
// Let's save the action
|
|
|
|
cy.get('[data-attr=save-action-button]').click()
|
|
|
|
// 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
|
|
|
})
|
|
|
|
})
|