diff --git a/packages/builder/cypress/integration/createApp.spec.js b/packages/builder/cypress/integration/createApp.spec.js index 2cc3dd1ae1..34f152b540 100644 --- a/packages/builder/cypress/integration/createApp.spec.js +++ b/packages/builder/cypress/integration/createApp.spec.js @@ -1,5 +1,6 @@ context("Create an Application", () => { it("should create a new application", () => { + cy.login() cy.createTestApp() cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.contains("Cypress Tests").should("exist") diff --git a/packages/builder/cypress/setup.js b/packages/builder/cypress/setup.js index 7b849eb887..1b31d09004 100644 --- a/packages/builder/cypress/setup.js +++ b/packages/builder/cypress/setup.js @@ -29,14 +29,3 @@ async function run() { } run() - -// TODO: ensure that this still works -// initialiseBudibase({ dir: homedir, clientId: "cypress-test" }) -// .then(() => { -// delete require.cache[require.resolve("../../server/src/environment")] -// const xPlatHomeDir = homedir.startsWith("~") -// ? join(homedir(), homedir.substring(1)) -// : homedir -// run(xPlatHomeDir) -// }) -// .catch(e => console.error(e)) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 9cebfd81dc..420d8cb0de 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -24,6 +24,19 @@ // -- This will overwrite an existing command -- // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) +Cypress.Commands.add("login", name => { + cy.visit(`localhost:${Cypress.env("PORT")}/builder`) + cy.contains("Create Test User").click() + cy.get("input") + .first() + .type("test@test.com") + + cy.get('input[type="password"]').type("test") + + cy.contains("Login").click() + cy.wait(1000) +}) + Cypress.Commands.add("createApp", name => { cy.visit(`localhost:${Cypress.env("PORT")}/builder`) // wait for init API calls on visit @@ -44,12 +57,6 @@ Cypress.Commands.add("createApp", name => { .type(name) .should("have.value", name) cy.contains("Next").click() - cy.get("input[name=email]") - .click() - .type("test@test.com") - cy.get("input[name=password]") - .click() - .type("test") cy.contains("Submit").click() cy.get("[data-cy=new-table]", { timeout: 20000, diff --git a/packages/builder/src/components/login/LoginForm.svelte b/packages/builder/src/components/login/LoginForm.svelte index ec4e525b11..5f29ce126e 100644 --- a/packages/builder/src/components/login/LoginForm.svelte +++ b/packages/builder/src/components/login/LoginForm.svelte @@ -40,7 +40,7 @@ } -
+