IE未通过VSTS Gulp任务由Karma Runner连接 [英] IE not connected by Karma Runner using VSTS Gulp task

查看:114
本文介绍了IE未通过VSTS Gulp任务由Karma Runner连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用VSTS的构建管道中遇到问题.

I am facing an issue with my build pipeline using VSTS.

环境详细信息是: 代理服务器是Windows Server 2012 R2 VSTS代理正在网络服务上运行 为了运行客户端测试用例,我创建了一个gulp任务.业力运行程序与IE一起用作浏览器启动器.

Environment details are: Agent server is Windows Server 2012 R2 The VSTS agent is running on network service For running my client side test cases, I have created a gulp task. Karma runner is used with IE as the browser launcher.

我在这里面临的问题是IE作为karma.conf文件中的浏览器.每当使用VSTS运行该任务时,业障运行程序就不会连接.输出为:

The issue I am facing here is with IE as browser in karma.conf file. Whenever this gulp task is ran using VSTS then the karma runner is not connecting. The output is:

[33m20 09 2018 17:32:43.924:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (1 times)
2018-09-20T12:02:43.9339866Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:02:43.9342689Z   Disconnectedundefined
2018-09-20T12:04:14.1287942Z [33m20 09 2018 17:34:14.125:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (2 times)
2018-09-20T12:04:14.1289323Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:04:14.1299244Z   Disconnectedundefined
2018-09-20T12:05:43.7605115Z [33m20 09 2018 17:35:43.758:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (3 times)
2018-09-20T12:05:43.7635052Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:05:43.7641486Z   Disconnectedundefined
2018-09-20T12:07:13.2066049Z [33m20 09 2018 17:37:13.205:WARN [IE 11.0.0 (Windows 8.1.0.0)]: [39mDisconnected (4 times)
2018-09-20T12:07:13.2110144Z IE 11.0.0 (Windows 8.1.0.0) ERROR
2018-09-20T12:07:13.2112337Z   Disconnectedundefined

如果将浏览器仅设置为GoogleChrome,则此任务也可以正常工作.如果将其设置为仅IE"或"GoogleChrome和IE",则此任务不起作用.另外,如果我通过cmd手动运行此任务,那么它工作正常.

VSTS代理服务运行帐户是否存在问题?

Is there some issue with the VSTS agent service running account?

推荐答案

我认为问题在于IE(以及Edge)无法在服务帐户下运行-它们必须在以下环境中运行:有一个交互式桌面会话.

I think the problem is that IE (and Edge for that matter) can't be run under a service account - they have to be run in an environment which has an interactive desktop session.

我在与您链接的问题中使用的黑客攻击方法是使用Team City代理登录到构建代理帐户,然后手动启动IE.这使我接受了它具有的烦人的首次运行对话框,并为其布局了用户配置文件文件夹中运行所需的文件.我想冒昧地说这仍然不受支持,因为当Team City代理生成IE进程时,它仍处于非交互会话中.

The hack I used in the the question you linked to was to logon to the build agent using the Team City agent account and then manually start IE. This allowed me to accept that annoying first run dialog it has, and for it to layout what ever files it needs in the user profile folder to run. I would hazard a guess to say this is still unsupported, as when the Team City agent spawns an IE process it's still in a non-interactive session.

我最近对Selenium采取的方法如下:

The approach I've taken recently with Selenium is as follows:

  1. 配置Windows 10框以使用Selenium服务帐户自动登录.
  2. 具有一个自动运行脚本,该脚本立即锁定计算机并在控制台应用程序中启动Selenium节点服务器.
  3. 以Selenium用户(runas /user:selenium-account "C:\Program Files\Internet Explorer\iexplore.exe")手动启动IE,以接受该第一个运行对话框.
  4. 设置Selenium/IE所需的所有注册表设置.
  1. Configure a Windows 10 box to auto login with a Selenium service account.
  2. Have an auto run script which immediately locks the machine and starts the Selenium node server in a console app.
  3. Manually start IE as the Selenium user (runas /user:selenium-account "C:\Program Files\Internet Explorer\iexplore.exe") to accept that first run dialog.
  4. Set all the registry settings needed for Selenium / IE.

您也许可以装配类似于VSTS/Karma的东西.如果可行,请在此处与您的解决方案一起发布注释.

You may be able to rig up something similar to work the VSTS / Karma. Do post a note here with your solution if you get it working.

如果这对您(和其他人)有帮助,我可以将脚本发布到GitHub上.我本来打算将它们作为Chocolatey软件包发布,但是我还没有完全解决这个问题.

If it would help you (and others), I can post my scripts to a GitHub repro. I had been planning to publish them as a Chocolatey package, but I didn't get round to that yet.

我希望能帮上忙.

更新

Microsoft文档:

您可以将代理作为服务或交互式过程来运行.无论您是将代理作为服务运行还是以交互方式运行,都可以选择用于运行代理的帐户.请注意,这与在Azure管道或TFS中注册代理时使用的凭据不同.代理帐户的选择仅取决于在构建和部署作业中运行的任务的需求.

You can run your agent as either a service or an interactive process. Whether you run an agent as a service or interactively, you can choose which account you use to run the agent. Note that this is different from the credentials that you use when you register the agent with Azure Pipelines or TFS. The choice of agent account depends solely on the needs of the tasks running in your build and deployment jobs.

例如,要运行使用Windows身份验证访问外部服务的任务,您必须使用有权访问该服务的帐户来运行代理.但是,如果您正在运行需要浏览器的UI测试(例如Selenium或编码的UI测试),则会在代理帐户的上下文中启动浏览器.

For example, to run tasks that use Windows authentication to access an external service, you must run the agent using an account that has access to that service. However, if you are running UI tests such as Selenium or Coded UI tests that require a browser, the browser is launched in the context of the agent account.

配置代理后,建议您首先以交互方式尝试以确保其正常工作.然后,对于生产用途,我们建议您以以下方式之一运行代理,以使其可靠地保持在运行状态.这些模式还可以确保在重新启动计算机后自动启动代理.

After you've configured the agent, we recommend you first try it in interactive mode to make sure it works. Then, for production use, we recommend you run the agent in one of the following modes so that it reliably remains in a running state. These modes also ensure that the agent starts automatically if the machine is restarted.

还有

  1. 作为启用了自动登录的交互式过程.在某些情况下,您可能需要以交互方式运行代理以用于生产用途-例如运行UI测试
  1. As an interactive process with auto-logon enabled. In some cases, you might need to run the agent interactively for production use - such as to run UI tests

这篇关于IE未通过VSTS Gulp任务由Karma Runner连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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