I have been developing a custom Protractor - browserstack framework from the ground up.
While implementing the onComplete function as outlined on the official site in conf.ts -
// Code snippet to update test status on BrowserStack based on test assertions
onComplete: function (passed) {
if (!passed) {
browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "At least 1 assertion has failed"}}');
}
if (passed) {
browser.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "All assertions passed"}}');
}
}
An error message is appearing on the Console:
*Debugger attached. conf.ts:87:1 - error TS2322: Type '(passed: any) => void' is not assignable to type '() => void'. 87 onComplete: function (passed) {
node_modules/protractor/built/config.d.ts:410:5
410 onComplete?: () => void;
~~~~~~~~~~
The expected type comes from property 'onComplete' which is declared here on type 'Config'*
Can anyone provide guidance on how to resolve this issue?