visit
Preparing the infrastructure is one of the most significant challenges in mobile test automation. It's an exciting engineering task to build a scalable and reliable environment with emulators or real devices. Previously I’ve shared my experience of creating in-house infrastructure in the topic .
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "15.4");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 13 Pro");
capabilities.setCapability(MobileCapabilityType.APP, APP_PATH);
driver = new IOSDriver(new URL(GRID_HOST), capabilities);
//${user}:${access_key}@ondemand.eu-central-1.saucelabs.com:443/wd/hub
Here are present souce:options
which are specific capabilities for Sauce Labs platform. They should be merged with general WebDriver capabilities that are typically used for your tests.
MutableCapabilities sauceOptions = new MutableCapabilities();
sauceOptions.setCapability("appiumVersion", "1.22.3");
sauceOptions.setCapability("build", "<your build id>");
sauceOptions.setCapability("name", "<your test name>");
capabilities.setCapability("sauce:options", sauceOptions);
DesiredCapabilities capabilities = new DesiredCapabilities();
//Original options used before
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "15.4");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 13 Simulator");
capabilities.setCapability(MobileCapabilityType.APP, APP_PATH);
//Sauce labs specific options
var sauceOptions = new MutableCapabilities();
sauceOptions.setCapability("appiumVersion", "1.22.3");
sauceOptions.setCapability("build", "001");
sauceOptions.setCapability("name", "My Awesome First Test");
//merging capabilities
capabilities.setCapability("sauce:options", sauceOptions);
driver = new IOSDriver(new URL(SAUSE_LABS_HOST), capabilities);
One of the greatest features is the session's real-time view - click on test and follow into view.
All information that could be helpful for reporting: logs, video, and screenshots is attached after the session is finished.
After a successful start, you receive a message in the console "Sauce connect is up.”
This tunnel will be displayed on “TUNNEL PROXIES” with green mark.
To use this tunnel, just add sauce-specific capability tunnelIdentifier
and put the tunnel name. After that, all traffic from the launched application will go through Sauce Connect Proxy.
sauceOptions.setCapability("tunnelIdentifier", "awesome_tunnel");