Angularjs 使用WebStorm调试量角器
我试图使用WebStorm来调试量角器e2e测试,我的目标是能够在测试代码中设置断点。我是新手,所以我可能做错了什么 如上所述,我更新了webdriver管理器,并在cmd终端中使用此命令启动它(我正在Windows上工作): 这是我的dragrator-conf.js文件:Angularjs 使用WebStorm调试量角器,angularjs,debugging,protractor,webstorm,breakpoints,Angularjs,Debugging,Protractor,Webstorm,Breakpoints,我试图使用WebStorm来调试量角器e2e测试,我的目标是能够在测试代码中设置断点。我是新手,所以我可能做错了什么 如上所述,我更新了webdriver管理器,并在cmd终端中使用此命令启动它(我正在Windows上工作): 这是我的dragrator-conf.js文件: var ScreenshotReporter = require('./screenshotReporter.js'); exports.config = { // The address of a running
var ScreenshotReporter = require('./screenshotReporter.js');
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
//baseUrl: 'http://localhost:9000',
framework: 'jasmine2',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
specs: ['**/*_spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
},
onPrepare: function() {
jasmine.getEnv().addReporter(new ScreenshotReporter("test-e2e/screenshotFailures/"));
}
};
我在WebStorm中创建了如下配置:
节点解释器:C:\ProgramFiles\nodejs\Node.exe
工作目录:C:*********\ref应用程序
Javascript文件:node\u modules\dragrator\lib\cli.js
应用参数:test-e2e/dragotor-conf.js
在我尝试了几件事之后:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
F
baseUrl: 'http://localhost:9000',
然后在端口9000上启动本地Web服务器如果我使用WebStorm中的run按钮运行量角器,它工作正常,但无法设置断点
如果我在WebStorm中使用Debug按钮调试Prtoractor,我可以在控制台中看到这一点,但在:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
知道我做错了什么吗?您可以在
--inspect brk
模式下运行node,并附加远程调试器,例如chrome开发工具:
使用ng serve
启动应用程序并运行
node --inspect-brk ./node_modules/protractor/bin/protractor ./protractor.conf.js
现在,节点等待附加调试程序
然后您可以打开chrome://inspect/#devices
。你的应用程序应该出现在那里。
最后单击目标/应用程序上的inspect,瞧,您现在可以使用断点和
调试器代码>语句。您可以使用browser.pause()请参见我使用的browser.pause(),它可以正常工作,但使用适当的IDE进行调试似乎比命令行调试要好得多。使用webstorm设置断点绝对是可能的。可能尝试升级node,npm,将量角器依赖项更新为3+,删除node_modules文件夹,运行npm update以获得一个干净的文件夹,然后再次尝试通过webstorm进行调试。我更新到了量角器3.1.0,将webstorm更新为最新版本,删除了node_modules并重新安装,它不起作用…你试过这个教程吗:我确实按照步骤做了,它对我使用断点很好
node --inspect-brk ./node_modules/protractor/bin/protractor ./protractor.conf.js