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

查看:18
本文介绍了运行量角器测试时更改 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 代理并通过 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天全站免登陆