Summary

End to end testing javascript, node, framework. Cypress uses Mocha’s BDD constructs for the development of test cases.

Useful commands

# first command that creats structure and opens a UI
./node_modules/cypress/bin/cypress open
# or
npx cypress open
# to run tests
./node_modules/cypress/bin/cypress run
# script command
"test": "./node_modules/cypress/bin/cypress run"

Mocha

ref Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.

Remember, Mocha is a testing frameworks. That means it’s used to organize and execute tests. When writing a test, there are two basic function calls you should be aware of: describe() and it(). Both are used in our above example.

Test examples

mocha testing examples

 describe('Suite', function() {
  describe('Inner Suite', function () {
    it('should do something when some condition is met', function () {
    });
  });

});