Currently, I am incorporating external code in my Protractor tests that yield ES6 Promises.
I had the intention of chaining these promises using a ControlFlow, but I encountered a type error during Typescript compilation.
Within the test:
import {browser} from 'protractor';
...
it('should have a title', () => {
let flow = browser.controlFlow();
flow.execute(testServer.fixture('user_test_roles'));
});
Upon execution:
[13:04:39] E/launcher - Error: ⨯ Unable to compile TypeScript
src/app/app.e2e.ts (9,18): Argument of type 'Promise<{}>' is not assignable to parameter of type '() => {} | Promise<{}>'.
Type 'Promise<{}>' provides no match for the signature '(): {} | Promise<{}>' (2345)
Trying flow.wait()
results in a different type error:
[13:08:27] E/launcher - Error: ⨯ Unable to compile TypeScript
src/app/app.e2e.ts (9,15): Argument of type 'Promise<{}>' is not assignable to parameter of type 'Function | Promise<{}>'.
Type 'Promise<{}>' is not assignable to type 'webdriver.promise.Promise<{}>'.
Property 'cancel' is missing in type 'Promise<{}>'. (2345)
Is there a method to wrap the promises to ensure compatibility?