Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase the screen resolution on Test Agent

Running a automated test against a desktop WPF application works fine on my local machine and on Azure VM Windows Server 2012R2 when accessed via RDP.

However, when the VM is used as build machine, controlled by test agent on TFS or VSTS, all test fails because of the screen resolution is set to 1024x768 screen resolution. The application is not configure to run until this display settings. Is there any way to change the screen settings when we deploy the test agent?

Change VSTS agent session screen resolution when running protractor tests

like image 256
GS Team Avatar asked Aug 23 '17 02:08

GS Team


People also ask

What is screen resolution testing?

Screen resolution testing refers to testing or validating the appearance of websites across numerous devices (desktops, tablets, mobiles) having different screen resolutions.


1 Answers

We've encountered the same issue on our Visual studio + Azure solution. To be able to execute the tests we need a higher resolution on the VM than 1027 x 768. But since it's Azure and you pay for machines that are turned on, we also want to turn them off after each run top keep the cost down (especially helpful when you want to scale up a bit).

Therefore it's a real pain that there is no simple option to let the VM boot in a certain (specified) resolution. If there is something more simple than what I'm going to show you, please let me know, but I could not find any. So I up-voted the idea mentioned by Nessi. What we did as a workaround was the following.

Idea's for possible solution

In essence we used this post as a guideline. The most important things we used from this was the Windows credentials part and the TERMSRV.

Our Setup

  • Visual Studio Build server
  • Four Azure VM's, one machine is the selenium-grid-hub the other three are nodes

Our Solution

First we let the Build server start all machines in the resource group (so far so good). Then we created a Powershell script that runs on the build server to the nodes to check and waits for the RDP service to become available. This was needed since it can take up to 10 minutes before we see that this service is active. And finally we trigger a Powershell on the selenium-grid-hub VM to make RDP connections to all nodes in a certain resolution.

In a bit more detail to make sure it all goes automatically and without any manual input needed:

  • Creating and export/import certificates from each node into the hub
  • Making sure that the credentials are stored in the credential manager > Windows Credentails (we created one user on all machines to make life a tiny bit easier)
  • Creating a script for checking if the RDP service is active
    • We call this script C:\Scripts\RDPServiceRunCheck.ps1 (see example below) in a VS build block with the arguments $(Password) $(Chrome-node) $(Username)
    • Where all these arguments have been stored in variables on the build server
    • Here is the code for the script on github
  • Creating a executable for starting a RDP in a certain resolution
    • We call this script C:\Scripts\Resolution.RDP.Remoting.exe (see example below) in a VS building block with the arguments "C:\Scripts\$(Chrome-node).rdp" 1600 1200
    • Where the *.rdp file for each machine was stored (upfront) in this folder and 1600 1200 is the resolution we want to set
    • Here is the code for the executable on github
like image 148
Mark Duivesteijn Avatar answered Sep 25 '22 17:09

Mark Duivesteijn