async / await not working due to jasminewd2
See original GitHub issueI`m trying to use protractor with plain nodejs (not Typescript) and async functions as test callbacks. Unfortunately an error appears telling me that these async functions are no functions.
Stacktrace:
1) some test encountered a declaration exception
Message:
Error: async function() {
await browser.get('https://www.google.com');
});
} is not a function
Stack:
Error: async function () {
await browser.get('https://www.sixt-neuwagen.de');
let blub = await ekomi.isDisplayed();
expect(blub).toBe(true);
} is not a function
at validateFunction (/<some>/<path>/projects/protractor/node_modules/jasminewd2/index.js:21:11)
at /<some>/<path>/projects/protractor/node_modules/jasminewd2/index.js:139:16
at Suite.<anonymous> (/<some>/<path>/projects/protractor/specs/index.js:5:5)
at Object.<anonymous> (/<some>/<path>/projects/protractor/specs/index.js:2:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
Testsuite:
describe('some test', function() {
it('should do something', async function() {
await browser.get('https://www.google.com');
});
});
Reason: (Taken from jasminewd2 index.js)
function validateFunction(functionToValidate) {
if (functionToValidate && Object.prototype.toString.call(functionToValidate) === '[object Function]') {
return functionToValidate;
} else {
throw Error(functionToValidate + ' is not a function');
}
}
Async functions checked with Object.prototype.toString.call(functionToValidate)
evaluate to [object AsyncFunction].
Env:
- Node Version:
7.7.1
- Protractor Version:
5.1.1
- jasminewd2 Version:
2.0.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (3 by maintainers)
Top Results From Across the Web
protractor async await not a function - Stack Overflow
I meet the same issue with nodejs 7.9 + protractor 5.1.1. This is an issue in jasminewd2, and still open, see the following...
Read more >jasminewd2 - npm
Automatically makes tests asynchronously wait until the WebDriverJS control flow is empty. If a done function is passed to the test, waits for ......
Read more >jasminewd2 | Yarn - Package Manager
Automatically makes tests asynchronously wait until the WebDriverJS control flow is empty. If a done function is passed to the test, waits for...
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ......
Read more >Async Await Feature In Angular - StackBlitz
Run `ng serve` for a dev server. Navigate to. `http://localhost:4200/`. The app will. automatically reload if you change any of the. source files....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@heathkit, I was able to use async/await (without Babel) in my protractor tests after applying angular/jasminewd#87
Thanks for the fix! I’ll take a look.