webdriverio: MultiRemote capability does not work with webdriverio v5 but works with webdriverio v4

config works with v4 but does not work with v5

capabilities: { clientBrowser: { desiredCapabilities: { browserName: ‘chrome’ } }, agent: { desiredCapabilities: { browserName: ‘firefox’ } } }

versions that works “wdio-browserstack-service”: “^0.1.18”, “webdriverio”: “^4.14.1”,

Versions that gives error @wdio/browserstack-service”: “^5.12.5”, @wdio/cli”: “^5.12.5”,@wdio/devtools-service”: “^5.13.0”, “@wdio/local-runner”: “^5.12.5”, “@wdio/mocha-framework”: “^5.12.1”, “@wdio/spec-reporter”: “^5.12.1”, “@wdio/sync”: “^5.12.3”, “browserstack-local”: “^1.4.2”, “chromedriver”: “77.0.0”, “request”: “^2.88.0”, “wdio-chromedriver-service”: “^5.0.2”

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 (<anonymous>)\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)’ }

To Reproduce the issue

`var browserstack = require(‘browserstack-local’); exports.config = { runner: ‘local’, path: ‘/’, specs: [ ‘./TestFile.js’ ], user:‘’, key:‘’,

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, ‘proxyHost’: ‘’, ‘proxyPort’: ‘’’ }, 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: { client: { capabilities: { ‘os’ : ‘OS X’, ‘os_version’ : ‘Mojave’, ‘browserName’ : ‘Chrome’, ‘browser_version’ : ‘72.0’, ‘browserstack.local’ : ‘true’, ‘browserstack.selenium_version’ : ‘3.5.2’ } }, agent: { capabilities: { ‘os’ : ‘OS X’, ‘os_version’ : ‘Mojave’, ‘browserName’ : ‘Chrome’, ‘browser_version’ : ‘75.0’, ‘browserstack.local’ : ‘true’, ‘browserstack.selenium_version’ : ‘3.5.2’ } } },

// capabilities: [ // { // ‘os’ : ‘OS X’, // ‘os_version’ : ‘Mojave’, // ‘browserName’ : ‘Chrome’, // ‘browser_version’ : ‘72.0’, // ‘browserstack.local’ : ‘true’, // ‘browserstack.selenium_version’ : ‘3.5.2’ // }], // services: [‘chromedriver’], services: [‘browserstack’], logLevel: ‘error’, sync: true, bail: 0, waitforTimeout: 10000, connectionRetryTimeout: 90000, connectionRetryCount: 3, framework: ‘mocha’, reporters: [‘spec’], mochaOpts: { ui: ‘bdd’, timeout: 60000 } } ` Add the above multiremote capability and you could see the error displayed.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Hello, I have somehow the same issue.

We are using WebdriverIo v5 and browserstack, it works fine locally and on browserstack but we are recently trying to use multiremote and not sure why but it keeps trying to connect to selenium-hub. The function below returns the config, we are using for remote.

We have a function that connects to browserstack-local

async function startServer() {
  const spinner = ora(chalk.cyan('Connecting to BrowserStack')).start();
  return new Promise((resolve, reject) => {
    bsLocal.start(
      { key: bsKey, localIdentifier: commit, forceLocal: true },
      // eslint-disable-next-line consistent-return
      error => {
        if (error) {
          spinner.fail(chalk.red('Failed to connect to BrowserStack:', error));
          return reject(error);
        }
        if (commit) {
          spinner.succeed(
            chalk.cyan(`Connected to BrowserStack with identifier: ${commit}`),
          );
        }
        resolve();
      },
    );
  });
}

We created a dedicated function to create the client for mulit-remote

function setBrowserstackClientForRemote() /*: Array<?Object>*/ {
  const RESOLUTION = '1920x1080';
  return [
    {
      browserName: 'chrome',
      options: {
        capabilities: {
          os: 'Windows',
          os_version: '10',
          browserName: 'chrome',
          browser_version: '80.0',
          resolution: RESOLUTION,
          project: 'Atlaskit Webdriver Tests',
          build: BUILD_BRANCH_NAME,
          'browserstack.local': true,
          'browserstack.debug': true,
          'browserstack.idleTimeout': 300,
          'browserstack.localIdentifier': commit,
          user: process.env.BROWSERSTACK_USERNAME,
          key: process.env.BROWSERSTACK_KEY,
        },
      },
      services: ['browserstack'],
      logLevel: 'error',
      user: process.env.BROWSERSTACK_USERNAME,
      key: process.env.BROWSERSTACK_KEY,
      waitforTimeout: 3000,
    },
  ];
}```


When running with logging the command


  console.info node_modules/@wdio/logger/build/node.js:114
    2020-04-14T06:51:05.989Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session

  console.info node_modules/@wdio/logger/build/node.js:114
    2020-04-14T06:51:05.990Z INFO webdriver: DATA {
      capabilities: {
        alwaysMatch: {
          os: 'Windows',
          os_version: '10',
          browserName: 'chrome',
          browser_version: '80.0',
          resolution: '1920x1080',
          project: 'Atlaskit Webdriver Tests',
          build: 'rbellebon_local_run',
          'browserstack.local': true,
          'browserstack.debug': true,
          'browserstack.idleTimeout': 300,
          'browserstack.localIdentifier': 'rbellebon',
           user: xxxxx,
          key:xxxxxx,
          services: [Array],
          name: 'collab.ts'
        },
        firstMatch: [ {} ]
      },
      desiredCapabilities: {
        os: 'Windows',
        os_version: '10',
        browserName: 'chrome',
        browser_version: '80.0',
        resolution: '1920x1080',
        project: 'Atlaskit Webdriver Tests',
        build: 'rbellebon_local_run',
        'browserstack.local': true,
        'browserstack.debug': true,
        'browserstack.idleTimeout': 300,
        'browserstack.localIdentifier': 'rbellebon',
        user: xxxxx,
          key:xxxxxx,
        services: [ 'browserstack' ],
        name: 'collab.ts'
      }
    }

  console.info node_modules/@wdio/logger/build/node.js:114
    2020-04-14T06:51:05.993Z INFO webdriver: [POST] http://localhost:4444/wd/hub/session

  console.info node_modules/@wdio/logger/build/node.js:114
    2020-04-14T06:51:05.993Z INFO webdriver: DATA {
      capabilities: {
        alwaysMatch: {
          os: 'Windows',
          os_version: '10',
          browserName: 'chrome',
          browser_version: '80.0',
          resolution: '1920x1080',
          project: 'Atlaskit Webdriver Tests',
          build: 'rbellebon_local_run',
          'browserstack.local': true,
          'browserstack.debug': true,
          'browserstack.idleTimeout': 300,
          'browserstack.localIdentifier': 'rbellebon',
           user: xxxxx,
          key:xxxxxx,
          services: [Array],
          name: 'collab.ts'
        },
        firstMatch: [ {} ]
      },
      desiredCapabilities: {
        os: 'Windows',
        os_version: '10',
        browserName: 'chrome',
        browser_version: '80.0',
        resolution: '1920x1080',
        project: 'Atlaskit Webdriver Tests',
        build: 'rbellebon_local_run',
        'browserstack.local': true,
        'browserstack.debug': true,
        'browserstack.idleTimeout': 300,
        'browserstack.localIdentifier': 'rbellebon',
         user: xxxxx,
          key:xxxxxx,
        services: [ 'browserstack' ],
        name: 'collab.ts'
      }
    }


  ●  Cannot log after tests are done. Did you forget to wait for som
ething async in your test?
    Attempted to log "REJECTION Error: connect ECONNREFUSED 127.0.0.1:4444
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14) {
      errno: 'ECONNREFUSED',
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 4444
    }".

      37 | // Node promise rejection are now logged for debbugging
      38 | process.on('unhandledRejection', reason => {
    > 39 |   console.log('REJECTION', reason);
         |           ^
      40 | });
      41 | 
      42 | // We need to ensure that each test has at least one assertion.

      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14) {
        errno: 'ECONNREFUSED',
        code: 'ECONNREFUSED',
        syscall: 'connect',
        address: '127.0.0.1',
        port: 4444
      }".
      at CustomConsole.log (node_modules/@jest/console/build/CustomConsole.js:186:10)
      at process.<anonymous> (jestFrameworkSetup.js:39:11)
      at processEmit [as emit] (node_modules/signal-exit/index.js:155:32)

 FAIL  packages/editor/collab-provider/src/__tests__/integration/col
lab.ts (6.867s)
  collab.ts
    Chrome
      ✕ Enter simple strings between 2 tabs (23ms)

  ● collab.ts › Chrome › Enter simple strings between 2 tabs

    connect ECONNREFUSED 127.0.0.1:4444



Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        10.767s
Ran all test suites matching /\/Users\/rbellebon\/atlassian-frontend\/packages\/editor\/collab-provider\/src\/__tests__\/integration\/collab.ts/i.
Exiting tests with exit code: 1
Disconnecting from BrowserStack
error Error
error     at ChildProcess.<anonymous> (/Users/rbellebon/.config/yarn/global/node_modules/bolt/dist/modern/utils/processes.js:124:16)
➜  atlassian-frontend git:(master) ✗ 

@mgrybyk Any chance we can re-open this to resolve the issue with it not working when browserstack.localis present?

If not, I can create a new ticket and reference this one.

Works fine now after creating the project from scratch as told by @mgrybyk . Thanks.