How do you run webdriver io tests for different browsers in a loop?

With this a script is running that when an error occurs in one test, all others will fail. How do you make it so that they work independently of each other?

var combos = [
['Windows 7', 'firefox'],
['Windows 7', 'chrome'],
['Windows 7', 'iexplore'],
['Windows 7', 'opera'],
['Windows 8', 'firefox'],
['Windows 8', 'chrome'],
['Windows 8', 'iexplore'],
['Windows 8', 'opera']
];

combos.forEach(function(currentValue) {
var options = {
    desiredCapabilities: {
        browserName: currentValue[1],
        platform: currentValue[0]
    },
    host: 'ondemand.saucelabs.com',
    port: 80,
    user: [redacted],
    key: [redacted],
    logLevel: "verbose"
};

    var webdriverio = require('webdriverio');
    var client = webdriverio
    .remote(options)
    .init()
    .url('http://google.com')
    ...

});

      

+3


source to share


1 answer


Adding Try-Catch to your test should solve the following:



try {
    var webdriverio = require('webdriverio');
    var client = webdriverio
    .remote(options)
    .init()
    .url('http://google.com')
    ...
}
catch(err) {
    //log the error
} 

      

+1


source







All Articles