Can you use Protractor and Appium together to test

2020-07-18 06:17发布

问题:

Here is my scenario. I have a website which is built on top of Angular JS. I am able to automate the website using protractor. However there are certain actions which when performed on website are reflected in Android and IOS devices.

Here's what I want to achieve.

Run my tests on website like I normally do but I want to fire commands to test the android and ios app also

    /*
    For eg:  
    1. Change password on website using protractor 
    2. Launch android app and check if the password has been changed
    3. Switch back to protractor tests for website
    */
    it('Change password and check on IOS and Android device' , function()
    {
           changePasswordOnWeb();
           OpenMobileAppInDeviceUsingAppium();
           checNewkPasswordOnMobileApp();
    });

Is it possible? If it is can you point me to any of the tutorials?

回答1:

To answer your question, yes you can integrate protractor and appium. Though as of now Protractor doesn't support appium officially, you can still make it possible with the below details. There is a help file that is available in Protractor docs. All you need to do is update your conf.js file to include the appium configurations and remember to start your appium server before you run the test script. Take care of below points -

  1. Start your avd

  2. Install the .apk file in your avd that you will be invoking through appium

  3. Start the appium server using command - appium &

  4. Update your protractor conf.js file to include appium android/chrome configurations. More details about configurations can be found in the below link.

Here's the link to more info on this - Protractor-Appium Setup . Hope this helps



回答2:

It seems like you can use it

to test hybrid apps

This readme will help you to setup Protractor with Appium - Android/Chrome and Android/Safari. Here is video how-to. Maybe you should consider the SauceLabs option too.I think you can request iOS and Android devices by specifying the platform in the capabilities section of the config.

If you don't want to use SauceLabs you can look at using Selenium's Grid functionality. You can get Selenium drivers for iOS and Android and have them connect to a centralized Selenium server that your Protractor scenarios are ran against, you just change the seleniumAddress in your config file to point to the centralized server.