2020-06-11 16:40:07 +02:00
|
|
|
context('Create a workflow', () => {
|
|
|
|
|
|
|
|
before(() => {
|
|
|
|
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', () => {
|
|
|
|
cy.createModel('dog', 'name', 'age')
|
|
|
|
cy.createUser('bbuser', 'test', 'ADMIN')
|
|
|
|
|
|
|
|
|
|
|
|
cy.contains('workflow').click()
|
|
|
|
cy.get('.new-workflow-button').click()
|
|
|
|
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()
|
|
|
|
cy.get(':nth-child(2) > .budibase__input').type('goodboy')
|
|
|
|
cy.get(':nth-child(3) > .budibase__input').type('11')
|
|
|
|
|
|
|
|
// Save
|
|
|
|
cy.get('[data-cy=save-workflow-setup]').click()
|
|
|
|
cy.get('.workflow-button').click()
|
|
|
|
|
2020-06-11 17:10:26 +02:00
|
|
|
// Activate Workflow
|
|
|
|
cy.get('[data-cy=activate-workflow]').click()
|
|
|
|
|
2020-06-11 16:40:07 +02:00
|
|
|
})
|
2020-06-11 17:10:26 +02:00
|
|
|
it('should add record when a new record is added', () => {
|
|
|
|
cy.contains('backend').click()
|
|
|
|
|
|
|
|
cy.addRecord('bob', '15')
|
|
|
|
|
|
|
|
cy.contains('goodboy').should('have.text', 'goodboy')
|
2020-06-11 16:40:07 +02:00
|
|
|
|
|
|
|
})
|
|
|
|
})
|