Topic: cypress - lecture 5 - login tests

//Regular lecture 31: 10-Nov-2022

//*Topic*//cypress login tests//

// B) with incorrect username & password

describe("orange hrm login test", function(){

    it("with incorrect username & password", function(){
    cy.visit("https://opensource-demo.orangehrmlive.com/web/index.php/auth/login")
    cy.get('[name="username"]').type('Vijay')
    cy.get('[name="password"]').type('admin123')
    cy.get('[type="submit"]').click()
    cy.get('[class="oxd-text oxd-text--p oxd-alert-content-text"]')
    .should('contain', 'Invalid')
    })
    
})


//2) SwagLabs login test

//A) with valid credentials

describe("SwagLabs login test", function(){

    it("with valid username & password", function(){
        cy.visit("https://www.saucedemo.com/")
        cy.get('[id="user-name"]').type('problem_user')
        cy.get('[id="password"]').type('secret_sauce')
        cy.get('[id="login-button"]').click()
        cy.get('[class="title"]').should('contain','Products')
    })
})


//B) with invalid credentials : try urself

टिप्पण्या