|
|
@ -6,21 +6,18 @@ |
|
|
//
|
|
|
//
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("login", () => { |
|
|
Cypress.Commands.add("login", () => { |
|
|
cy.getCookie("budibase:auth").then(cookie => { |
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) |
|
|
// Already logged in
|
|
|
cy.wait(100) |
|
|
if (cookie) return |
|
|
cy.url().then(url => { |
|
|
|
|
|
if (url.includes("builder/admin")) { |
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) |
|
|
// create admin user
|
|
|
|
|
|
cy.get("input").first().type("test@test.com") |
|
|
cy.url().then(url => { |
|
|
cy.get('input[type="password"]').first().type("test") |
|
|
if (url.includes("builder/admin")) { |
|
|
cy.get('input[type="password"]').eq(1).type("test") |
|
|
// create admin user
|
|
|
cy.contains("Create super admin user").click() |
|
|
cy.get("input").first().type("test@test.com") |
|
|
} |
|
|
cy.get('input[type="password"]').first().type("test") |
|
|
// login
|
|
|
cy.get('input[type="password"]').eq(1).type("test") |
|
|
cy.contains("Sign in to Budibase").then(() => { |
|
|
cy.contains("Create super admin user").click() |
|
|
|
|
|
} |
|
|
|
|
|
// login
|
|
|
|
|
|
cy.get("input").first().type("test@test.com") |
|
|
cy.get("input").first().type("test@test.com") |
|
|
cy.get('input[type="password"]').type("test") |
|
|
cy.get('input[type="password"]').type("test") |
|
|
cy.get("button").first().click() |
|
|
cy.get("button").first().click() |
|
|
@ -32,45 +29,39 @@ Cypress.Commands.add("createApp", name => { |
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) |
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) |
|
|
// wait for init API calls on visit
|
|
|
// wait for init API calls on visit
|
|
|
cy.wait(100) |
|
|
cy.wait(100) |
|
|
cy.contains("Create New Web App").click() |
|
|
cy.contains("Create app").click() |
|
|
cy.get("body") |
|
|
cy.get("body").then(() => { |
|
|
.then($body => { |
|
|
cy.get(".spectrum-Modal") |
|
|
if ($body.find("input[name=apiKey]").length) { |
|
|
.within(() => { |
|
|
// input was found, do something else here
|
|
|
cy.get("input").eq(0).type(name).should("have.value", name).blur() |
|
|
cy.get("input[name=apiKey]").type(name).should("have.value", name) |
|
|
cy.contains("Create app").click() |
|
|
cy.contains("Next").click() |
|
|
}) |
|
|
} |
|
|
.then(() => { |
|
|
}) |
|
|
cy.get("[data-cy=new-table]", { |
|
|
.then(() => { |
|
|
timeout: 20000, |
|
|
cy.get(".spectrum-Modal") |
|
|
}).should("be.visible") |
|
|
.within(() => { |
|
|
}) |
|
|
cy.get("input").eq(0).type(name).should("have.value", name).blur() |
|
|
}) |
|
|
cy.contains("Next").click() |
|
|
|
|
|
cy.get("input").eq(1).type("test@test.com").blur() |
|
|
|
|
|
cy.get("input").eq(2).type("test").blur() |
|
|
|
|
|
cy.contains("Submit").click() |
|
|
|
|
|
}) |
|
|
|
|
|
.then(() => { |
|
|
|
|
|
cy.get("[data-cy=new-table]", { |
|
|
|
|
|
timeout: 20000, |
|
|
|
|
|
}).should("be.visible") |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Cypress.Commands.add("deleteApp", name => { |
|
|
Cypress.Commands.add("deleteApp", name => { |
|
|
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) |
|
|
cy.contains("Create your first app").then($first => { |
|
|
cy.get(".apps").then($apps => { |
|
|
if ($first.length === 1) { |
|
|
cy.wait(1000) |
|
|
return |
|
|
if ($apps.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() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
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() |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|