Skip to content

browserstack-local does not work with webdriverio v5 but works with webdriverio v4 #85

Open
@suchitrak

Description

@suchitrak

browserstack-local does not work with webdriverio V5 but works with V4 in mutiremote(https://webdriver.io/docs/multiremote.html) capability

wdio.conf.js
var browserstack = require('browserstack-local');
exports.config = {
user:'',
key: '',

specs: [
    './test/specs/**/*.js'
],
browserstackLocal: true,

onPrepare: function (config, capabilities) {
 console.log("Connecting local");
 return new Promise(function (resolve, reject) {
   exports.bs_local = new browserstack.Local();
   exports.bs_local.start({ 
             'key': exports.config.key
             }, function (error) {
     if (error) return reject(error);
     console.log('Connected. Now testing...');
     resolve();
   }); 
 });

},
onComplete: function (exitCode, config, capabilities,results) {
exports.bs_local.stop({function () { console.log("bslocal stopped") }});
},
capabilities: {
myChromeBrowser: {
capabilities: {
browserName: 'chrome'
}
},
myFirefoxBrowser: {
capabilities: {
browserName: 'firefox'
}
}
},
logLevel: 'info',
bail: 0,
baseUrl: '',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ['browserstack'],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
}

Basic.js

const assert = require('assert')

describe('webdriver.io page', () => {
it('should have the right title', () => {
myChromeBrowser.url('https://webdriver.io')
myFirefoxBrowser.url('https://google.com')
const title = browser.getTitle()
assert.strictEqual(title, 'WebdriverIO · Next-gen WebDriver test framework for Node.js')
})
})

package.json

{
"name": "browserstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@wdio/browserstack-service": "^5.12.5",
"@wdio/cli": "^5.13.1",
"@wdio/local-runner": "^5.13.1",
"@wdio/mocha-framework": "^5.12.1",
"@wdio/spec-reporter": "^5.12.1",
"@wdio/sync": "^5.13.0",
"browserstack-local": "^1.4.2",
"chromedriver": "^77.0.0",
"wdio-chromedriver-service": "^5.0.2"
}
}

Gives Error - ERROR: Required option "capabilities" is missing.

0-0 worker error { name: 'Error',
message: 'Required option "capabilities" is missing',
stack:
'Error: Required option "capabilities" is missing\n at validateConfig (node_modules/@wdio/config/build/utils.js:80:13)\n at Promise.all.browserNames.map.browserName (node_modules/webdriverio/build/index.js:68:47)\n at Array.map ()\n at multiremote (node_modules/webdriverio/build/index.js:67:34)\n at initialiseInstance (node_modules/@wdio/runner/build/utils.js:77:54)\n at Runner._initSession (node_modules/@wdio/runner/build/index.js:150:87)\n at Runner.run (node_modules/@wdio/runner/build/index.js:67:32)\n at processTicksAndRejections (internal/process/next_tick.js:81:5)' }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions