Version : v8.6.0
Platform: MacOS
Protractor version: 5.1.2
configuration:
exports.config = {
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
print: function () {
}
}
onPrepare()
{
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true,}}));
}
Sample spec:
```
it('Protractor stack trace issue', async () =>
{
const helper = new SearchHelper();
await helper.doSearch('test');
});
**search-helper.ts:**
async doSearch(text) {
await browser.get('http://google.com');
await browser.wait(EC.visibilityOf(element(by.name('q1'))), 10000, 'No Element found');
await element(by.name('q1')).click(); //invalid locator
}
**1. Stack Trace with browser.wait**
✗ Protractor stack trace issue
-Failed: No Element found Wait timed out after 10007ms
Wait timed out after 10007ms
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at TimeoutError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:238:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2107:17
at process._tickCallback (internal/process/next_tick.js:109:7)
From asynchronous test: Error at Suite.<anonymous> (/Users/e2e/sample-spec.ts:27:3)
at Object.<anonymous> (/Users/e2e/sample-spec.ts:15:1)
at Module._compile (module.js:570:32) at Module.m._compile (/Users/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/node_modules/ts-node/src/index.ts:395:12)
**2. If we comment browser.wait statement then the stacktrace is**
✗ Protractor stack trace issue
Failed: No element found using locator: By(css selector, *[name="q1"])
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at NoSuchElementError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:168:5)
at elementArrayFinder.getWebElements.then (/usr/local/lib/node_modules/protractor/lib/element.ts:851:17)
at process._tickCallback (internal/process/next_tick.js:109:7)Error
at ElementArrayFinder.applyAction_ (/usr/local/lib/node_modules/protractor/lib/element.ts:482:23)
at ElementArrayFinder.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.ts:96:21)
at ElementFinder.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.ts:873:14)
at SearchHelper.
at Object.next (/Users/e2e/search-heper.ts:13:53)
at fulfilled (/Users/e2e/search-helper.ts:4:58)
at process._tickCallback (internal/process/next_tick.js:109:7)
From asynchronous test: Error at Suite.<anonymous> (/Users/e2e/sample-spec.ts:27:3)
at Object.<anonymous> (/Users/e2e/sample-spec.ts:15:1) at Module._compile (module.js:570:32)
at Module.m._compile (/Users/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/node_modules/ts-node/src/index.ts:395:12)
```
Observe the 2nd stack trace, it has references to search-helper file but it's not there in the first stack trace. It's very important to have this reference in stack trace for debugging.
Tried by increasing Error.stackTraceLimit also but no luck.
Can you:
Post a test case that doesn't use third-party dependencies, i.e., uses only built-in modules, and
Test with the latest node 8 release?
Hey, this looks like a protractor issue, please open it against protractor.
I've tried creating the issue using no-op and delay async functions and the stack trace showed up correctly.
Probably this is the reason: https://github.com/nodejs/node/issues/11865
Most helpful comment
Can you:
Post a test case that doesn't use third-party dependencies, i.e., uses only built-in modules, and
Test with the latest node 8 release?