Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change VSTS agent session screen resolution when running protractor tests

My protractor tests work fine on my local machine and on Azure VM Windows Server 2012R2 when accessed via RDP. I explicitly set browser window resolution in my tests using browser.driver.manage().window().setSize(1600, 900); and it allows tests to work properly.

However, when the VM mentioned above is used as build machine, controlled by VSO (VSTS) agent, my protractor tests are failing. I suspect it happens because screen resolution for VSO agent session is smaller then desired resolution specified in my tests and WebDriver(ChromeDriver) can't set resolution higher than OS limitation.

My question is how to change screen resolution of Azure VM for VSO agent session?

I tried custom utility for changing screen resolution from here and it works on my PC, however when it is executed by VSTS agent on Azure VM it throws error:

System.InvalidOperationException: The display driver failed the specified graphics mode.
like image 593
twinmind Avatar asked Sep 22 '16 05:09

twinmind


1 Answers

In order to run the protractor tests, the agent needs an interactive session. Configure the agent to run interactively, instead of as a service.

It did help to run agent in interactive. When I connect to my build machine via RDP it gets screen resolution of my client machine. Then when I launch vso agent and disconnect by RDP, this display resolution remains on build machine, so selenium can maximize browser window.

like image 180
jessehouwing Avatar answered Oct 07 '22 13:10

jessehouwing