Changing cypress commands.

This commit is contained in:
mike12345567 2021-05-24 16:32:42 +01:00
parent bd0f78e38e
commit 4268ea8eb0
1 changed files with 15 additions and 15 deletions

View File

@ -12,22 +12,22 @@ Cypress.Commands.add("login", () => {
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.get("button").then(btn => { // cy.get("button").then(btn => {
const adminUserButton = "Create super admin user" // const adminUserButton = "Create super admin user"
console.log(btn.first().first()) // console.log(btn.first().first())
if (!btn.first().contains(adminUserButton)) { // if (!btn.first().contains(adminUserButton)) {
// create admin user // // create admin user
cy.get("input").first().type("test@test.com") // cy.get("input").first().type("test@test.com")
cy.get('input[type="password"]').first().type("test") // cy.get('input[type="password"]').first().type("test")
cy.get('input[type="password"]').eq(1).type("test") // cy.get('input[type="password"]').eq(1).type("test")
cy.contains(adminUserButton).click() // cy.contains(adminUserButton).click()
} // }
// login // 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.contains("Login").click() cy.contains("Login").click()
}) // })
}) })
}) })