Skip to main content

Running Protractor e2e tests within IntelliJ IDEA

Tip submitted by @SudharakaP and @yelhouti

This tip applies for JHipster v6.8.0 or above. By default, a JHipster project will have the following beforeLanuch function within the Protractor configuration file (src/test/javascript/protractor.conf.js).

beforeLaunch: function() {
require('ts-node').register({
project: 'tsconfig.e2e.json'
});
}

This will work well if Protractor tests are executed by running npm run e2e in the root folder of the project.

However, IntelliJ Ultimate also supports running Protractor tests within the IDE. If you want to use this method you will have to alter the beforeLanuch function as shown below;

beforeLaunch: function() {
require('ts-node').register({
project: '../../../tsconfig.e2e.json'
});
}

so that IntelliJ will know where to find the tsconfig.e2e.json file.

Note that after altering the protractor.conf.js file as above, npm run e2e will not work anymore so you'll have to rollback if you plan on using e2e tests using npm again.