私は過去の問題を調べましたが、私の知る限り、対処されていないようです(これらの問題は似ているように見えますが、すべて閉じているようです)。
バージョン情報:
再現する手順:
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()モードのポイントは一体何ですか? テストをデバッグしない場合...