Not able to configure multiple browser's os, os.version and browser version for Browserstack execution
What are you trying to achieve?
I want to run tests in browser stack on multiple browsers. When I say multiple browsers, I need privilege to configure its os, os.version and browser.version thru desiredCapabilities. I tried various possibilities but its not working.
What do you get instead?
A. Below errors. I know what it means but just to make sure I made the config file as advised from slack support.
paste output here
RangeError: Maximum call stack size exceeded
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:161:22)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
at replaceValue (/usr/local/lib/node_modules/codeceptjs/lib/command/run-multiple.js:172:7)
### Details
* CodeceptJS version: 1.4.3
* NodeJS Version: 6.4.1
* Operating System: Mac
* WebDriverIO version: 4.13.2
* Configuration file:
{
"tests": "./end2end/tests/web/collectionOrder_01_test.js",
"output": "./output",
"multiple": {
"basic": {
"browsers": [
{
"desiredCapabilities": {
"browser": "safari",
"browserstack.os": "OS X",
"browserstack.os_version": "High Sierra",
"windowSize": "maximize",
"browserstack.local": false,
"browserstack.video": true,
"ignoreHTTPSErrors": true,
"acceptInsecureCerts": true,
"acceptInvalidCerts": true,
"acceptSslCerts": true
}
},
{
"desiredCapabilities": {
"browser": "chrome",
"browserstack.os": "OS X",
"browserstack.os_version": "High Sierra",
"windowSize": "maximize",
"browserstack.local": false,
"browserstack.video": true,
"ignoreHTTPSErrors": true,
"acceptInsecureCerts": true,
"acceptInvalidCerts": true,
"acceptSslCerts": true
}
}
]
}
},
"helpers": {
"WebDriverIO": {
"url": "https://hidden.com/",
"browser": "Chrome",
"user": "hidden",
"key": "hidden"
},
"WebDriverIOHelper": {
"require": "./end2end/utility/webdriverio_helper.js"
}
},
"include": {
"homePage": "./end2end/pageObjects/homePage",
},
"bootstrap": false,
"mocha": {},
"name": "codecept",
"plugins": {
"allure": {
"enabled": true
}
}
}
**Run Command**: codeceptjs run-multiple basic
1st Problem is in wrong parameters in config.
Browserstack supports os and os_version instead of browserstack.os and browserstack.os_version.
2nd problem is about maximum callstack.
Don't use browser in desiredCapabilities.
Array for multiple coniguration should consist of browser names (like chrome) or WebDriverIO configuration objects (object with 'browser' and 'desiredCapabilities' -
https://codecept.io/helpers/WebDriverIO/#configuration)
Your should look's like this:
{
"tests": "./end2end/tests/web/collectionOrder_01_test.js",
"output": "./output",
"multiple": {
"basic": {
"browsers": [
"chrome",
{
"browser": "safari",
"desiredCapabilities": {
"os": "OS X",
"os_version": "High Sierra",
"resolution": "maximize"
}
},
{
"browser": "chrome",
"desiredCapabilities": {
"os": "OS X",
"os_version": "High Sierra",
"resolution": "maximize"
}
}
]
}
},
"helpers": {
"WebDriverIO": {
"url": "https://hidden.com/",
"browser": "Chrome",
"user": "hidden",
"key": "hidden",
"desiredCapabilities": {
"browserstack.local": false,
"browserstack.video": true,
"ignoreHTTPSErrors": true,
"acceptInsecureCerts": true,
"acceptInvalidCerts": true,
"acceptSslCerts": true
}
},
"WebDriverIOHelper": {
"require": "./end2end/utility/webdriverio_helper.js"
}
},
"include": {
"homePage": "./end2end/pageObjects/homePage"
},
"bootstrap": false,
"mocha": {},
"name": "codecept",
"plugins": {
"allure": {
"enabled": true
}
}
}
For correct parameters use BrowserStack configuration tool https://www.browserstack.com/automate/capabilities
Awesome . . . Thanks !
@elukoyanov do you know how to (following your example above) trigger the bootstrap and teardown once? My issue is with browserstack.local enabled.
Before start to use multiple I am launching the bootstrap and teardown, this works fine, but once I run multiple, the bootstrap is being launched multiple times and the browserstack-local fails.
Error: Error while running bootstrap file :LocalError: Either another browserstack local client is running on your machine or some server is listening on port 45691
bootstrap
const browserstack = require('browserstack-local');
const key = process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACC_KEY';
module.exports = function(done) {
global.bs_local = new browserstack.Local();
global.bs_local.start({ key }, function(error) {
if (error) {
// on error call done('error description') to stop
done(error);
}
console.log('Connected. Now testing...');
done();
});
};
and teardown
module.exports = function(done) {
global.bs_local.stop(function() {
console.log('Local Stack has been stopped');
done();
});
};
Do you think my approach is incorrect?
bootstrapAll(done) {
bs_local.start({
key: _key,
localIdentifier: _localIdentifier,
forceLocal: true
}, function() {
console.log(`connecting with ${_localIdentifier}`);
done();
});
},
teardownAll(done) {
if (_user && _key) {
bs_local.stop(() => {
console.log('Disconnected');
done();
});
} else {
done();
}
},
bootstrapAll and teardownAll will solve your issue.
Thanks for the guidance @PeterNgTr . For future references https://codecept.io/hooks#bootstrapall-teardownall