2020-09-03 13:02:15 +02:00
|
|
|
context('Create a workflow', () => {
|
2020-06-11 16:40:07 +02:00
|
|
|
|
|
|
|
before(() => {
|
2020-08-05 16:18:28 +02:00
|
|
|
cy.server()
|
2020-06-11 16:40:07 +02:00
|
|
|
cy.visit('localhost:4001/_builder')
|
2020-06-11 17:10:26 +02:00
|
|
|
|
2020-06-11 16:40:07 +02:00
|
|
|
cy.createApp('Workflow Test App', 'This app is used to test that workflows do in fact work!')
|
|
|
|
})
|
|
|
|
|
|
|
|
// https://on.cypress.io/interacting-with-elements
|
|
|
|
it('should create a workflow', () => {
|
2020-09-03 13:02:15 +02:00
|
|
|
cy.createTestTableWithData()
|
2020-06-11 16:40:07 +02:00
|
|
|
|
|
|
|
cy.contains('workflow').click()
|
2020-08-05 16:18:28 +02:00
|
|
|
cy.contains('Create New Workflow').click()
|
2020-06-11 16:40:07 +02:00
|
|
|
cy.get('input').type('Add Record')
|
|
|
|
cy.contains('Save').click()
|
|
|
|
|
2020-06-11 17:10:26 +02:00
|
|
|
// Add trigger
|
2020-06-11 16:40:07 +02:00
|
|
|
cy.get('[data-cy=add-workflow-component]').click()
|
2020-06-11 17:10:26 +02:00
|
|
|
cy.get('[data-cy=RECORD_SAVED]').click()
|
|
|
|
cy.get('.budibase__input').select('dog')
|
2020-06-11 16:40:07 +02:00
|
|
|
|
2020-06-11 17:10:26 +02:00
|
|
|
// Create action
|
2020-06-11 16:40:07 +02:00
|
|
|
cy.get('[data-cy=SAVE_RECORD]').click()
|
2020-09-03 13:02:15 +02:00
|
|
|
cy.get('.container input').first().type('goodboy')
|
|
|
|
cy.get('.container input').eq(1).type('11')
|
2020-06-11 16:40:07 +02:00
|
|
|
|
|
|
|
// Save
|
2020-08-05 16:18:28 +02:00
|
|
|
cy.contains('Save Workflow').click()
|
2020-06-11 16:40:07 +02:00
|
|
|
|
2020-06-11 17:10:26 +02:00
|
|
|
// Activate Workflow
|
|
|
|
cy.get('[data-cy=activate-workflow]').click()
|
2020-09-03 13:02:15 +02:00
|
|
|
cy.contains("Add Record").should("be.visible")
|
|
|
|
cy.get(".stop-button.highlighted").should("be.visible")
|
2020-06-11 16:40:07 +02:00
|
|
|
})
|
2020-06-11 17:10:26 +02:00
|
|
|
|
2020-09-03 13:02:15 +02:00
|
|
|
it('should add record when a new record is added', () => {
|
|
|
|
cy.contains('backend').click()
|
2020-06-11 17:10:26 +02:00
|
|
|
|
2020-09-03 13:02:15 +02:00
|
|
|
cy.addRecord(["Rover", 15])
|
|
|
|
cy.reload()
|
2020-06-11 17:10:26 +02:00
|
|
|
cy.contains('goodboy').should('have.text', 'goodboy')
|
2020-06-11 16:40:07 +02:00
|
|
|
|
|
|
|
})
|
|
|
|
})
|