Executing tests with Protractor and Appium across various devices

I am experimenting with running protractor tests on multiple devices.

  1. Testing on various desktop browsers
  2. 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?

Answer №1

From my understanding, if your testing is limited to browsers on both web and mobile platforms, then the question arises - why utilize Appium? The same tests can be executed by adjusting the window sizes without the need for Appium.

I am of the opinion that unless automation includes Native/Hybrid apps, the scenario remains unchanged. Any exceptional cases such as locator changes can be addressed independently within the page objects.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with combining overflow-x, Firefox, and JavaScript

In Firefox, an issue arises that does not occur in other browsers. To see the problem in action, please visit this example page: -removed- Try selecting a page other than the home page. The window will scroll to your selection. You can then scroll down u ...

Is it possible to launch a hidden tab or window and automatically submit the form within that tab/window?

I have a form for adding users to my Application. After submitting the form, I want to open a hidden TAB/WINDOW where another form is displayed with values retrieved from the database being written to a file. I need this second form to be automatically su ...

Arranging DataTable by the newest date

I need to change the default sorting of a table from old date to recent date (1st column). Here is the code I have been trying: <script> $(document).ready( function () { $('#table_id').DataTable({ dom: 'B<"cle ...

Tips for aligning the first element in an inline-block list item horizontally

I'm working on a list with horizontal scroll functionality to allow users to view content by scrolling. I have successfully implemented this, but I'm facing a couple of challenges that I need help with: I want the first item in the list to alwa ...

Error message in Leaflet JS: Unable to access property 'addLayer' because it is undefined when trying to display drawnItems on the Map

My attempt to showcase a Leaflet Map with polygon-shaped surfaces encountered an issue. Sometimes, I face the error "cannot read property 'addLayer' of undefined," but when the page is refreshed, the map renders correctly. I am unsure where I wen ...

The fadeIn() and fadeOut() functions solely conceal

I attempted to incorporate jQuery's fadeIn and fadeOut functions, but found that they only work for the specified duration, causing the elements to appear/disappear abruptly without smoothly transitioning the opacity. Here is the code snippet I used: ...

Is it possible to prevent the text from appearing in the text box when a button is

I have successfully implemented a feature where clicking on the button (click on me) in HTML displays a textbox along with another button (show) on the screen. The text written in the textbox is visible when the show button is clicked. However, after the i ...

What is the best way to retrieve the present value of an input that belongs to an array of objects?

Struggling with populating an array with data and encountering a specific issue. 1 - Attempting to determine an index for each key in the array of objects, but encountering an error when a new input is added dynamically. The inputs are successfully added ...

React Intersection Observer not functioning properly

Hey there! I'm trying to create an animation where the title slides down and the left element slides to the right when scrolling, using the intersection observer. Everything seems to be fine in my code, but for some reason it's not working. Any t ...

When trying to make a jQuery call using ajax, there is no response being received

I'm facing a slight issue with a gift list that is generated from SQL. My objective is to display each row as a form with a textbox and a button. When the button is clicked, I want to send the textbox value and an ID number (hidden field value) to a f ...

Redirect the traffic from a Selenium WebDriver (Chrome) instance to a designated network interface or tunnel

My current task involves automating browser activity through a specific network interface on Linux. I have chosen to use Selenium (Python) to initiate video playback on a webpage, but the application is using the default interface instead of the one I wa ...

`Encountering an unknown index while using AJAX to retrieve data from a PHP file

When using AJax to call a PHP file and retrieve values, I encountered an issue where the called PHP file returns an unidentified variable upon submission. Here is the script being used: <script> function showPrice(str) { if (str == "") { ...

How to access a variable within a callback function in Node.js

Is there a way for me to retrieve the inventory variable outside of the callback function in order to use it and return its value? loadInventory = function () { var inventory = []; offers.loadMyInventory({ appId: 730, contextId: 2, tradabl ...

Experiencing difficulties launching InstaPy

After successfully setting up selenium and geckodriver to work with firefox, I decided to give InstaPy a try for the first time. With firefox installed, I was able to launch the browser, go to Instagram, and log in with the code snippet below: browser ...

How can I capture all console logs and events triggered while browsing a website?

Is there a method to capture all console logs and events triggered while browsing a website? I attempted to follow the suggestions provided in Capturing browser logs with Selenium WebDriver using Java, however, analyzeLog() does not yield any results when ...

The building process of Ember encountered an error due to a problem with the broccoli builder

I'm currently working on an Ember project and facing an issue while trying to upgrade the version from 2.8 to 3.5.0. After changing the version and some dependencies, I encountered the following error : Error stack Even after attempting to resolve i ...

Calculating the average value of an attribute in an array using Mongodb (Mongoose)

Seeking assistance with a query to find sellers near users based on location input and sorting them by average rating. Is this achievable? Snippet of the model including an array of reviews: const sellerSchema = new mongoose.Schema({ _id: Mongo ...

Encountering error message "Module not found '@angular/compiler-cli/ngcc'" while attempting to run "ng serve" for my application

Encountering an error while trying to run my app, I have attempted various solutions available online. These include uninstalling and reinstalling angular/cli, verifying the correct version in package.json (ensuring it is "@angular/cli" and not "@angular-c ...

Component built in ReactJS for file uploads to a server running on Spring MVC/Data-REST

For quite some time, I have been on the lookout for a ReactJS component that enables file uploading from a browser, with the ability to save it to the server where the ReactJS application is deployed. I've come across several components that facilita ...

Guide to validating a Chinese mobile phone number using regular expressions

I need help validating a Chinese phone number that must begin with the number 1 followed by 10 additional numbers, for example: 14375847232 Any assistance would be appreciated. Thank you. ...