I've this setup in which I can use Nightwatch with mocha style
tests.js:
var nightwatch = require('nightwatch');
var config = require('./nightwatch.json');
describe('Github', function () {
//var client = nightwatch.initClient(config.test_settings.default);
var client = nightwatch.initClient(config);
var browser = client.api();
this.timeout(99999999);
before(function () {
browser.perform(function () {
console.log('beforeAll')
});
});
beforeEach(function (done) {
browser.perform(function () {
console.log('beforeEach')
});
client.start(done);
});
it('Demo test GitHub', function (done) {
browser
.url('https://github.com/nightwatchjs/nightwatch')
.waitForElementVisible('body', 5000)
.assert.title('GitHub - nightwatchjs/nightwatch: Automated testing and continous integration framework based on node.js and selenium webdriver');
client.start(done);
});
});
Which I execute as follows
$> ./node_modules/.bin/mocha ./tests.js
This works as long as I start the selenium-standalone myself. But what if I want to run my tests on Browserstack. Inside my nightwatch.json I can define "selenium" settings
{
"src_folders": ["tests"],
"selenium": {
"start_process": false,
"host": "hub-cloud.browserstack.com",
"port": 80
},
"test_settings": {
"default": {
"desiredCapabilities": {
"browserstack.user": "my-username",
"browserstack.key": "my-access-key",
"browserstack.debug": true,
"browser": "IE",
"resolution": "1024x768",
"project": "nightwatch",
"build": "mocha"
}
}
}
}
but that seems to be ignored. So the question is, considering the situation described above, how can I connect to a remote selenium server ?