Skip to content

Instantly share code, notes, and snippets.

@maggiesavovska
Last active June 8, 2017 19:28
Show Gist options
  • Save maggiesavovska/b16da0b662af5ac599261e82ebd35e09 to your computer and use it in GitHub Desktop.
Save maggiesavovska/b16da0b662af5ac599261e82ebd35e09 to your computer and use it in GitHub Desktop.
webdriverio - integrating with crossbrowsertesting.com
1) Include the following in your webdriverio config
NOTE: max_duration is specific to crossbrowsertesting.com.
cbt will time out any test after 10 minutes unless you pass a "max_duration"
value in your capabilities.
desiredCapabilities: {max_duration:[[amount in seconds]]}
const cbtConfig = {
host: "hub.crossbrowsertesting.com",
port: 80,
user: [[INSERT YOUR USER NAME HERE]],
key: [[INSERT YOUR ACCESS KEY HERE]], // find this under the "Manage Account page"
desiredCapabilities:{max_duration:14400, ...}
};
2) If you pass an invalid or empty value for "browserName" in your capabilities
then cbt with fill the value in as "firefox". This causes the browser to never initialize.
Passing no "browserName" value fixes the issue but webdriverio does not allow that.
Therefore, you must grab the "type" value from the cbt browser api and run type.toLowerCase()
to get the correct value for "browserName". Any "type" value containing the word "Mobile" must be
parsed to remove "Mobile ". type.replace(/mobile\s/i, ''); If you are unsure if you are passing the correct value set your
logLevel in you wdio config to "verbose" and check what the desiredCapabilities get sent as.
3) Currently when running webdriverio-screenshot in cbt certain drivers such as chromedriver will intermittently crash. I assume that some of the js being executed in the browser by wdio-screenshot is what is causing it. I don't know of a solution so far.
4) This problem may or may not be only with cbt. In the desired capabilities the logLevel must be set to "WARN" or else there is a "timed out waiting for screenshot file" error on mobile which can cause the tests to be dropped. CAUTION: logLevel:'warn' (lowercase) will cause the driver to crash so make sure it's uppercase!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment