If we want to run a test and perform visual validations against other browsers and OSs, it’s simple to add in Sauce Labs support.
NOTE: If you don’t already have a Sauce Labs account, sign up for a free trial account here.
First we’ll need to import the relevant classes.
We’ll then need to modify the test setup to load a Sauce Lab browser instance (via Selenium Remote) instead of a local Firefox one.
We pass our instance requests to Sauce Labs via
DesiredCapabilities. The main things we'll need to specify are the browser, browser version, OS, and the name of the test. You can see a full list of the available browser and OS combinations here.
In order to connect to Sauce Labs, we need to provide an account username and access key. The access key can be found on your account page. These values get concatenated into a URL that points to Sauce Labs on-demand Grid.
Once we have the
DesiredCapabilities and concatenated a URL, we create a Selenium Remote instance with them and store it in a local
browser variable. Just like in our previous example, we feed
eyes.open and store the return object in the
Now when we run this test, it will execute against Internet Explorer 8 on Windows XP. You can see the test while it’s running in your Sauce Labs account dashboard. And you can see the images captured on your Applitools account dashboard.