Closed ghost closed 10 years ago
I do not understand, what should produce that?
Thanks for response. I've following nightwatch test case in test.js
module.exports = {
testHomePage : function (browser) {
browser.options.desiredCapabilities.name = 'testHomePage'; //saucelabs needs this
browser
.url(this.baseUrl)
.waitForElementVisible('body', 1000)
.assert.containsText('#headerlink a', 'My Home Page')
.end();
}
};
And following grunt task:
grunt.registerTask('e2e-local', ['nightwatch:default']);
If I run nightwatch -e default
test runs without issue.
However if I run grunt task grunt e2e-local
I get following error:
An error occured while running the test:
TypeError: Cannot read property 'desiredCapabilities' of undefined
at Object.module.exports.testPcHeaderNavbarLinks (/Users/nbhattarai/Naren/sources/godaddy/riviera/test/client/e2e/home.js:13:20)
at startClient (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:89:16)
at tearDown (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:160:11)
at clientFn (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:239:16)
at setUp (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:144:11)
at /Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:242:7
at next (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:111:11)
at next (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:98:11)
at next [as _onTimeout] (/Users/nbhattarai/Naren/sources/godaddy/riviera/node_modules/grunt-nightwatch/node_modules/nightwatch/lib/runner/run.js:98:11)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Well, actually the browser
instance is injected by Nightwatch directly and there is no relation with the grunt-nightwatch
task itself.
By the way, there is any documentation about that feature on Saucelabs?
cc: @beatfactor
This will work when running nightwatch directly. So maybe it's an issue with the grunt-task you're using.. (?)
Well, indeed that's absolutely right but adding console.log(browser.options);
looks fine.
@narenb could you clone the repo and use the develop
branch for?
The problem was grunt-nightwatch package.json was referring to older nightwatch version 4.xx.
I updated to use 0.5.11 and it started working.
@pateketrueke I'm using following configuration i.e. nightwatch.json for saucelabs.
"default": {
"launch_url": "",
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"silent": true,
"username": "MY_USERNAME",
"access_key": "MY_ACCESS_KEY",
"screenshots": {
"enabled": false,
"path": ""
}
And using grunt-sauce-connect-launcher
to start VM. This is only needed if your test/dev servers are behind firewall.
Hi, Following code is not defined while using grunt-nightwatch module. browser.options.desiredCapabilities.name = 'testcaseName';
if I just use nightwatch outside of grunt it's passing.
Is desiredCapabilities.name available?