Fixing conditional issues.
This commit is contained in:
parent
e75b1338c2
commit
1f798f594d
|
@ -18,10 +18,6 @@ export function checkIfElementExists(el) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function isFirstApp() {
|
|
||||||
return checkIfElementExists(".empty-wrapper")
|
|
||||||
}
|
|
||||||
|
|
||||||
Cypress.Commands.add("login", () => {
|
Cypress.Commands.add("login", () => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
|
@ -47,35 +43,32 @@ 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)
|
||||||
isFirstApp().then(isFirst => {
|
cy.contains(/Create (new )?app/).click()
|
||||||
const buttonText = isFirst ? "Create app" : "Create new app"
|
cy.get(".spectrum-Modal")
|
||||||
cy.contains(buttonText).click()
|
.within(() => {
|
||||||
cy.get("body").then(() => {
|
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
||||||
cy.get(".spectrum-Modal")
|
cy.contains("Create app").click()
|
||||||
.within(() => {
|
})
|
||||||
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
.then(() => {
|
||||||
cy.contains("Create app").click()
|
cy.get("[data-cy=new-table]", {
|
||||||
})
|
timeout: 20000,
|
||||||
.then(() => {
|
}).should("be.visible")
|
||||||
cy.get("[data-cy=new-table]", {
|
|
||||||
timeout: 20000,
|
|
||||||
}).should("be.visible")
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("deleteApp", () => {
|
Cypress.Commands.add("deleteApp", () => {
|
||||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
cy.request(`localhost:${Cypress.env("PORT")}/api/applications?status=all`)
|
||||||
isFirstApp().then(isFirst => {
|
.its("body")
|
||||||
if (!isFirst) {
|
.then(val => {
|
||||||
cy.get(".hoverable > use").click()
|
console.log(val)
|
||||||
cy.contains("Delete").click()
|
if (val.length > 0) {
|
||||||
cy.get(".spectrum-Button--warning").click()
|
cy.get(".hoverable > use").click()
|
||||||
}
|
cy.contains("Delete").click()
|
||||||
})
|
cy.get(".spectrum-Button--warning").click()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("createTestApp", () => {
|
Cypress.Commands.add("createTestApp", () => {
|
||||||
|
|
Loading…
Reference in New Issue