So this is a bit of a head scratcher.
If I run our Protractor e2e tests from a Jenkins job it fails with:
[10:23:53] I/local - Starting selenium standalone server...
[10:23:53] I/launcher - Running 1 instances of WebDriver
[10:23:54] I/local - Selenium standalone server started at http://10.0.0.5:43412/wd/hub
[10:23:56] E/launcher - Error: Error: Test `title` should be a "string" but "function" was given instead.
at new Test (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/mocha/lib/test.js:24:11)
at context.it.context.specify (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/mocha/lib/interfaces/bdd.js:84:18)
at /var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/testing/index.js:95:14
at context.xit.context.xspecify.context.it.skip (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/mocha/lib/interfaces/bdd.js:103:15)
at Function.skip (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/protractor/node_modules/selenium-webdriver/testing/index.js:98:14)
at Suite.<anonymous> (/var/jenkins/workspace/vw3-predevelop-linux/src/Ui/dev/test/endToEnd/presetInteractions.scenario.js:87:8)
at Object.create (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (/var/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_5.0.0/lib/node_modules/mocha/lib/interfaces/bdd.js:42:27)
at Object.<anonymous> (/var/jenkins/workspace/develop-linux/src/Ui/dev/test/endToEnd/presetInteractions.scenario.js:8:1)
at Module._compile (module.js:425:26)
[10:23:56] E/launcher - Process exited with error code 100
But, if I ssh to the machine, as the Jenkins user, with the same version of Node (5.0.0) and npm (3.3.6), with the same commands, the tests run just fine.
This is where it's throwing in mocha: https://github.com/mochajs/mocha/blob/master/lib/test.js#L24 but I can't figure out why it'd be "not a string" when Jenkins runs the test, but be just fine when I ssh in. I also checked our presetInteractions.scenario.js
file but it's no different than any of our other protractor files and there's certainly nothing weird about line 8...
var Utils = require('./utils');
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
describe('Preset interaction features', function() {
before(function(done) {
...
So, of course, it turns out to be a version mismatch. We had checked the versions of NPM, Node, and Protractor, but the versions of Mocha that were being used were indeed different (2.4.5 vs. 3.0.2). Rolling back to 2.4.5 eliminates this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With