This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Some references to files are missing in stack trace with async/await #4600
Open
Description
Stacktrace is not having the reference to actual file name from where the error is triggered for the protractor.
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.<anonymous> (/Users/e2e/search-helper.ts:14:34) **at step (/Users/e2e/search-helper.ts:32:23)
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.
Metadata
Metadata
Assignees
Labels
No labels