Protractor: κ°λ„κΈ°μ—μ„œ μž‘λ™ν•˜μ§€ μ•ŠλŠ” 디버그

에 λ§Œλ“  2014λ…„ 08μ›” 14일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: angular/protractor

λ‚˜λŠ” 과거의 문제λ₯Ό μ‚΄νŽ΄ λ΄€κ³ , λ‚΄κ°€ μ•„λŠ” ν•œ ν•΄κ²°λ˜μ§€ μ•Šμ€ 것 κ°™μŠ΅λ‹ˆλ‹€ (이 λ¬Έμ œλŠ” λΉ„μŠ·ν•΄ λ³΄μ΄μ§€λ§Œ λͺ¨λ‘ λ‹«ν˜€μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€).

  • # 907
  • # 552 (μ’…λ£Œ λ˜μ—ˆμŒμ—λ„ λΆˆκ΅¬ν•˜κ³  μ‘΄μž¬ν•˜λŠ” λ¬Έμ œμ— λŒ€ν•œ μΆ”κ°€ λ…Όμ˜κ°€ 있음)

버전 정보 :

  • λ§₯ 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 λ“±κΈ‰