Reputation: 115
my protractor was working fine and when updated it it couldnt open a simple spec file it always gives thsi error. I searched for a solution but couldnt find one the conf and spec files are samples from the protractor site itself im pasting the error below hope you could help. Thanks in advance
conf.js error
[09:10:06] E/configParser - error code: 105
[09:10:06] E/configParser - description: failed loading configuration file spec.js
C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130
throw new exitCodes_1.ConfigError(logger, 'failed loading configurat
ion file ' + filename);
^
Error
at ConfigError.ProtractorError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:10:22)
at new ConfigError (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\exitCodes.js:26:16)
at ConfigParser.addFileConfig (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130:19)
at Object.initFn [as init] (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\launcher.js:94:22)
at Object.<anonymous> (C:\Users\y\AppData\Roaming\npm\node_modules\protractor\built\cli.js:130:10)
at Module._compile (module.js:409:26)
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)
The conf and spec files are the sample ones from the site
conf.js:
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
spec.js
describe('Protractor Demo App', function() {
it('should have a title', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
Upvotes: 8
Views: 40801
Reputation: 1
The same issue i faced and i used as below to resolve.
exports.config = { directConnect: true, seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] };
Upvotes: 0
Reputation: 99
you need to be in the correct path, where conf.js is then run protractor conf.js
Upvotes: 0
Reputation: 61
It should work if you use
exports.config = {
seleniumAddress: "http://localhost:4444/wd/hub",
specs: ['spec.js'],
capabilities:{'browserName': 'chrome'},
onPrepare(){
browser.driver.manage().window().maximize();
},
onComplete(){
},
};
However make sure that webdriver-manager is updated or started or driver connection might be refused.
Upvotes: 0
Reputation: 1
I have faced the same issue . But it might be because we have not saved the file in visual studio whatever code we have written we have to save the file. I have saved it and then ran it and it worked fine for me. For me this was the solution. Whatever code we have written we have to save it before running it.
Upvotes: 0
Reputation: 191
I got this error because the content of the conf.js
is not valid.
I have wrongly used seleniumAddress= "http://localhost:4444/wd/hub"
instead of seleniumAddress: "http://localhost:4444/wd/hub"
(using equal =
instead of colon :
).
(Error 105 - Issue with the conf.js)
After changing the conf.js
it's working fine,
exports.config = {
seleniumAddress: "http://localhost:4444/wd/hub",
specs: ['spec.js'],
capabilities:{'browserName': 'chrome'},
onPrepare(){
browser.driver.manage().window().maximize();
},
onComplete(){
},
};
Upvotes: 0
Reputation: 1
I had the same problem (with another error code), and fixed adding the java path to the environment variables (SDK installer did'nt configure it automatically).
Upvotes: 0
Reputation: 17753
Per @jtzero's remark, the issue lies with the configuration parser masking the actual error message when loading the configuration file.
Depending on whether you run Protractor as global or from the folder, open up (C:\Users\y\AppData\Roaming\npm\
)node_modules\protractor\built\configParser.js
at line 130.
There you can add logger.error(e);
e.g:
/**
* Public function specialized towards merging in a file's config
*
* @public
* @param {String} filename
*/
ConfigParser.prototype.addFileConfig = function (filename) {
if (!filename) {
return this;
}
var filePath = path.resolve(process.cwd(), filename);
var fileConfig;
try {
fileConfig = require(filePath).config;
}
catch (e) {
logger.error(e);
throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename);
}
if (!fileConfig) {
throw new exitCodes_1.ConfigError(logger, 'configuration file ' + filename + ' did not export a config object');
}
fileConfig.configDir = path.dirname(filePath);
this.addConfig_(fileConfig, fileConfig.configDir);
return this;
};
This will then report the error in the output. In my case it was a failing call to require()
:
[10:36:29] E/configParser - { [Error: Cannot find module 'phantomjs'] code: 'MODULE_NOT_FOUND' }
Repored GitHub issue #3301: https://github.com/angular/protractor/issues/3301
Update
Protractor 4.0 will include a fix for this problem to report the masked error message with a stack trace.
Upvotes: 11
Reputation: 82
Passing correct path to conf.js file can be a solution. Try to navigate to folder, in which you have this file and then launch the command again.
Of course, point at conf.js file, not spec.
Upvotes: 2
Reputation: 39
You should be running the conf.js file, not the spec.js file.
It looks like you are running the command "protractor spec.js" when it should be "protractor conf.js". The error says it is looking for a configuration file but you are passing it a spec file.
Upvotes: 3