2020-09-22 00:49:34 +12:00
|
|
|
context("Create a automation", () => {
|
2020-09-15 00:29:32 +12:00
|
|
|
before(() => {
|
|
|
|
cy.server()
|
2021-02-04 05:09:48 +13:00
|
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`)
|
2020-09-15 00:29:32 +12:00
|
|
|
|
|
|
|
cy.createApp(
|
2020-09-22 00:49:34 +12:00
|
|
|
"Automation Test App",
|
|
|
|
"This app is used to test that automations do in fact work!"
|
2020-09-15 00:29:32 +12:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
// https://on.cypress.io/interacting-with-elements
|
2020-09-22 00:49:34 +12:00
|
|
|
it("should create a automation", () => {
|
2020-09-15 00:29:32 +12:00
|
|
|
cy.createTestTableWithData()
|
|
|
|
|
2020-09-22 00:49:34 +12:00
|
|
|
cy.contains("automate").click()
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.get("[data-cy=new-automation]").click()
|
2020-10-05 23:13:09 +13:00
|
|
|
cy.get(".modal").within(() => {
|
2020-10-10 07:10:28 +13:00
|
|
|
cy.get("input").type("Add Row")
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.get(".buttons").contains("Create").click()
|
2020-10-05 23:13:09 +13:00
|
|
|
})
|
2020-09-15 00:29:32 +12:00
|
|
|
|
|
|
|
// Add trigger
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.contains("Trigger").click()
|
|
|
|
cy.contains("Row Saved").click()
|
|
|
|
cy.get(".setup").within(() => {
|
|
|
|
cy.get("select").first().select("dog")
|
2020-09-19 03:13:42 +12:00
|
|
|
})
|
2020-09-15 00:29:32 +12:00
|
|
|
|
|
|
|
// Create action
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.contains("Action").click()
|
|
|
|
cy.contains("Create Row").click()
|
|
|
|
cy.get(".setup").within(() => {
|
|
|
|
cy.get("select").first().select("dog")
|
|
|
|
cy.get("input").first().type("goodboy")
|
|
|
|
cy.get("input").eq(1).type("11")
|
2020-09-19 03:13:42 +12:00
|
|
|
})
|
2020-09-15 00:29:32 +12:00
|
|
|
|
|
|
|
// Save
|
2020-09-22 00:49:34 +12:00
|
|
|
cy.contains("Save Automation").click()
|
2020-09-15 00:29:32 +12:00
|
|
|
|
2020-09-22 00:49:34 +12:00
|
|
|
// Activate Automation
|
|
|
|
cy.get("[data-cy=activate-automation]").click()
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.get(".ri-stop-circle-fill.highlighted").should("be.visible")
|
2020-09-15 00:29:32 +12:00
|
|
|
})
|
|
|
|
|
2020-10-10 07:10:28 +13:00
|
|
|
it("should add row when a new row is added", () => {
|
2020-10-28 04:26:07 +13:00
|
|
|
cy.contains("data").click()
|
2020-10-10 07:10:28 +13:00
|
|
|
cy.addRow(["Rover", 15])
|
2020-09-15 00:29:32 +12:00
|
|
|
cy.reload()
|
|
|
|
cy.contains("goodboy").should("have.text", "goodboy")
|
|
|
|
})
|
|
|
|
})
|