Update commands.js
A few formatting based changes for this file
This commit is contained in:
parent
9f598ef56c
commit
543fb1dcc6
|
@ -35,7 +35,9 @@ 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`)
|
||||||
|
.its("body")
|
||||||
|
.then(body => {
|
||||||
if (body.length > 0) {
|
if (body.length > 0) {
|
||||||
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
||||||
}
|
}
|
||||||
|
@ -57,8 +59,12 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
.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()
|
||||||
|
.within(() => {
|
||||||
|
cy.get(".title")
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Icon").click()
|
cy.get(".spectrum-Icon").click()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -67,8 +73,7 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
cy.get("input").type(name)
|
cy.get("input").type(name)
|
||||||
})
|
})
|
||||||
cy.get(".spectrum-Button--warning").click()
|
cy.get(".spectrum-Button--warning").click()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -81,9 +86,13 @@ Cypress.Commands.add("deleteAllApps", () => {
|
||||||
.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")
|
||||||
|
.eq(1)
|
||||||
|
.then(app => {
|
||||||
const name = app.text()
|
const name = app.text()
|
||||||
cy.get(".title").children().within(() => {
|
cy.get(".title")
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Icon").eq(0).click()
|
cy.get(".spectrum-Icon").eq(0).click()
|
||||||
})
|
})
|
||||||
cy.get(".spectrum-Menu").contains("Delete").click()
|
cy.get(".spectrum-Menu").contains("Delete").click()
|
||||||
|
@ -114,7 +123,10 @@ 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")
|
||||||
|
.contains("Budibase DB")
|
||||||
|
.click()
|
||||||
|
.then(() => {
|
||||||
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
||||||
})
|
})
|
||||||
cy.get(".spectrum-Modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
|
@ -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,7 +318,11 @@ 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")
|
||||||
|
.contains("Host")
|
||||||
|
.parent()
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
cy.get("input").clear().type("3.251.63.170")
|
cy.get("input").clear().type("3.251.63.170")
|
||||||
})
|
})
|
||||||
|
@ -314,7 +330,11 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
})
|
})
|
||||||
// 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")
|
||||||
|
.contains("Database")
|
||||||
|
.parent()
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
if (sqlType == "PostgreSQL") {
|
if (sqlType == "PostgreSQL") {
|
||||||
cy.get("input").clear().type("test")
|
cy.get("input").clear().type("test")
|
||||||
|
@ -327,7 +347,11 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
})
|
})
|
||||||
// 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")
|
||||||
|
.contains("User")
|
||||||
|
.parent()
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
if (sqlType == "PostgreSQL") {
|
if (sqlType == "PostgreSQL") {
|
||||||
cy.get("input").clear().type("admin")
|
cy.get("input").clear().type("admin")
|
||||||
|
@ -340,7 +364,11 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
})
|
})
|
||||||
// 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")
|
||||||
|
.contains("Password")
|
||||||
|
.parent()
|
||||||
|
.children()
|
||||||
|
.within(() => {
|
||||||
cy.get(".spectrum-Textfield").within(() => {
|
cy.get(".spectrum-Textfield").within(() => {
|
||||||
if (sqlType == "PostgreSQL") {
|
if (sqlType == "PostgreSQL") {
|
||||||
cy.get("input").clear().type("8cb2b6f4-4b33-4e86-b790-74eee608a4e9")
|
cy.get("input").clear().type("8cb2b6f4-4b33-4e86-b790-74eee608a4e9")
|
||||||
|
@ -354,7 +382,9 @@ Cypress.Commands.add("addSqlDatasourceConfig", (sqlType, noFetch) => {
|
||||||
// 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 a new issue