Vitor Fernandes
github.com/vmlf01
Fullstack Developer at
KWAN + Toptal
Angular PT organizer
Angular/React
Node.js
.Net
Cypress is a next generation front-end testing tool
that can test anything that runs in a browser.
Open-source MIT License
14K+ GitHub Stars
615K+ npm weekly downloads
CLI Test Runner
Desktop App
Dashboard SaaS
The Cypress Test Runner runs in the context of the browser and uses the browser's automation APIs.
Cypress currently supports Electron or Chrome.
Under the hood, Cypress uses Mocha + Chai + Sinon,
so its syntax is very familar for most JS developers.
Cypress uses jQuery-like selectors
cy.get(".action-form")
.find('[type="text"]')
.type("HALFOFF");
Cypress uses Chai assertions. Common assertions include `exist`, `equal`, `deep.equal`,`have.length`, `contain`, `match`, `have.attr`, `have.class`
cy.get(".action-form")
.submit()
.next()
.should("contain", "Your form has been submitted!");
Cypress wraps all DOM queries with retry-and-timeout logic that better suits how real web apps work.
cy.get(".action-form")
.submit()
.next()
.should("contain", "Your form has been submitted!");
Cypress commands don’t do anything at the moment they are invoked, but rather enqueue themselves to be run later.
cy.get(".action-form")
.submit();
cy.get(".action-form")
.next()
.should("contain", "Your form has been submitted!");
Cypress allows you to make network requests or stub network responses.
// make a POST request to server
cy.request(
"POST",
"http://localhost:8888/users/admin",
{ name: "Jane" }
);
cy.server(); // enable response stubbing
cy.route({
method: "GET", // Route all GET requests
url: "/users/*", // that have a URL that matches '/users/*'
response: [] // and force the response to be: []
});
(https://github.com/mysticatea/npm-run-all)
(https://github.com/kimmobrunfeldt/concurrently)
https://github.com/testing-library/cypress-testing-library
https://www.classdojo.com/
Starting Context:
Part of ClassDojo DevEx team effort to:
Cypress seemed to be the quickest and easiest way to provide a reliable safety net to enable refactoring, without being too tied to internal implementation and structure.
https://docs.cypress.io/
https://slides.com/bahmutov/flawless-tests#/
https://testdriven.io/blog/testing-angular-with-cypress-and-docker/
https://www.youtube.com/channel/UC-EOsTo2l2x39e4JmSaWNRQ
https://nx.dev/angular/guides/modernize-cypress
https://www.cypress.io/blog/2019/01/17/using-nrwl-nx-to-add-cypress-to-your-angular-development-workflow/