Updating Automation cypress tests, now functional.
This commit is contained in:
parent
08fef5fabd
commit
069de1fdb1
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:10000/builder/",
|
||||
"baseUrl": "http://localhost:10001/builder/",
|
||||
"video": true,
|
||||
"projectId": "bmbemn",
|
||||
"env": {
|
||||
"PORT": "10000",
|
||||
"PORT": "10001",
|
||||
"JWT_SECRET": "test"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,31 +8,27 @@ context("Create a automation", () => {
|
|||
it("should create a automation", () => {
|
||||
cy.createTestTableWithData()
|
||||
|
||||
cy.contains("automate").click()
|
||||
cy.get("[data-cy=new-automation]").click()
|
||||
cy.get(".modal").within(() => {
|
||||
cy.contains("Automate").click()
|
||||
cy.get("[data-cy='new-screen'] > .spectrum-Icon").click()
|
||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||
cy.get("input").type("Add Row")
|
||||
cy.get(".buttons")
|
||||
.contains("Create")
|
||||
.click()
|
||||
cy.get(".spectrum-Button--cta").click()
|
||||
})
|
||||
|
||||
// Add trigger
|
||||
cy.contains("Trigger").click()
|
||||
cy.contains("Row Created").click()
|
||||
cy.get(".setup").within(() => {
|
||||
cy.get("select")
|
||||
.first()
|
||||
.select("dog")
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.contains("dog").click()
|
||||
})
|
||||
|
||||
// Create action
|
||||
cy.contains("Action").click()
|
||||
cy.contains("Create Row").click()
|
||||
cy.get(".setup").within(() => {
|
||||
cy.get("select")
|
||||
.first()
|
||||
.select("dog")
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.contains("dog").click()
|
||||
cy.get("input")
|
||||
.first()
|
||||
.type("goodboy")
|
||||
|
@ -45,12 +41,11 @@ context("Create a automation", () => {
|
|||
cy.contains("Save Automation").click()
|
||||
|
||||
// Activate Automation
|
||||
cy.get("[data-cy=activate-automation]").click()
|
||||
cy.get(".ri-stop-circle-fill.highlighted").should("be.visible")
|
||||
cy.get("[aria-label=PlayCircle]").click()
|
||||
})
|
||||
|
||||
it("should add row when a new row is added", () => {
|
||||
cy.contains("data").click()
|
||||
cy.contains("Data").click()
|
||||
cy.addRow(["Rover", 15])
|
||||
cy.reload()
|
||||
cy.contains("goodboy").should("have.text", "goodboy")
|
||||
|
|
|
@ -3,7 +3,9 @@ const path = require("path")
|
|||
|
||||
const tmpdir = path.join(require("os").tmpdir(), ".budibase")
|
||||
|
||||
const WORKER_PORT = "4002"
|
||||
// these run on ports we don't normally use so that they can run alongside the
|
||||
// normal development system
|
||||
const WORKER_PORT = "10002"
|
||||
const MAIN_PORT = cypressConfig.env.PORT
|
||||
process.env.BUDIBASE_API_KEY = "6BE826CB-6B30-4AEC-8777-2E90464633DE"
|
||||
process.env.NODE_ENV = "cypress"
|
||||
|
@ -12,8 +14,8 @@ process.env.PORT = MAIN_PORT
|
|||
process.env.JWT_SECRET = cypressConfig.env.JWT_SECRET
|
||||
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
|
||||
process.env.SELF_HOSTED = 1
|
||||
process.env.WORKER_URL = "http://localhost:4002/"
|
||||
process.env.MINIO_URL = "http://localhost:10000/"
|
||||
process.env.WORKER_URL = "http://localhost:10002/"
|
||||
process.env.MINIO_URL = `http://localhost:${MAIN_PORT}/`
|
||||
process.env.MINIO_ACCESS_KEY = "budibase"
|
||||
process.env.MINIO_SECRET_KEY = "budibase"
|
||||
process.env.COUCH_DB_USER = "budibase"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
Cypress.Commands.add("login", () => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.wait(100)
|
||||
cy.wait(500)
|
||||
cy.url().then(url => {
|
||||
if (url.includes("builder/admin")) {
|
||||
// create admin user
|
||||
|
@ -16,12 +16,14 @@ Cypress.Commands.add("login", () => {
|
|||
cy.get('input[type="password"]').eq(1).type("test")
|
||||
cy.contains("Create super admin user").click()
|
||||
}
|
||||
if (url.includes("builder/auth/login") || url.includes("builder/admin")) {
|
||||
// login
|
||||
cy.contains("Sign in to Budibase").then(() => {
|
||||
cy.get("input").first().type("test@test.com")
|
||||
cy.get('input[type="password"]').type("test")
|
||||
cy.get("button").first().click()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -44,30 +46,23 @@ Cypress.Commands.add("createApp", name => {
|
|||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add("deleteApp", name => {
|
||||
cy.contains("Create your first app").then($first => {
|
||||
if ($first.length === 1) {
|
||||
return
|
||||
}
|
||||
Cypress.Commands.add("deleteApp", () => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.get(".app").then($app => {
|
||||
cy.wait(1000)
|
||||
if ($app.find(`[data-cy="app-${name}"]`).length) {
|
||||
cy.get(`[data-cy="app-${name}"]`).contains("Open").click()
|
||||
cy.get("[data-cy=settings-icon]").click()
|
||||
cy.get(".spectrum-Dialog").within(() => {
|
||||
cy.contains("Danger Zone").click()
|
||||
cy.get("input").type("DELETE").blur()
|
||||
cy.contains("Delete Entire App").click()
|
||||
})
|
||||
|
||||
const firstAppHeader = Object.values(Cypress.$("h1")).filter(
|
||||
$h1 => typeof $h1 === "string" && $h1.includes("Create your first app")
|
||||
)
|
||||
if (firstAppHeader.length === 0) {
|
||||
cy.get(".hoverable > use").click()
|
||||
cy.contains("Delete").click()
|
||||
cy.get(".spectrum-Button--warning").click()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add("createTestApp", () => {
|
||||
const appName = "Cypress Tests"
|
||||
cy.deleteApp(appName)
|
||||
cy.deleteApp()
|
||||
cy.createApp(appName, "This app is used for Cypress testing.")
|
||||
})
|
||||
|
||||
|
@ -98,8 +93,10 @@ Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
|||
|
||||
// Unset table display column
|
||||
cy.contains("display column").click({ force: true })
|
||||
cy.get("select").select(type)
|
||||
cy.contains("Save").click()
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.contains(type).click()
|
||||
|
||||
cy.contains("Save Column").click()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Cypress.Cookies.defaults({
|
||||
preserve: "budibase:auth",
|
||||
})
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import "./commands"
|
||||
import "./cookies"
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
"cy:run": "cypress run",
|
||||
"cy:open": "cypress open",
|
||||
"cy:run:ci": "cypress run --record --key f308590b-6070-41af-b970-794a3823d451",
|
||||
"cy:test": "start-server-and-test cy:setup http://localhost:10000/builder cy:run",
|
||||
"cy:ci": "start-server-and-test cy:setup http://localhost:10000/builder cy:run:ci",
|
||||
"cy:debug": "start-server-and-test cy:setup http://localhost:10000/builder cy:open"
|
||||
"cy:test": "start-server-and-test cy:setup http://localhost:10001/builder cy:run",
|
||||
"cy:ci": "start-server-and-test cy:setup http://localhost:10001/builder cy:run:ci",
|
||||
"cy:debug": "start-server-and-test cy:setup http://localhost:10001/builder cy:open"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
|
|
Loading…
Reference in New Issue