Reputation: 151
For some reasons, I am trying to replace TestCafe Async / Await with Promises. Below is the chunk of code where I used the promises in place of await.
But getting an error like: A call to an async function is not awaited. Use the "await" keyword before actions, assertions or chains of them
to ensure that they run in the right sequence.
Upvotes: 3
Views: 1363
Reputation: 2903
If you don't want to use async/await
, you can return a Promise from the test function:
fixture `Example`
.page `example.com`;
test(`example`, t => {
let promise = Promise.resolve(t);
return promise
.then(result => {
return result.typeText('...');
})
.then(result => {
return result.click('...');
});
});
Upvotes: 4