Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Debug not working in Protractor #1196

Closed
nt3rp opened this issue Aug 14, 2014 · 3 comments
Closed

Debug not working in Protractor #1196

nt3rp opened this issue Aug 14, 2014 · 3 comments

Comments

@nt3rp
Copy link

nt3rp commented Aug 14, 2014

I've taken a look through past issues, and to the best of my knowledge, it does not appear to be addressed (these issues appear similar, but all seem to be closed):

Version Information:

  • Mac 10.9.4
  • Node 0.10.30
  • Protractor 1.0.0
  • Coffeescript 1.7.1

Steps to reproduce:

  • Create the following protractor config (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
  • Create the following spec in e2e/spec.coffee
    describe 'Page', () ->
      it 'should debug properly', () ->
        browser.get '/'

        x = 'There is only X'
        y = 1
        z = ++y
        browser.debugger()
  • Run the following command: protractor debug e2e.conf.coffee

Expected Result:

  • The break point is set at the correct location
  • Variables in the local scope are accessible when entering repl mode and accessing a variable

Results:
Breakpoint is set in timers.js, and can't access any variables in scope other than 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],
  ...
}
@juliemr
Copy link
Member

juliemr commented Aug 18, 2014

I understand why this confusing, but this is actually working as intended. browser.debugger pauses outside of the scope of your it block, so x, y, and z are in fact not expected to be defined.

The reason that browser.debugger is exposed is precisely because we don't want to set a breakpoint inside the it block - we want to set it on the control flow in-between when the commands execute.

You can still use good old debugger and run with the --debug flag to actually pause within the it block.

@iainctduncan
Copy link

Using good old debugger and running protractor with the --debug flag doesn't pause execution at all for me. :-/

@Evanlec
Copy link

Evanlec commented Nov 3, 2014

what the heck is the point of the above browser.debugger() mode then? If not to debug your test...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants