Update commands.js
A few formatting based changes for this file
This commit is contained in:
parent
9f1f9304bd
commit
348c4ed75b
|
@ -35,11 +35,13 @@ Cypress.Commands.add("login", () => {
|
||||||
Cypress.Commands.add("createApp", name => {
|
Cypress.Commands.add("createApp", name => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`).its('body').then((body) => {
|
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
||||||
if( body.length > 0) {
|
.its("body")
|
||||||
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
.then(body => {
|
||||||
}
|
if (body.length > 0) {
|
||||||
})
|
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
||||||
|
}
|
||||||
|
})
|
||||||
cy.contains(/Start from scratch/).dblclick()
|
cy.contains(/Start from scratch/).dblclick()
|
||||||
cy.get(".spectrum-Modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
||||||
|
@ -53,48 +55,55 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
if (val.length > 0) {
|
if (val.length > 0) {
|
||||||
cy.searchForApplication(name)
|
cy.searchForApplication(name)
|
||||||
cy.get(".appGrid").children().within(() => {
|
cy.get(".appGrid")
|
||||||
cy.get(".title").children().within(() => {
|
.children()
|
||||||
cy.get(".spectrum-Icon").click()
|
.within(() => {
|
||||||
|
cy.get(".title")
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(".spectrum-Icon").click()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
cy.get(".spectrum-Menu").contains("Delete").click()
|
||||||
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
|
cy.get("input").type(name)
|
||||||
})
|
})
|
||||||
})
|
cy.get(".spectrum-Button--warning").click()
|
||||||
cy.get(".spectrum-Menu").contains("Delete").click()
|
} else {
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
return
|
||||||
cy.get("input").type(name)
|
}
|
||||||
})
|
})
|
||||||
cy.get(".spectrum-Button--warning").click()
|
})
|
||||||
}
|
|
||||||
else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
Cypress.Commands.add("deleteAllApps", () => {
|
Cypress.Commands.add("deleteAllApps", () => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
for (let i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
cy.get(".spectrum-Heading").eq(1).then((app) => {
|
cy.get(".spectrum-Heading")
|
||||||
const name = app.text()
|
.eq(1)
|
||||||
cy.get(".title").children().within(() => {
|
.then(app => {
|
||||||
cy.get(".spectrum-Icon").eq(0).click()
|
const name = app.text()
|
||||||
})
|
cy.get(".title")
|
||||||
cy.get(".spectrum-Menu").contains("Delete").click()
|
.children()
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
.within(() => {
|
||||||
cy.get("input").type(name)
|
cy.get(".spectrum-Icon").eq(0).click()
|
||||||
cy.get(".spectrum-Button--warning").click()
|
})
|
||||||
})
|
cy.get(".spectrum-Menu").contains("Delete").click()
|
||||||
cy.reload()
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
})
|
cy.get("input").type(name)
|
||||||
}
|
cy.get(".spectrum-Button--warning").click()
|
||||||
})
|
})
|
||||||
|
cy.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("createTestApp", () => {
|
Cypress.Commands.add("createTestApp", () => {
|
||||||
|
@ -114,9 +123,12 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => {
|
||||||
cy.get(".add-button").click()
|
cy.get(".add-button").click()
|
||||||
}
|
}
|
||||||
cy.wait(7000)
|
cy.wait(7000)
|
||||||
cy.get(".spectrum-Modal").contains("Budibase DB").click().then(() => {
|
cy.get(".spectrum-Modal")
|
||||||
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
.contains("Budibase DB")
|
||||||
})
|
.click()
|
||||||
|
.then(() => {
|
||||||
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
||||||
|
})
|
||||||
cy.get(".spectrum-Modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.get("input").first().type(tableName).blur()
|
cy.get("input").first().type(tableName).blur()
|
||||||
|
@ -280,7 +292,7 @@ Cypress.Commands.add("searchForApplication", appName => {
|
||||||
cy.get(".filter").then(() => {
|
cy.get(".filter").then(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").eq(0).type(appName)
|
cy.get("input").eq(0).type(appName)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// Confirms app exists after search
|
// Confirms app exists after search
|
||||||
cy.get(".appGrid").contains(appName)
|
cy.get(".appGrid").contains(appName)
|
||||||
|
@ -290,7 +302,7 @@ Cypress.Commands.add("selectExternalDatasource", datasourceName => {
|
||||||
// Navigates to Data Section
|
// Navigates to Data Section
|
||||||
cy.navigateToDataSection()
|
cy.navigateToDataSection()
|
||||||
// Open Data Source modal
|
// Open Data Source modal
|
||||||
cy.get('.nav').within(() => {
|
cy.get(".nav").within(() => {
|
||||||
cy.get(".add-button").click()
|
cy.get(".add-button").click()
|
||||||
})
|
})
|
||||||
// Clicks specified datasource & continue
|
// Clicks specified datasource & continue
|
||||||
|
@ -306,55 +318,73 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
// Host IP Address
|
// Host IP Address
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".form-row").contains("Host").parent().children().within(() => {
|
cy.get(".form-row")
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
.contains("Host")
|
||||||
cy.get("input").clear().type("3.251.63.170")
|
.parent()
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
|
cy.get("input").clear().type("3.251.63.170")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
// Database Name
|
// Database Name
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".form-row").contains("Database").parent().children().within(() => {
|
cy.get(".form-row")
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
.contains("Database")
|
||||||
if (sqlType == "PostgreSQL") {
|
.parent()
|
||||||
cy.get("input").clear().type("test")
|
.children()
|
||||||
}
|
.within(() => {
|
||||||
if (sqlType == "MySQL") {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").clear().type("mysql")
|
if (sqlType == "PostgreSQL") {
|
||||||
}
|
cy.get("input").clear().type("test")
|
||||||
|
}
|
||||||
|
if (sqlType == "MySQL") {
|
||||||
|
cy.get("input").clear().type("mysql")
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
// User
|
// User
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".form-row").contains("User").parent().children().within(() => {
|
cy.get(".form-row")
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
.contains("User")
|
||||||
if (sqlType == "PostgreSQL") {
|
.parent()
|
||||||
cy.get("input").clear().type("admin")
|
.children()
|
||||||
}
|
.within(() => {
|
||||||
if (sqlType == "MySQL") {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").clear().type("root")
|
if (sqlType == "PostgreSQL") {
|
||||||
}
|
cy.get("input").clear().type("admin")
|
||||||
|
}
|
||||||
|
if (sqlType == "MySQL") {
|
||||||
|
cy.get("input").clear().type("root")
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
// Password
|
// Password
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".form-row").contains("Password").parent().children().within(() => {
|
cy.get(".form-row")
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
.contains("Password")
|
||||||
if (sqlType == "PostgreSQL") {
|
.parent()
|
||||||
cy.get("input").clear().type("8cb2b6f4-4b33-4e86-b790-74eee608a4e9")
|
.children()
|
||||||
}
|
.within(() => {
|
||||||
if (sqlType == "MySQL") {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").clear().type("abdc321d-4d21-4fc7-8d20-f40ab9fe6db0")
|
if (sqlType == "PostgreSQL") {
|
||||||
}
|
cy.get("input").clear().type("8cb2b6f4-4b33-4e86-b790-74eee608a4e9")
|
||||||
|
}
|
||||||
|
if (sqlType == "MySQL") {
|
||||||
|
cy.get("input").clear().type("abdc321d-4d21-4fc7-8d20-f40ab9fe6db0")
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
// Click to fetch tables
|
// Click to fetch tables
|
||||||
if (!noFetch){
|
if (!noFetch) {
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".spectrum-Button").contains("Fetch tables from database").click({ force: true })
|
cy.get(".spectrum-Button")
|
||||||
|
.contains("Fetch tables from database")
|
||||||
|
.click({ force: true })
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -370,7 +400,9 @@ Cypress.Commands.add("addRestDatasourceConfig", restUrl => {
|
||||||
})
|
})
|
||||||
// Click Save and continue to query
|
// Click Save and continue to query
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".spectrum-Button").contains("Save and continue to query").click({ force: true })
|
cy.get(".spectrum-Button")
|
||||||
|
.contains("Save and continue to query")
|
||||||
|
.click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue