Edge 和 Azure 管道上的 Karma 测试

Karma tests on Edge and azure pipelines

尝试在 Edge 上 运行 我的业力测试套装时,在 Azure 管道中,出现以下错误:

18 05 2020 16:34:20.217:INFO [karma-server]: Karma v5.0.7 server started at http://0.0.0.0:9876/
18 05 2020 16:34:20.217:INFO [launcher]: Launching browsers Edge with concurrency unlimited
18 05 2020 16:34:20.312:INFO [launcher]: Starting browser Edge
18 05 2020 16:34:46.536:ERROR [launcher]: Killing Edge process failed. Error: Command failed: taskkill /t /f /im MicrosoftEdge.exe
ERROR: The process "MicrosoftEdge.exe" not found.

18 05 2020 16:34:46.536:ERROR [launcher]: Cannot start Edge
    undefined
18 05 2020 16:34:46.536:ERROR [launcher]: Edge stdout: 
Couldn't find Edge URL with URL: 00D53958
Found
18 05 2020 16:34:46.536:ERROR [launcher]: Edge stderr: 
18 05 2020 16:34:46.536:INFO [launcher]: Trying to start Edge again (1/2).
18 05 2020 16:35:07.958:ERROR [launcher]: Killing Edge process failed. Error: Command failed: taskkill /t /f /im MicrosoftEdge.exe
ERROR: The process "MicrosoftEdge.exe" not found.

18 05 2020 16:35:07.958:ERROR [launcher]: Cannot start Edge
    undefined
18 05 2020 16:35:07.958:ERROR [launcher]: Edge stdout: 
Couldn't find Edge URL with URL: 00100250
Found
18 05 2020 16:35:07.958:ERROR [launcher]: Edge stderr: 
18 05 2020 16:35:07.973:INFO [launcher]: Trying to start Edge again (2/2).
18 05 2020 16:35:29.343:ERROR [launcher]: Killing Edge process failed. Error: Command failed: taskkill /t /f /im MicrosoftEdge.exe
ERROR: The process "MicrosoftEdge.exe" not found.

18 05 2020 16:35:29.343:ERROR [launcher]: Cannot start Edge
    undefined
18 05 2020 16:35:29.343:ERROR [launcher]: Edge stdout: 
Couldn't find Edge URL with URL: 013BFFB0
Found
18 05 2020 16:35:29.343:ERROR [launcher]: Edge stderr: 
18 05 2020 16:35:29.359:ERROR [launcher]: Edge failed 2 times (cannot start). Giving up.

它 运行ning 在微软托管的 windows-2019 虚拟机中,根据 documentation,它应该配置正确。 有人做过这个设置吗?

郑重声明,Internet Explorer 在相同设置下工作正常!

我设法使用自定义插件使其工作:https://github.com/TankerHQ/karma-edge-launcher

您可以使用新的 EdgeAzure 浏览器。

如果与 edge 集成失败,一个简单的解决方法:即使您没有安装 Chrome,您也可以在 karma.conf.js 中将默认浏览器设置为 ChromeHeadless,方法是更改'browsers' 设置为 'ChromeHeadless' 如下:

browsers: ['ChromeHeadless'],

然后一旦你是 运行 测试你就可以在 Microsoft Edge 中打开 http://localhost:9876/ 它会显示常规的业力测试 window.

或者,在不设置默认浏览器的情况下,您也可以使用命令 ng test --browsers ChromeHeadless

进行同样的操作