Reputation: 880
I am trying to run some protractor tests in Windows but am getting the following error:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.44.10.127:55805/wd/hub
[launcher] Error: TypeError: Object #<Object> has no method 'forEach'
at new Plugins (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\lib\plugins.js:30:20)
at driverprovider_.setupEnv.then.then.then.then.frameworkPath (C:\Users\ueser\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:268:15)
at _fulfilled (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:826:30)
at Promise.promise.promiseDispatch (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:759:13)
at C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:573:44
at flush (C:\Users\user\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
And then
[launcher] Process exited with error code 100
Has anyone come across this before?
Update:
protractor conf.js file as follows:
'use strict';
var testConfig = require('../../testConfig');
exports.config = {
allScriptsTimeout: 11000,
suites: {
dev: ['domain/**/*Spec.js', 'common/**/*Spec.js'],
oldExtranetIntegration: ['integration/**/*Spec.js']
},
baseUrl: testConfig.baseUrl,
framework: 'jasmine',
onPrepare: function () {
/* global angular: false, browser: false, document: false */
// Disable animations so e2e tests run more quickly
var disableNgAnimate = function () {
angular.module('disableNgAnimate', []).run(function () {
var css = document.createElement('style');
css.type = 'text/css';
css.innerHTML = '* { -webkit-transition-duration: 5ms !important; transition-duration: 5ms !important; -webkit-animation-duration: 5ms !important; animation-duration: 5ms !important; }';
document.body.appendChild(css);
});
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
},
// Disabled settings for using chromedriver directly
//directConnect: true,
//chromedriver: '/node_modules/chromedriver/lib/chromedriver/chromedriver',
capabilities: {
browserName: 'phantomjs',
'phantomjs.binary.path': require('phantomjs').path
},
jasmineNodeOpts: {
defaultTimeoutInterval: 30000,
isVerbose: true
},
plugins: {
timeline: {
path: '../../../node_modules/protractor/plugins/timeline/',
// Output json and html will go in this folder.
outdir: 'timelines'
}
}
};
Also please note that the tests run OK on our Linux boxes. I had to install Windows SDK 7.1 to get Protractor to install successfully (even though I'm running Windows 8)
Upvotes: 2
Views: 992
Reputation: 880
I have identified that it is the "plugins" section of the configuration file causing the problem. If I comment it out completely the tests run.
If I change it to the following, they also run:
plugins: [{
timeline: {
path: '../../../node_modules/protractor/plugins/timeline/',
// Output json and html will go in this folder.
outdir: 'timelines'
}
}]
The only change is that I've added the plugin into an array object. I did this after looking at the "plugins.js" code for Protractor:
var Plugins = function(config) {
var self = this;
this.pluginConfs = config.plugins || [];
this.pluginObjs = [];
this.pluginConfs.forEach(function(pluginConf) {
var path;
if (pluginConf.path) {
path = ConfigParser.resolveFilePatterns(pluginConf.path, true,
config.configDir)[0];
} else {
path = pluginConf.package;
}
if (!path) {
throw new Error('Plugin configuration did not contain a valid path.');
}
pluginConf.name = path;
self.pluginObjs.push(require(path));
});
};
The tests ran fine on Linux (Ubuntu) without the array, but it was needed for running in Windows.
This was all caused by having protractor v1.5 installed, when the tests and configuration file were for protractor v1.3
Upvotes: 1