Skip to content

TypeError: Capabilities should be an object or Array! when using Browserstack helper #1868

@quekshuy

Description

@quekshuy

What are you trying to achieve?

Automated testing of a locally running web app using WebDriver + Browserstack (using @wdio/browserstack-service).

What do you get instead?

Error message:

(node:91880) UnhandledPromiseRejectionWarning: TypeError: Capabilities should be an object or Array!

Provide console output if related. Use --verbose mode for more details.

(node:91880) UnhandledPromiseRejectionWarning: TypeError: Capabilities should be an object or Array!
    at BrowserstackLauncherService.onPrepare (/Users/guest/dev/project/node_modules/@wdio/browserstack-service/build/launcher.js:43:13)
    at recorder.add (/Users/guest/dev/project/node_modules/codeceptjs/lib/plugin/wdio.js:206:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
(node:91880) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:91880) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
First test --
  ✖ "before all" hook: codeceptjs.beforeSuite for "First test" in 1ms
TypeError: Capabilities should be an object or Array!
(node:91880) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)

Provide test source code if related

N/A

Details

  • CodeceptJS version: 2.3.0
  • NodeJS Version: 10.16.0
  • Operating System: macOS 10.14.6
  • Protractor || WebDriverIO || Nightmare version (if related): webdriverio 5.12.4
  • Configuration file:
// browserstack.conf.js

const BROWSERSTACK_USERNAME = 'username'
const BROWSERSTACK_ACCESS_KEY = 'key'

// CAPABILITIES
const capabilities = {
  browserName: 'chrome',
  version: '66',
  os: 'Windows',
  os_version: '10',
  "browserstack.local": true,
  "browserstack.debug": true,
  chromeOptions: {
    args: ["--disable-notifications"],
  },
}

// HELPERS
config.helpers = {
  WebDriver: {
    url: 'https://localhost.dev',
    browser: 'chrome',
    restart: true,
    user: BROWSERSTACK_USERNAME,
    key: BROWSERSTACK_ACCESS_KEY,
    capabilities,
  },
  REST: {},
  BrowserstackHelper: {
    require: 'codeceptjs-bshelper',
    user: BROWSERSTACK_USERNAME,
    key: BROWSERSTACK_ACCESS_KEY,
    shortUrl: false, // this will break as well, PR submitted
  }
}

// PLUGINS
config.plugins['wdio'] = {
  enabled: true,
  services: ['browserstack'],
  user: BROWSERSTACK_USERNAME,
  key: BROWSERSTACK_ACCESS_KEY,
  browserstackLocal: true,
}

exports.config = config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions