Protractor - Apium -

I can run automated tests on both desktop and mobile devices using Protractor + Appium. However, there are problems to run a custom test that only work on Desktop / Mobile.

for example: One of my tests checks Breadcrumbs, which are displayed only in desktop screen resolution.

Could you please advise if there is a solution to check whether the test is running on the desktop or on a mobile device.

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

Similar to the following, to check if the 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.

+5
source share
1 answer

Could you use the capabilities of appium and check the platform name?

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

All Articles