Protractor: 分度器でデバッグが機能しない

作成日 2014年08月14日  ·  3コメント  ·  ソース: angular/protractor

私は過去の問題を調べましたが、私の知る限り、対処されていないようです(これらの問題は似ているように見えますが、すべて閉じているようです)。

  • #907
  • #552(閉鎖されているにもかかわらず存在する問題についてさらに議論している)

バージョン情報:

  • Mac 10.9.4
  • ノード0.10.30
  • 分度器1.0.0
  • Coffeescript 1.7.1

再現する手順:

  • 次の分度器構成を作成します( 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],
  ...
}
question

最も参考になるコメント

それでは、上記のbrowser.debugger()モードのポイントは一体何ですか? テストをデバッグしない場合...

全てのコメント3件

これが混乱する理由は理解できますが、実際には意図したとおりに機能しています。 browser.debuggerは、itブロックのスコープ外で一時停止するため、x、y、およびzは実際には定義されていません。

browser.debuggerが公開される理由は、itブロック内にブレークポイントを設定したくないためです。つまり、コマンドの実行時の中間の制御フローにブレークポイントを設定する必要があります。

古き良きdebuggerを使用し、 --debugフラグを指定して実行すると、実際にitブロック内で一時停止できます。

古き良きデバッガーを使用し、-debugフラグを指定して分度器を実行しても、実行が一時停止することはありません。 :-/

それでは、上記のbrowser.debugger()モードのポイントは一体何ですか? テストをデバッグしない場合...

このページは役に立ちましたか?
0 / 5 - 0 評価