O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing with Mocha

Protractor allows you to use a different testing framework. Jasmine is the supported default, but Mocha has limited default support as well. You can set the framework property in the config file to jasmine, mocha, or custom. When you set it to custom, you need to specify the relative path to the framework, for example, Cucumber, using the frameworkPath property.

Unfortunately, we cannot run multiple frameworks in the same test run like with Karma. Copy your config file, name it protractor.mocha.conf.js, and change the following properties:

onPrepare: function() {
   browser.resetUrl = 'file://';
   browser.ignoreSynchronization = true;
},
framework: 'mocha',
specs: ['selenium-mocha-tests.js'],

We also need to install Mocha globally ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required