Mobile Test Automation & Device Orientation with Behat & SauceLabs

Behat Supports Mobile Automation for Portarit & Landscape orientation with SauceLabs:

Hope you enjoyed my Guest Blog post on official Sauce Labs blog about ‘Testing Your Mobile Apps with Behat and SauceLabs’. We have seen how to run your BDD scenarios on the moble devices with use of Behat and SauceLabs combination.

We have just added support for mobile test automation with Portrait, Landscape orientation and different device types. We have added more Saucelabs supported Selenium WebDriver desired capabilities to Mink Extention’s Selenium2 Driver, so that we can run BDD scenarios both for Landscape and Portait orientation. This applies for iPhone, iPad and Android devices.

Whats New in Desired Capabilities?

  • deviceOrientation

Now, It’s possible to We run our scenarios with ‘landscape’ or ‘portrait’ devices. Default is ‘Portrait’. Just by adding some parameters to capabilities in the behat.yml like this

  • deviceType

  • name

Notice that we have also added ‘name’ in order to giver proper name for your Scenarios.

We ned to create profile in our behat.yml, one for ‘landscape and other for ‘portrait’ to run our scenarios on iPad. See how our behat.yml Looks like

GitHub MobileDeviceOrientation

There is a souce code avialable on Github in the repository MobileDeviceOrientation. There is a README file with all the details how to use it. Try it yourself.

You can watch videos of SauceLab jobs  for Portrait and Landscape

Watch it on YouTube

  • Landscape

  • Portrait

You can extend it to the iPad, Andoid devices as well just by updating behat.yml file.


Mobile Test automation for the protrait and lanscape orientation ca be achieved easily with use of Behat and SauceLabs.