使用ng e2e进行量角器调试

时间:2020-09-05 06:51:45

标签: node.js angular protractor e2e-testing angular-e2e

我可以通过单独运行以下命令来调试e2e测试-

node --inspect-brk .\node_modules\protractor\bin\protractor .\e2e\protractor.conf.js

但是,我要单独运行'ng e2e'和上面的命令进行调试,这会打开两个浏览器,一个用于e2e,另一个用于调试e2e。我想在调试模式下一次运行e2e测试,并在package.json中使用config / command进行调试模式。

我遇到了以下命令,以使其与ng-

一起运行
node --inspect-brk ./node_modules/\@angular/cli/bin/ng e2e ./protractor.conf.js

我在package.json中关注-

"e2e": "ng e2e -c=integration --suite e2e --webdriverUpdate=false"

我正尝试通过以下方式使用调试命令-

"e2e-debug": "node --inspect-brk .\\node_modules\\@angular\\cli\\bin\\ng e2e -c=integration --suite e2e --webdriverUpdate=false" .\\e2e\\protractor.conf.js

在点击 chrome:// inspect /#devices 并进行检查时,它停止在ng的第一行。稍后出现未知选项:'。\ e2e \ protractor.conf.js',并且执行停止。

我从上面的命令中删除了。\ e2e \ protractor.conf.js 并尝试如下-

"e2e-debug": "node --inspect-brk .\\node_modules\\@angular\\cli\\bin\\ng e2e -c=integration --suite e2e --webdriverUpdate=false"

为此,在检查时,它在ng的第一行停止,后来又在存在调试器的任何spec文件中从未停止。它无需停止就可以完成运行测试。

有什么想法在调试时如何在选项中使用ng e2e命令?

1 个答案:

答案 0 :(得分:0)

我写了一篇关于调试量角器测试的文章。如果您尚未转介,请看看。 https://medium.com/@ganeshsirsi/how-to-debug-protractor-tests-in-visual-studio-code-e945fc971a74