Protractor stacktrace does not mention the line number on the .js file where the syntax issue or error occurs - protractor

This is my conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['C:\\Users\\meiyer\\Desktop\\Protractor_Tests\\specs\\specs.js'],
baseUrl: 'https://devcp.us.sunpowermonitor.com/#/dashboard',
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
//Options to be passed to Jasmine-node.
jasmineNodeOpts: {
onComplete: null,
isVerbose: true,
showColors: true,
includeStackTrace: true
}
};
This is my specs.js
var elhLoginpage = {
nameInput : element(by.model('user.UserName')),
passInput : element(by.model('model')),
submitButton :element(by.buttonText('sign in')),
setEmail: function(email) {
this.nameInput.sendKeys(email);
},
setPass: function(password) {
this.passInput.sendKeys(password);
},
clickSubmit:function(){
this.submitButton.click();
}
};
var elhHomepage = {
greetingText : element(by.css('.greeting-des')),
getgreetingText: function() {
this.greetingText.text();
}
};
describe('elhLoginpage login test', function() {
it('should land on homepage when valid username and password is entered',
function(){
elhLoginpage.setEmail('lease_id#test.com');
elhLoginpage.setPass('sun');
elhLoginpage.clickSubmit();
expect(elhHomepage.getgreetingText().toEqual('Hello lease');
});
});
I am executing the test on node.js command prompt as -> protractor conf.js. I am getting below stack trace. From the information below -I am not able to debug on which line number on either of the .js files the issue has occurred. Is there a way to activate this information on stacktrace?
Stacktrace -
C:\Users\meiyer\Desktop\Protractor_Tests>protractor conf.js
[15:40:56] I/hosted - Using the selenium server at
http://localhost:4444/wd/hub
[15:40:56] I/launcher - Running 1 instances of WebDriver
[15:40:58] E/launcher - Error: SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at
C:\Users\meiyer\AppData\Roaming\npm\node_modules\protractor\node_modules\
jasmine\lib\jasmine.js:71:5
at Array.forEach (native)
at Jasmine.loadSpecs
C:\Users\meiyer\AppData\Roaming\npm\node_modules\protr
actor\node_modules\jasmine\lib\jasmine.js:70:18)
[15:40:58] E/launcher - Process exited with error code 100

Unforunately that can be a common error in protractor for syntax issues. It's hard to tell without code indentation, but the error is about a missing ) and at a quick glance it looks like you are missing one in your final expect statement.
You have:
expect(elhHomepage.getgreetingText().toEqual('Hello lease');
It should be:
expect(elhHomepage.getgreetingText()).toEqual('Hello lease');
You can use linters like ES Lint to quickly find syntax errors like this.

Related

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type function. Received undefined

This issue showed up after trying to install Mongoose on my sapper project
util.js:157
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type function. Received undefined
at Object.inherits (util.js:157:11)
at Object.<anonymous> (<project path>\__sapper__\dev\server\server.js:140600:8)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
> Server crashed
<project path> is just my project path
I have a theory that this is caused by the bundling/minifying of the server code into a single file (__sapper__/dev/server.js), not sure how to fix it though.
My server rollup config, if it helps:
{
server: {
input: { server: config.server.input().server.replace(/\.js$/, '.ts') },
output: { ...config.server.output(), sourcemap },
plugins: [
replace({
'process.browser': false,
'process.env.NODE_ENV': JSON.stringify(mode),
'module.require': 'require',
}),
svelte({
generate: 'ssr',
dev,
preprocess,
}),
resolve({
dedupe: ['svelte'],
}),
commonjs({
sourceMap: !!sourcemap,
}),
typescript({
noEmitOnError: !dev,
sourceMap: !!sourcemap,
}),
json(),
],
external: [...Object.keys(pkg.dependencies).concat(
require('module').builtinModules || Object.keys(process.binding('natives')),
), 'saslprep'],
preserveEntrySignatures: 'strict'
},
}
the config is based mostly off this template
Not sure that this will help you because I don't know what Mangose or Sapper are, but I got this error when #google-cloud/storage was getting imported.
The solution was to not bundle it in:
nodeResolve({
preferBuiltins: true,
browser: false,
resolveOnly: ['#google-cloud/storage']
}),

browser is not catching given url when i am running the step definition file in protractor-cucumber

I am new to this protractor-cucumber.please correct me if i am going wrong.
i am using protractor 3.2.2
when i am run feature file, it gives correct output.but when i am run step definition, the browser not taking the given url.
My feature file is given below.
Feature: Login page test
Scenario: Verify whether the user is able to view the login page while
giving the URL.
Given I go to "http://localhost:4200/login"
When The URL of the page should be "http://localhost:4200/login"
My step definition file is given below.
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
this.Given('I go to {string}', function (string) {
browser.get(string);
});
this.When('The URL of the page should be {string}', function (string) {
expect(browser.getCurrentUrl()).to.eventually.equal(string);
});
}
My config. file is given below
exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
allScriptsTimeout: 11000,
specs: [
'features/*.feature'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/login',
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.js',
tags: false,
format: 'pretty',
profile: false,
'no-source': true
} };
The error showing when i am run 'protractor protractor.conf.js' is given below.
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
(node:7508) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use
os.tmpdir() instead.
[7884:6800:1229/145724.847:ERROR:browser_gpu_channel_host_factory.cc(107)]
Failed to launch GPU process.
DevTools listening on ws://127.0.0.1:12425/devtools/browser/74f2a81c-51c2-
4a8a-afec-26166a388d1f
C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protractor\node_modules\se
lenium-webdriver\http\index.js:365
onError(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:54206
at ClientRequest.<anonymous> (C:\Users\CS1027C\AppData\Roaming\npm\node_modu
les\protractor\node_modules\selenium-webdriver\http\index.js:365:15)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
From: Task: WebDriver.createSession()
at acquireSession (C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protrac
tor\node_modules\selenium-webdriver\lib\webdriver.js:62:22)
at Function.createSession (C:\Users\CS1027C\AppData\Roaming\npm\node_modules
\protractor\node_modules\selenium-webdriver\lib\webdriver.js:295:12)
at new Driver (C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protractor\
node_modules\selenium-webdriver\chrome.js:778:38)
at DirectDriverProvider.getNewDriver (C:\Users\CS1027C\AppData\Roaming\npm\n
ode_modules\protractor\built\driverProviders\direct.js:69:16)
at Runner.createBrowser (C:\Users\CS1027C\AppData\Roaming\npm\node_modules\p
rotractor\built\runner.js:203:37)
at C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protractor\built\runner
.js:293:21
at _fulfilled (C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protractor\
node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\CS1027C\AppData\Roaming\npm\node_modu
les\protractor\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\CS1027C\AppData\Roaming\npm\nod
e_modules\protractor\node_modules\q\q.js:796:13)
at C:\Users\CS1027C\AppData\Roaming\npm\node_modules\protractor\node_modules
\q\q.js:556:49
[launcher] Process exited with error code 1
From the error message:
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:54206,
your issue should caused by using lower chromedriver with higher Chrome browser, upgrade the chromedriver should fix your problem.
And change the cucumberOpts in your config file as below:
cucumberOpts: {
monochrome: true,
strict: true,
plugin: ["pretty"],
require: [
'features/step_definitions/*.js'
],
tags: ''
}
Change your step defintion file as below: (if you use Cucumber 1 or below)
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
this.Given('I go to "(.*?)"', function (url) {
browser.get(url);
});
this.When('The URL of the page should be "(.*?)"', function (url) {
expect(browser.getCurrentUrl()).to.eventually.equal(url);
});
};
Change your step defition file as below (if you use Cucumber 2 or above)
var {defineSupportCode} = require('cucumber');
defineSupportCode(function ({ Given, When, Then }) {
Given('I go to "(.*?)"', function (url) {
browser.get(url);
});
When('The URL of the page should be "(.*?)"', function (url) {
expect(browser.getCurrentUrl()).to.eventually.equal(url);
});
});

Unable to execute protractor test from eclipse

example-spec.js:
describe('Enter text in element on Protractor Example page', function() {
it ('to check that text entered in text box displays on page',function() {
browser.get('http://www.joecolantonio.com/ProtractorExample.html');
element(by.model('joeAngularText')).sendKeys('Joe Colantonio');
element(by.binding('joeAngularText')).getText().then(function(text){
console.log(text);
browser.pause();
});
});
});
Config file :
exports.config = {
seleniumAddress : 'http://localhost:4444/wd/hub',
capabilities : {
'browserName' : 'chrome'
},
specs : [ 'example_spec.js' ],
jasmineNodeOpts : {
onComplete : null,
isVerbose : false,
showColors : true,
includeStackTrace : true
}
};
This is the error when i try to execute above script from eclipse
node version: v6.10.1
protractor version 5.1.1
*D:\gdfgdf\Selenium\protractor\WS\Protractor\node_modules\protractor\built\logger.js:75
info(...msgs) {
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (D:\sdfds\Selenium\protractor\WS\Protractor\node_modules\protractor\built\configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)*
Replace the installed new version of the nodeJs file with the Eclipse NodeJs file. In windows go to the location where nodeJs installed C:\eclipse-jee-neon-3-win32-x86_64(1)\eclipse\plugins\tern.eclipse.ide.server.nodejs.embed.win32.win32.x86_64_1.2.0.201606160856\node-v4.2.4-win32-x86_64 and replace it with the newest one

Protractor: asynchronous script timeout: result was not received in 11 seconds

I'm facing a problem from one of my tests when executing them. I'm testing a non-angular site written on aurelia. I've set some configurations regarding the timeouts and to ignore synchronization. Still I'm facing the timeout problem - the stack trace is added at the end of the post. Here is my setup:
Protractor: 4.0.9
protractor.conf.js:
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
//seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['test/e2e/dist/**/*.js'],
plugins: [{
package: 'aurelia-tools/plugins/protractor'
}],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
},
framework: "jasmine2",
onPrepare: function(){ //configure junit xml report
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
filePrefix: 'e2e-results',
savePath: 'test/reports'
}));
}
};
Here is my conf.js for my specific tests:
exports.config = {
directConnect: true,
capabilities: {
'browserName': 'chrome'
},
restartBrowserBetweenTests: true,
//The address of a running selenium server.
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 180000
},
//Here we specify the name of the specs files.
specs: ['test/e2e/dist/**/*.js'],
getPageTimeout: 120000,
allScriptsTimeout: 120000,
onPrepare: function() {
browser.ignoreSynchronization = true;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 180000;
by.addLocator('valueBind', function (bindingModel, opt_parentElement) {
var using = opt_parentElement || document;
var matches = using.querySelectorAll('*[value\\.bind="' + bindingModel +'"]');
var result = undefined;
if (matches.length === 0) {
result = null;
} else if (matches.length === 1) {
result = matches[0];
} else {
result = matches;
}
return result;
});
}
}
And here is the beforeEach part of my test specification:
beforeEach(function(){
browser.driver.get(URL);
browser.driver.manage().window().maximize();
browser.ignoreSynchronization = true;
browser.driver.executeAsyncScript(
'var cb = arguments[arguments.length - 1];' +
'document.addEventListener("aurelia-composed", function (e) {' +
' cb("Aurelia App composed")' +
'}, false);'
).then(function(result){
console.log(result);
});
});
Stack trace
<![CDATA[ScriptTimeoutError: asynchronous script timeout: result was not received in 11 seconds
(Session info: chrome=53.0.2785.143)
(Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.3.9600 x86_64)
at WebDriverError (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:26:26)
at ScriptTimeoutError (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:291:26)
at Object.checkLegacyResponse (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:639:15)
at parseHttpResponse (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:538:13)
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:472:11
at ManagedPromise.invokeCallback_ (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2820:25
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
From: Task: WebDriver.executeScript()
at Driver.schedule (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
at Driver.executeAsyncScript (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:614:17)
at Object.<anonymous> (C:\Users\USER\Documents\Git\src\Project\test\e2e\dist\testspec.js:33:18)
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:23
at new ManagedPromise (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1082:7)
at controlFlowExecute (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:80:18)
at TaskQueue.execute_ (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2820:25
at C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
From: Task: Run beforeEach in control flow
at Object.<anonymous> (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:79:14)
at attemptAsync (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1980:24)
at QueueRunner.run (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1935:9)
at QueueRunner.execute (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1923:10)
at Spec.Env.queueRunnerFactory (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:714:35)
at Spec.execute (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:371:10)
at Object.fn (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2579:37)
at attemptAsync (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1980:24)
at QueueRunner.run (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1935:9)
at QueueRunner.execute (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1923:10)
From asynchronous test:
Error
at Suite.<anonymous> (C:\Users\USER\Documents\Git\src\Project\test\e2e\dist\testspec.js:22:2)
at addSpecsToSuite (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:867:25)
at Env.describe (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:836:7)
at jasmineInterface.describe (C:\Users\USER\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:3576:18)
at Object.<anonymous> (C:\Users\USER\Documents\Git\src\Project\test\e2e\dist\testspec.js:15:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)]]>
Any help would be appreciated, thank you.
I have found a soultion a little while ago but I forgot to post the answer. So here it is.
There is a Protractor plugin made by Aurelia. As I mentioned in my question the application which I'm automating is written via the Aurelia framework. So as I stared using this plugin and especially the loadAndWaitForAureliaPage method for loading pages everything started to work correctly.

Running protractor tests in windows

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)
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