E2E testing with a browser, why I choose Cypress over Selenium - Sat, Aug 7, 2021
The Cypress installation is done with one comand: "npm install cypress", is so simple and easy when comparing it with Selenium.
The Cypress installation is done with one comand: “npm install cypress”, is so simple and easy when comparing it with Selenium.
No dependencies, extra downloads, or changes to your code required.
Write tests easily and quickly, and watch them execute in real time as you build your web application.
Wanna see a more complex example? then read this repository to demonstrate real-world usage of Cypress testing methods, patterns, and workflows..
describe('form:login', () => {
var data = {
identifier: 'example@user.com',
password: 'examplePassword',
}
beforeEach(() => {
cy.visit('/login')
cy.getCy('identifier').type(data.identifier)
cy.getCy('password').type(data.password)
})
it("should redirect unauthenticated user to signin page", function () {
cy.visit("/personal")
cy.location("pathname").should("equal", "/signin")
})
it('displays form validation', () => {
cy.getCy('identifier').clear()
cy.get('form').submit()
cy.get('#errors').should('contain', 'First name is required')
})
it('can submit a valid form', () => {
cy.get('form').submit()
})
})