我已经浏览了过去的问题,据我所知,它似乎没有得到解决(这些问题看起来很相似,但是似乎都已经解决了):
版本信息:
重现步骤:
e2e.conf.coffee
): Copied from https://github.com/angular/protractor/blob/master/docs/referenceConf.js
exports.config =
seleniumServerJar: null
seleniumPort: null
seleniumArgs: []
chromeOnly: true
seleniumAddress: null
sauceUser: null
sauceKey: null
sauceSeleniumAddress: null
specs: ["e2e/*.coffee"]
exclude: []
capabilities:
browserName: "chrome"
count: 1
shardTestFiles: false
maxInstances: 1
multiCapabilities: []
maxSessions: -1
baseUrl: "http://localhost:8081"
rootElement: "body"
allScriptsTimeout: 11000
getPageTimeout: 10000
framework: "jasmine"
jasmineNodeOpts:
isVerbose: true
showColors: true
includeStackTrace: true
defaultTimeoutInterval: 30000
e2e/spec.coffee
创建以下规格 describe 'Page', () ->
it 'should debug properly', () ->
browser.get '/'
x = 'There is only X'
y = 1
z = ++y
browser.debugger()
protractor debug e2e.conf.coffee
预期结果:
repl
模式并访问变量时,可以访问本地作用域中的变量结果:
断点设置在timers.js
,并且无法访问范围中除browser
之外的任何变量:
protractor debug src/test/e2e.conf.coffee
Using ChromeDriver directly...
Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:79
77 }
78
79 function listOnTimeout() {
80 var msecs = this.msecs;
81 var list = this;
debug> repl
Press Ctrl + C to leave debug repl
> x
ReferenceError: x is not defined
> y
ReferenceError: y is not defined
> z
ReferenceError: z is not defined
> browser
{ controlFlow: [Function],
schedule: [Function],
getSession: [Function],
getCapabilities: [Function],
quit: [Function],
...
}
我理解为什么会造成混淆,但这实际上可以按预期工作。 browser.debugger
在您的it块范围之外暂停,因此实际上不希望定义x,y和z。
公开browser.debugger
的原因恰好是因为我们不想在it块内设置断点-我们希望在执行命令时在中间的控制流上设置断点。
您仍然可以使用旧的debugger
并使用--debug
标志在it块中实际暂停。
使用良好的旧调试器并使用带有--debug标志的量角器对我来说根本不会暂停执行。 :-/
上面的browser.debugger()模式的目的是什么? 如果不调试测试...
最有用的评论
上面的browser.debugger()模式的目的是什么? 如果不调试测试...