Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor - Appium -

I am able to run automated tests both on Desktop, Mobile devices using Protractor + Appium. However having issues to run custom test, that work only in Desktop/Mobile only.

for eg: One of my test validates Breadcrumbs, which are displayed only in Desktop screen resolution.

Would you please advise, if there is a solution to check if test is being executed in Desktop or Mobile.

eg; it('check breadcrumb in website', function(){
       if(isDesktop()){
         contentItemPage.checkBreadCrumb();  
       }
    });

Similar to the following, to check if browser is Chrome or not.

 function isChromeBrowser(){ 
          browser.getProcessedConfig().then(function(config) {
               if(config.capabilities.browserName.valueOf() === new String('chrome').valueOf()){
                    return true;
               } 

               return false;
              
              
       
          });
} 

Thanks in advance.

like image 679
Rajesh Yarlagadda Avatar asked Sep 27 '22 05:09

Rajesh Yarlagadda


1 Answers

would you be able to use the appium capabilities and check the platformName?

function isMobileBrowser(){
          browser.getProcessedConfig().then(function(config) {
               if(config.capabilities.platformName.valueOf() === new String('Android').valueOf() || new String('iOS').valueOf()){
                    return true;
               }

               return false;

          });
}
like image 182
BarretV Avatar answered Oct 01 '22 12:10

BarretV