Reputation: 595
I am trying to run protractor test on multiple devices.
The configuration for desktop browsers and mobile browsers using Appium is different. Are there any way to mix both configurations?
This is the content of my configuration files:
1.Main configuration using 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 (necessary restart safari and selenium server)
{
browserName: 'safari'
},*/
{
browserName: 'chrome'
},
{
browserName: 'chrome',
// List of devices https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc
'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 of first mobile device 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 of second mobile device 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 my tests are running but using different conf.js files and running various instances of appium server.
I need run selenium server on port 4444, one appium server on port 4723 and other appium server on port 4747. And run the three scripts at same time using this command:
protractor conf.js & protractor conf-appium.js & protractor conf-appium-1.js
Usually the test pass successful but sometimes I get 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
Are there any proper way to config protractor and appium to run tests in multiple devices?
Upvotes: 2
Views: 1111
Reputation: 4178
As I understand, you are running tests in BROWSERS only in web & mobile, then why use appium at all? You can run the same tests by simply resizing the window sizes.
I believe unless you are covering Native/Hybrid apps from automation perspective it is same.And in few exceptional cases(locator changes) can be handled separately inside the page objects.
Upvotes: 0