javascript jenkins protractor selenium selenium-webdriver

Async callbacks/promises running that protractor/webdriver is not aware of

It’s possible a log like this?

Stacktrace: [31m[31mError: Failed expectation[31m
[31m at [object Object].<anonymous> (...06-....js)[31m[31m[22m[39m

So, it basically something is failing in file -06- when I’m already processing file -07- inside a suite.

Is there an option to say to protractor / webdriver.js something like “hey don’t wait for previous promises to be resolved”? I guess not, but maybe there is a known scenario where this can happen.

Sorry for the little information. I can’t give much more info.

This is a similar issue, I think it’s related with the previous one:

[32m46 tests, 11 assertions, 0 failures
[launcher] BUG: launcher exited with 1 tasks remaining

And I have another case where I have an error stacktrace -after- the tests, assertions and failures line. Ej:

     032 - "alert.msg" equals text: "invalid login"[32m✔[39m 033 - set detailTestLevel: 1
Finished in 3 seconds. Speed: 12.89 tests per second
Last Test Id: (ch_loginvalid_enUS_122_01)
[32m33 tests, 0 assertions, 0 failures
sh: 1: beep: not found
var result = fn();
Error: Index out of bound. Trying to access element at index:0, but there are only 0 elements
at /home/*******/common/ext/ElementFinder.js:618:15
at /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at notifyAll /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:442:7)
at resolve /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:420:7)
at fulfill /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:535:5)
at /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
at [object Object].then /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:522:7)
at Object.webdriver.promise.asap /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:767:11)
at newFrame.onComplete /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1670:25)
at [object Object].webdriver.promise.Frame_.notify_ /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1914:5)
at [object Object]._onTimeout /home/*******/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1901:11)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
at [object Object].ElementArrayFinder.applyAction_ (/home/*******/node_modules/protractor/lib/element.js:390:21)
at [object Object].self.(anonymous function) [as getText] /home/*******/node_modules/protractor/lib/element.js:77:19)
at [object Object].self.(anonymous function) [as getText] /home/*******/node_modules/protractor/lib/element.js:698:11)
at [object Object].<anonymous> (/home/*******/common/ext/ElementFinder.js:512:16)
at flow.execute.then.webdriverFailure (/home/*******/node_modules/jasminewd-retry/index.js:146:18)
at [object Object].promise.ControlFlow.runInFrame_ /home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
at [object Object].promise.ControlFlow.runEventLoop_ /home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:1755:8)
at [object Object].<anonymous> (/home/*******/node_modules/selenium-webdriver/lib/webdriver/promise.js:2056:12)
at [object Object] [as _onTimeout] /home/*******/node_modules/selenium-webdriver/lib/goog/async/run.js:125:21)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
[launcher] Process exited with error code 1

Is there a know scenario where this is likely to happen?

Protractor version: 1.7

node version: 0.10.25

This is the code around ElementFinder:512:

ElementFinder.prototype.itEqualsText = function(name, text) {
if (_.isNully(text)) { text = name; name = this.originalName; };
var elm = this; name = name || this.originalName;
if (_.isNully(name)) throw new Error('needs name');
if (_.isNully(text)) throw new Error('needs text');
// This helps with stack traces after rit (retry it) timeouts.
// If you attempt to build the trace within an it() block you
// lose the whole trace because of the way Jasmine build the tests.
rit('"' + name + '" equals text: "' + text + '"', function() {
expect(elm.getText()).toEqual(text); // line 512

This is the code around ElementFinder:618:

// Fix current Protractor implementation so it keeps a reference to the
// original index as it was on previous Protractor versions: i.e. <= 1.2.0
ElementArrayFinder.prototype.get = function(index) {
var self = this;
var getWebElements = function() {
return self.getWebElements().then(function(parentWebElements) {
var i = index;
if (i < 0) {
// wrap negative indices
i = parentWebElements.length + i;
if (i < 0 || i >= parentWebElements.length) {
throw new Error('Index out of bound. Trying to access element at ' + // line 618
'index:' + index + ', but there are only ' +
parentWebElements.length + ' elements');
return [parentWebElements[i]];
getWebElements.with_index_ = index; // added
return new ElementArrayFinder(this.ptor_, getWebElements, this.locator_).

I ihnerited this code, so I’m not 100% of what it does. I think it gets an array index from element.all(“…”).get(x).