运行量角器测试时更改VSTS代理会话屏幕分辨率 [英] Change VSTS agent session screen resolution when running protractor tests

查看:102
本文介绍了运行量角器测试时更改VSTS代理会话屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过RDP访问时,我的量角器测试在我的本地计算机和Azure VM Windows Server 2012R2上运行良好.我使用browser.driver.manage().window().setSize(1600, 900);在测试中显式设置了浏览器窗口分辨率,它使测试能够正常工作.

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.

但是,当上述VM用作由VSO(VSTS)代理控制的构建计算机时,我的量角器测试失败.我怀疑是因为VSO代理会话的屏幕分辨率小于我的测试中指定的所需分辨率,并且WebDriver(ChromeDriver)无法将分辨率设置为高于操作系统限制.

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.

我的问题是如何为VSO代理会话更改Azure VM的屏幕分辨率?

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

我尝试了用于从这里 并且可以在我的PC上运行,但是当它由Azure VM上的VSTS代理执行时会引发错误:

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.

推荐答案

为了运行量角器测试,代理需要进行交互式会话.配置代理以交互方式运行,而不是作为服务运行.

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

这确实有助于以交互方式运行代理.当我通过RDP连接到构建计算机时,它将获得客户端计算机的屏幕分辨率.然后,当我启动vso agent并通过RDP断开连接时,此显示分辨率仍保留在构建计算机上,因此selenium可以最大化浏览器窗口.

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.

这篇关于运行量角器测试时更改VSTS代理会话屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆