量角器不会暂停调试

时间:2021-08-02 20:25:43

I'm trying to debug Protractor-E2E-Tests but my test doesn't pause on browser.debugger(). My attempt to achieve this is to

我正在尝试调试Protractor-E2E-Tes​​ts,但我的测试不会在browser.debugger()上暂停。我实现这一目标的尝试是

  1. start my selenium server by running 'webdriver-manager start'
  2. 通过运行'webdriver-manager start'启动我的selenium服务器
  3. insert browser.debugger() to my test's code
  4. 将browser.debugger()插入我的测试代码
  5. run grunt serve to start my application
  6. 运行grunt服务来启动我的应用程序
  7. run protractor debug protractor.conf.js
  8. 运行量子器调试protractor.conf.js

my console output for step 3 is the following:

我的第3步控制台输出如下:

Starting background Express server
debugger listening on port 5858
Express server listening on 9000, in development mode

my console ouput for step 4 is the following:

我的第4步控制台输出如下:

$ protractor debug protractor.conf.js
Starting debugger agent.
debugger listening on port 5858
Starting selenium standalone server...
connecting... ok
debug> Selenium standalone server started at http://192.168.1.101:57265/wd/hub
.........

Finished in 10.737 seconds

So it runs the test without pausing as intended...

所以它运行测试而没有按预期暂停...

Here's my protractor.conf.js:

这是我的protractor.conf.js:

'use strict';

exports.config = {

  allScriptsTimeout: 110000,

  baseUrl: 'http://localhost:' + (process.env.PORT || '9000'),

  // list of files / patterns to load in the browser
  specs: [
    'e2e/**/*.spec.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  framework: 'jasmine',
  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};

edit

编辑

and here's my test's code:

这是我的测试代码:

it('should help to debug', function(done) {
        console.log('before debugger'); //gets displayed in console
        browser.debugger();
        console.log('after debugger'); //gets displayed in console as well, but shouldn't
        done();
});

Any help is appreciated!

任何帮助表示赞赏!

2 个解决方案

#1


4  

I'm on windows, I have Angular universal. When I had both debugger() and pause() worked for me. It paused and I could navigate in cmd:

我在窗户上,我有角度普遍。当我让debugger()和pause()都为我工作时。它暂停了,我可以在cmd中导航:

browser.pause();
browser.debugger();

#2


-3  

use browser.pause(); --see details at http://angular.github.io/protractor/#/api?view=Protractor.prototype.pause

使用browser.pause(); - 详见http://angular.github.io/protractor/#/api?view=Protractor.prototype.pause

#1


4  

I'm on windows, I have Angular universal. When I had both debugger() and pause() worked for me. It paused and I could navigate in cmd:

我在窗户上,我有角度普遍。当我让debugger()和pause()都为我工作时。它暂停了,我可以在cmd中导航:

browser.pause();
browser.debugger();

#2


-3  

use browser.pause(); --see details at http://angular.github.io/protractor/#/api?view=Protractor.prototype.pause

使用browser.pause(); - 详见http://angular.github.io/protractor/#/api?view=Protractor.prototype.pause