Topic: cypress - lecture 11 - webdriveruniversity ContactUs form verification

//Regular lecture 37: 16-Nov-2022

//*Topic*//cypress - lecture 11//
//webdriveruniversity ContactUs form verification//

/// <reference types ="Cypress"/>

describe("webdriveruniversity ContactUs form", function(){

    it("test1 with correct details", function(){

        cy.visit("http://www.webdriveruniversity.com/Contact-Us/contactus.html")
        cy.get('[name="first_name"]').type('mahendra')
        cy.get('[name="last_name"]').type('bahubali')
        cy.get('[name="email"]').type('mahendra@mahishmati.com')
        cy.get('[name="message"]').type('i am king of mahishmati')
        cy.get('[type="submit"]').click()
        cy.wait(3000)
        cy.get('[id="contact_reply"]').children('h1').should('have.text', 'Thank You for your Message!')
    })

    it("test2 with incorrect details", function(){

        cy.visit("http://www.webdriveruniversity.com/Contact-Us/contactus.html")
        cy.get('[name="first_name"]').type('mahendra')
        cy.get('[name="last_name"]').type('bahubali')
        cy.get('[name="email"]').type('mahendra@mahishmati')
        cy.get('[name="message"]').type('i am king of mahishmati')
        cy.get('[type="submit"]').click()
        cy.wait(2000)
        cy.get('body').should('contain', ' Error: Invalid email address')
    })

    it.only("test3 reset button", function(){

        cy.visit("http://www.webdriveruniversity.com/Contact-Us/contactus.html")
        cy.get('[name="first_name"]').type('mahendra')
        cy.get('[name="last_name"]').type('bahubali')
        cy.get('[name="email"]').type('mahendra@mahishmati.com')
        cy.get('[name="message"]').type('i am king of mahishmati')
        cy.get('[type="reset"]').click()
        cy.wait(2000)
        cy.get('[name="first_name"]').should('be.empty')
    })
})

टिप्पण्या