login step configured correctly

This commit is contained in:
Martin McKeaveney 2021-04-15 18:29:11 +01:00
parent 015bb72daf
commit 4c20427c33
9 changed files with 20 additions and 10 deletions

View File

@ -1,5 +1,6 @@
context("Create an Application", () => { context("Create an Application", () => {
it("should create a new application", () => { it("should create a new application", () => {
cy.login()
cy.createTestApp() cy.createTestApp()
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.contains("Cypress Tests").should("exist") cy.contains("Cypress Tests").should("exist")

View File

@ -1,5 +1,6 @@
context("Create a automation", () => { context("Create a automation", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
}) })

View File

@ -1,5 +1,6 @@
context("Create Bindings", () => { context("Create Bindings", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
cy.navigateToFrontend() cy.navigateToFrontend()
}) })

View File

@ -2,6 +2,7 @@ context("Create Components", () => {
let headlineId let headlineId
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
cy.createTable("dog") cy.createTable("dog")
cy.addColumn("dog", "name", "string") cy.addColumn("dog", "name", "string")

View File

@ -1,5 +1,6 @@
context("Screen Tests", () => { context("Screen Tests", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
cy.navigateToFrontend() cy.navigateToFrontend()
}) })

View File

@ -1,5 +1,6 @@
context("Create a Table", () => { context("Create a Table", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
}) })

View File

@ -1,5 +1,6 @@
context("Create a User", () => { context("Create a User", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
}) })

View File

@ -1,5 +1,6 @@
context("Create a View", () => { context("Create a View", () => {
before(() => { before(() => {
cy.login()
cy.createTestApp() cy.createTestApp()
cy.createTable("data") cy.createTable("data")
cy.addColumn("data", "group", "Text") cy.addColumn("data", "group", "Text")

View File

@ -25,22 +25,24 @@
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add("login", () => { Cypress.Commands.add("login", () => {
if (cy.getCookie("budibase:auth")) return cy.getCookie("budibase:auth").then(cookie => {
// Already logged in
if (cookie) return
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.contains("Create Test User").click() cy.contains("Create Test User").click()
cy.get("input") cy.get("input")
.first() .first()
.type("test@test.com") .type("test@test.com")
cy.get('input[type="password"]').type("test") cy.get('input[type="password"]').type("test")
cy.contains("Login").click()
})
cy.contains("Login").click()
cy.wait(1000)
}) })
Cypress.Commands.add("createApp", name => { Cypress.Commands.add("createApp", name => {
cy.login()
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)