Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click, wait: include original call stack in error message #137

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

welelay
Copy link

@welelay welelay commented Oct 13, 2015

When calling click() or waitForDom, I've included the original call stack in the error message.
With this I can figure out which of the waitForDom failed, even if there is the same selector.
Same thing for click(), where I sometime get errors in the element.click() code, which doesn't show which selector it was.

You see the waitForDom("#signIn") message here in action:

1) some test should do something:
     Error: waitError(I have been waiting for 10000 ms until element #signIn is present, but it did not happen.)
  at Object.module.exports.waitForDOM (/usr/local/lib/node_modules/gagarin/lib/browser/helpers.js:31:17)
  at /Users/eric/W/app/tests/gagarin/connect/disconnect_twice.js:180:14
  at /usr/local/lib/node_modules/gagarin/lib/mocha/interface.js:361:27

    at Object.module.exports.throwWithMessage (/usr/local/lib/node_modules/gagarin/lib/browser/methods.js:23:9)
    at /usr/local/lib/node_modules/gagarin/lib/browser/methods.js:246:10
    at /usr/local/lib/node_modules/gagarin/lib/tools/genericPromiseChain.js:187:15
    at /usr/local/lib/node_modules/gagarin/lib/tools/index.js:165:25
    at /usr/local/lib/node_modules/gagarin/lib/browser/index.js:84:11
    at /usr/local/lib/node_modules/gagarin/lib/browser/methods.js:303:14
    at cb (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/webdriver.js:221:45)
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/callbacks.js:105:5
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/callbacks.js:82:7
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/webdriver.js:174:5
    at Request._callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/http-utils.js:87:7)
    at Request.self.callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:368:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1219:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1167:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

compared to what I get with the original code:

1) some test should do something:
     Error: waitError(I have been waiting for 10000 ms until element #signIn is present, but it did not happen.)
    at Object.module.exports.throwWithMessage (/usr/local/lib/node_modules/gagarin/lib/browser/methods.js:23:9)
    at /usr/local/lib/node_modules/gagarin/lib/browser/methods.js:246:10
    at /usr/local/lib/node_modules/gagarin/lib/tools/genericPromiseChain.js:187:15
    at /usr/local/lib/node_modules/gagarin/lib/tools/index.js:165:25
    at /usr/local/lib/node_modules/gagarin/lib/browser/index.js:84:11
    at /usr/local/lib/node_modules/gagarin/lib/browser/methods.js:303:14
    at cb (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/webdriver.js:221:45)
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/callbacks.js:105:5
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/callbacks.js:82:7
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/webdriver.js:174:5
    at Request._callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/http-utils.js:87:7)
    at Request.self.callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:368:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1219:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1167:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

@welelay
Copy link
Author

welelay commented Oct 13, 2015

an example with click error:

   Error: clickError(.compo-image-container, undefined) Error: [element.click()] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: unknown error: Element is not clickable at point (463, 348). Other element would receive the click: <div id="pageFullContent" style="padding-bottom:50px;">...</div>
  (Session info: chrome=45.0.2454.101)
  (Driver info: chromedriver=2.18.343837 (52eb4041461e46a6b73308ebb19e85787ced4281),platform=Mac OS X 10.11.0 x86_64)
  at /Users/eric/W/app/tests/gagarin/notes/add_note.js:95:14
  at /usr/local/lib/node_modules/gagarin/lib/mocha/interface.js:361:27

    at /usr/local/lib/node_modules/gagarin/lib/browser/methods.js:13:12
    at Object.callback (/usr/local/lib/node_modules/gagarin/lib/tools/index.js:165:25)
    at cb (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/element.js:43:15)
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/callbacks.js:38:11
    at /usr/local/lib/node_modules/gagarin/node_modules/wd/lib/webdriver.js:174:5
    at Request._callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/lib/http-utils.js:87:7)
    at Request.self.callback (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:368:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1219:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/gagarin/node_modules/wd/node_modules/request/request.js:1167:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

@apendua
Copy link
Member

apendua commented Oct 13, 2015

@welelay Maybe it would be useful to have this stack in other places as well?

Also, have you checked if it works on Firefox?

@welelay
Copy link
Author

welelay commented Oct 13, 2015

Maybe in other places as well, like when I do

            .execute(function() {
                expect($(".list-group-item-heading").length).to.equal(2);
            })

I don't get the original stack trace on expect fail

@welelay
Copy link
Author

welelay commented Oct 13, 2015

yes, it works on Firefox:

  1) some test should do something:
     Error: element #signIn does not exists
  at /Users/eric/W/app/tests/gagarin/connect/disconnect_twice.js:149:14
  at /usr/local/lib/node_modules/gagarin/lib/mocha/interface.js:361:27

    at Object.module.exports.throwWithMessage (/usr/local/lib/node_modules/gagarin/lib/browser/methods.js:23:9)
    at Object.<anonymous> (/usr/local/lib/node_modules/gagarin/lib/browser/helpers.js:125:14)
    at invokeCallback (/usr/local/lib/node_modules/gagarin/node_modules/es6-promise/dist/commonjs/promise/promise.js:53:15)
    at publish (/usr/local/lib/node_modules/gagarin/node_modules/es6-promise/dist/commonjs/promise/promise.js:98:5)
    at publishFulfillment (/usr/local/lib/node_modules/gagarin/node_modules/es6-promise/dist/commonjs/promise/promise.js:204:3)
    at flush (/usr/local/lib/node_modules/gagarin/node_modules/es6-promise/dist/commonjs/promise/asap.js:35:5)
    at doNTCallback0 (node.js:407:9)
    at process._tickCallback (node.js:336:13)

the code is sent converted to string and instrumented
before being executed on server, so stack manipulations
are required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants