2020-09-21 14:49:34 +02:00
|
|
|
context("Create a automation", () => {
|
2020-09-14 14:29:32 +02:00
|
|
|
before(() => {
|
|
|
|
cy.server()
|
|
|
|
cy.visit("localhost:4001/_builder")
|
|
|
|
|
|
|
|
cy.createApp(
|
2020-09-21 14:49:34 +02:00
|
|
|
"Automation Test App",
|
|
|
|
"This app is used to test that automations do in fact work!"
|
2020-09-14 14:29:32 +02:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
// https://on.cypress.io/interacting-with-elements
|
2020-09-21 14:49:34 +02:00
|
|
|
it("should create a automation", () => {
|
2020-09-14 14:29:32 +02:00
|
|
|
cy.createTestTableWithData()
|
|
|
|
|
2020-09-21 14:49:34 +02:00
|
|
|
cy.contains("automate").click()
|
|
|
|
cy.contains("Create New Automation").click()
|
2020-09-14 14:29:32 +02:00
|
|
|
cy.get("input").type("Add Record")
|
|
|
|
cy.contains("Save").click()
|
|
|
|
|
|
|
|
// Add trigger
|
2020-09-21 14:49:34 +02:00
|
|
|
cy.get("[data-cy=add-automation-component]").click()
|
2020-09-14 14:29:32 +02:00
|
|
|
cy.get("[data-cy=RECORD_SAVED]").click()
|
2020-09-21 14:49:34 +02:00
|
|
|
cy.get("[data-cy=automation-block-setup]").within(() => {
|
2020-09-18 17:13:42 +02:00
|
|
|
cy.get("select")
|
|
|
|
.first()
|
|
|
|
.select("dog")
|
|
|
|
})
|
2020-09-14 14:29:32 +02:00
|
|
|
|
|
|
|
// Create action
|
2020-10-02 18:15:27 +02:00
|
|
|
cy.get("[data-cy=CREATE_RECORD]").click()
|
2020-09-21 14:49:34 +02:00
|
|
|
cy.get("[data-cy=automation-block-setup]").within(() => {
|
2020-09-18 17:13:42 +02:00
|
|
|
cy.get("select")
|
|
|
|
.first()
|
|
|
|
.select("dog")
|
|
|
|
cy.get("input")
|
|
|
|
.first()
|
|
|
|
.type("goodboy")
|
|
|
|
cy.get("input")
|
|
|
|
.eq(1)
|
|
|
|
.type("11")
|
|
|
|
})
|
2020-09-14 14:29:32 +02:00
|
|
|
|
|
|
|
// Save
|
2020-09-21 14:49:34 +02:00
|
|
|
cy.contains("Save Automation").click()
|
2020-09-14 14:29:32 +02:00
|
|
|
|
2020-09-21 14:49:34 +02:00
|
|
|
// Activate Automation
|
|
|
|
cy.get("[data-cy=activate-automation]").click()
|
2020-09-14 14:29:32 +02:00
|
|
|
cy.contains("Add Record").should("be.visible")
|
|
|
|
cy.get(".stop-button.highlighted").should("be.visible")
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should add record when a new record is added", () => {
|
|
|
|
cy.contains("backend").click()
|
|
|
|
cy.addRecord(["Rover", 15])
|
|
|
|
cy.reload()
|
|
|
|
cy.contains("goodboy").should("have.text", "goodboy")
|
|
|
|
})
|
|
|
|
})
|