All Articles

Running Selenium UITests with Chrome / Firefox / Safari / IE browsers, using Azure Pipelines

Microsoft`s Azure Pipelines was announced last year.

For open source projects, it`s free to use until 10 parallel jobs.

Recently, some open source projects have migrated to Azure Pipelines, including JUnit project.

We can use Linux / macOS / Windows VMs in Azure Pipelines.

In the case of browser tests such as Selenium, it may be necessary to test browsers that can only operate on a specific OS, such as Safari / IE / Edge.

Therefore, I tried to run Selenium UITests on Azure Pipelines.

The sample code is below. I implemented with WebdriverIO.

I could run Selenium UITests on Linux (Chrome, Firefox), MacOS (Safari) and Windows (IE).

You can actually see build results from below link.

https://dev.azure.com/tadashinemoto0713/practice-webdriverio-typescript/_build

You can check what is contained in each VM images from the repository below.

There are two points to remember in using Selenium.

First, because Linux VM does not have a virtual display, you`ll need to use Chrome and Firefox in headless mode.

config.capabilities = [{
  browserName: 'chrome',
  'goog:chromeOptions': {
    args: ['window-size=1920,1080', '--headless', '--disable-gpu']
  }
}]
config.capabilities = [{
  browserName: 'firefox',
  'moz:firefoxOptions': {
    args: ['window-size=1920,1080', '--headless']
  }
}]

Second, you need to install Selenium standalone server and browser drivers in addition.

※ IE Driver / Chrome Driver / Gecko Driver are installed in Windows VMs

For WebdriverIO, using @wdio/selenium-standalone-service is convenient because it installs them automatically.

I also wanted to try to test with Edge browser this time, but I was not able to do it well.

I`ll try again when this PR is merged.

I felt it is very useful for running Selenium UITests to have easy access to Windows and macOS resources.

It would be useful for open source projects and small development teams.