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", () => {
it("should create a new application", () => {
cy.login()
cy.createTestApp()
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.contains("Cypress Tests").should("exist")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,22 +25,24 @@
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
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.contains("Create Test User").click()
cy.get("input")
.first()
.type("test@test.com")
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.get('input[type="password"]').type("test")
cy.contains("Login").click()
})
cy.contains("Login").click()
cy.wait(1000)
})
Cypress.Commands.add("createApp", name => {
cy.login()
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
// wait for init API calls on visit
cy.wait(100)