调试从Angular CLI的ng e2e开始的量角器测试

时间:2018-12-04 14:56:32

标签: angular protractor angular-cli

如何使用在ng e2e上运行的Angular 6+调试量角器测试。

我在debug: true文件中设置了e2e/protractor.conf.js。在测试中调用browser.pause()时,出现错误和提示,我应该使用debugger;关键字。 Usign无效。

示例代码:

it('the user-menu should be present', () => {
  page.navigateTo();
  browser.pause();
  //debugger;
  let elem = page.getUserIconMenuButton();
  expect(elem.isPresent()).toBeTruthy();
});

这是我得到的警告:

***********************************************************
* WARNING: _debugger module not available on Node.js 8    *
* and higher.                                             *
*                                                         *
* Use 'debugger' keyword instead:                       *
* https://github.com/angular/protractor/blob/master/docs/debugging.md                               
***********************************************************
C:\...\node_modules\protractor\built\debugger\debuggerCommons.js:14
  throw e;
  ^

Error: Cannot find module '_debugger'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\...\node_modules\protractor\built\debugger\debuggerCommons.js:3:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

我试图按照提供的(https://github.com/angular/protractor/blob/master/docs/debugging.md)中的说明进行操作,但这并不是真正的帮助。

有人有教程关于如何使用Angular-CLI调试e2e测试吗?

1 个答案:

答案 0 :(得分:0)

不确定是否找到解决该问题的方法。但是我在这里找到了一些帮助。

https://github.com/angular/protractor/issues/4307#issuecomment-386112285

对于节点v8 +:-

  • 在您的SELENIUM_PROMISE_MANAGER: false中设置protractor.conf.js
  • 将您的tasconfig.e2e.json的{​​{1}}更新为target
  • 使用异步/等待。对于例如-

    "target": "es2017"

它解决了我的问题。希望它也对您有帮助。 如果您也找到其他解决方案,请分享。

相关问题