I am experimenting with running protractor tests on multiple devices.
- Testing on various desktop browsers
- Using Appium to test on different mobile browsers
The configurations for desktop and mobile browser testing using Appium are distinct. Is it possible to combine these configurations?
This is the information from my configuration files:
1. Main configuration used for "1- Multiple desktop browsers"
// conf.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "summary"
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['features/*.feature'],
multiCapabilities: [
{
browserName: 'firefox'
},
// TODO Safari is randomly failing (needs restart of safari and selenium server)
//{
//browserName: 'safari'
//},
{
browserName: 'chrome'
},
{
browserName: 'chrome',
'deviceName': 'Google Nexus 5'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPhone 6'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPad'
},
{
browserName: 'chrome',
'deviceName': 'Samsung Galaxy S4'
}
]
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf.js
2. Configuration for first mobile device using Appium
// conf-appium.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "pretty"
},
seleniumAddress: 'http://localhost:4723/wd/hub',
specs: ['features/*.feature'],
capabilities: {
browserName: 'chrome',
'appium-version': '1.5.3',
platformName: 'Android',
platformVersion: '5.0.2',
deviceName: '33005bd56ac6c223'
}
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf-appium.js
3. Configuration for second mobile device using Appium
// conf-appium-1.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "pretty"
},
seleniumAddress: 'http://localhost:4747/wd/hub',
specs: ['features/*.feature'],
capabilities: {
browserName: 'chrome',
'appium-version': '1.5.3',
platformName: 'Android',
platformVersion: '4.2.2',
deviceName: '30048664b980c100'
}
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf-appium-1.js
Currently, I have managed to run my tests but I am using separate conf.js files and running multiple instances of the appium server.
I have set up the selenium server on port 4444, one appium server on port 4723, and another appium server on port 4747. Then, I run all three scripts simultaneously using this command:
protractor conf.js & protractor conf-appium.js & protractor conf-appium-1.js
Most of the time, the tests pass successfully but occasionally I encounter this error:
WebDriverError: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: socket hang up
Is there a proper way to configure protractor and appium to effectively run tests on multiple devices?