Search code examples
azureselenium-webdriverazure-devopsprotractorwebdriver-manager

Running protractor E2E tests for MS Edge browser in Azure Devops CI/CD pipeline


I have an angular application that has e2e tests written using protractor. I want to automate these tasks in Chrome, Firefox, & MS Edge (chromium) browsers using Azure Devops pipelines. I am using webdriver-manager to manage the binaries.

Chrome & Firefox support headless mode & I am able to get these tests running in my Azure Devops pipeline using the directconnect: true option, bypassing the selenium server.

I have been struggling to automate these tests in Edge browser as webdriver-manager support for headless mode is not available. On my local machine, I start a selenium standalone server by doing webdriver-manager start --edge "pathToEdgeDriver" & successfully run the e2e tests in Edge by specifying the seleniumAddress in my protractor.conf file.

But how do I automate this activity in Azure Devops pipelines. I am using self hosted Azure agent with interactive mode. I am using locally installed protractor in my project directory.

In my pipeine I have a command line task that starts the selenium server at port 4444 using the webdriver-manager start command. However the pipeline is stuck at this task & never moves forward. Possibly its waiting for the selenium server to close before proceeding. I also tried starting the selenium server as a background task using a powershell script: Start-Process node_modules/protractor/bin/webdriver-manager start. This doesn't work as well

The next task in the pipeline is a command line task to execute my protractor tests.

Is there a way to achieve what I am trying to do here?

Edit: Sharing my build definition.

Azure pipeline build definition for running e2e tests


Solution

  • After a bit of digging, I got this working. The webdriver-manager needs to be started with the --detach flag in order to run protractor tests in visual mode (not headless) in Azure DevOps pipelines.

    webdriver-manager start --edge "pathToEdgeDriver/msedgedriver.exe" --detach