Change default permission for user interface testing with jenkins

I am trying to start UI automation with a Jenkins job that runs on a Windows virtual machine as a slave jenkins as part of the CI pipeline. I have a problem that the screen resolution is set very low (1024, 768), how can I change the default resolution, so when jenkins opens a new connection, will it be in higher resolution?

+6
source share
5 answers

start β†’ services.msc β†’ stop the system service you want to change permission (Jenkins.exe) β†’ right-click β†’ Properties β†’ Sign in to TAB β†’ Local system account β†’ Check Allow the service to interact using Desktop β†’ then it will accept the permission the monitor you are currently using.

Make sure you install the .driver.manage () browser. window (). maximize (); on your onPrepare: protractor.conf.js method

+1
source

Do you have your webapp container running as a local service (tomcat or jenkins slave?). The fact is that Windows services cannot have a GUI, and it’s even a miracle that WebDriver somehow manages to open the window 1024768 :) Run the webapp container as a console application with a regular user.

0
source

Theoretically, the powerscript command as a build step:

set-displayresolution 1920 1080 -Force 

should do it, but now I have some problems ...

What definitely worked: connect to your virtual machine using RDP using the required resolution, then disconnect. Tests will be run in the latest resolution.

0
source

I have the same problem trying to run Jenkins UI tests

Problem: By default, jenkins starts as a Windows service and does not have access to test runs on the desktop.

So to fix:

  • start β†’ services.msc β†’ stop the system service Jenkins.exe
  • right click on Jenkins.exe -> properties -> startup type - Manual -> save
  • create an executable file (.bat, .exe, ...) save it somewhere and type there:

java -jar "C:\path\to\Jenkins\jenkins.war" --httpPort=8081

  1. add a shortcut to this executable file in the Windows startup directory

It will launch Jenkins on the desktop (not a windows service), which allows you to run your UI tests there

0
source

If your UI automation includes launching Chrome, you might find it helpful to launch Headless Chrome . Thus, the screen resolution of the slave does not matter, since you can specify the resolution you want to use.

I was able to achieve this using these Chrome startup arguments running on a Jenkins Windows slave server:

 --headless --window-size=1920,1080 

In my case, with Nightwatch, this is a fragment of the nightwatch.json file:

  "desiredCapabilities": { "browserName": "chrome", "chromeOptions": { "args": ["--window-size=1920,1080", "--headless"] }, // ... 
0
source

Source: https://habr.com/ru/post/971038/


All Articles