0
votes

Sir, I am trying to run file using protractor cucumber framework by using async and await concept it passes all my tests but it always gives error regarding angular testability and I don't know why it gives such a type of error, please read the code below once and help me to figure out where I am wrong in this approach.

Please refer below my feature file :-

featurefile

Please refer my pageobjects file as below :-

pageobject file

Please refer step-definition file as below:-

stepdefinitionfile

Please refer configuration file conf.ts as below :-

configurationfile

Please refer console logs as below:-

[12:31:48] I/launcher - Running 1 instances of WebDriver
[12:31:48] I/direct - Using ChromeDriver directly...

DevTools listening on ws://127.0.0.1:54978/devtools/browser/3cec07ae-0398-49b1-8fd9-36607b210799
...Menu 9 option reached
..

1 scenario (1 passed)
4 steps (4 passed)
0m00.034s
(node:2484) UnhandledPromiseRejectionWarning: Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined.  This could be either because this is a
non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"
    at runWaitForAngularScript.then (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\browser.js:463:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)Error
    at ElementArrayFinder.applyAction_ (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:459:27)
    at ElementArrayFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:91:29)
    at ElementFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:831:22)
    at homepageclass.clickEXWmenu (E:\Backup_work\Protractor projects\cucumber2_framework\pageobjects\menu9.PO.js:10:29)
    at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:22:20)
    at Generator.next (<anonymous>)
    at E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:3:12)
    at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:21:12)
(node:2484) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2484) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2484) UnhandledPromiseRejectionWarning: Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined.  This could be either because this is a
non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See https://github.com/angular/protractor/issues/2643 for details"
    at runWaitForAngularScript.then (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\browser.js:463:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)Error
    at ElementArrayFinder.applyAction_ (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:459:27)
    at ElementArrayFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:91:29)
    at ElementFinder.(anonymous function).args [as click] (E:\Backup_work\Protractor projects\cucumber2_framework\node_modules\protractor\built\element.js:831:22)
    at homepageclass.clickmenu9 (E:\Backup_work\Protractor projects\cucumber2_framework\pageobjects\menu9.PO.js:13:26)
    at World.<anonymous> (E:\Backup_work\Protractor projects\cucumber2_framework\Stepdefinition\first.steps.js:26:10)
(node:2484) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
[12:31:50] I/launcher - 0 instance(s) of WebDriver still running
[12:31:50] I/launcher - chrome #01 passed
1
This error is most typically seen when some part of your application is non-angular. Do you know if your application has any parts like this, such as a third-party provided login screen? - DublinDev
@keshav - try adding browser.ignoreSynchrosisation = true; in your configuration file, your application might be non-angular, by adding above command it wont for an angular page. - Parthi
@Parthi my application is angular application and I have tried by adding browser.ignoresynchronization=true but then it gives error for nosuchelementexception and also I get UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). - keshav dwivedi
@Parthi please refer this link to get an idea of what exactly happens when we add ignoresynchronization=true, pasteboard.co/I4VBe5q.png - keshav dwivedi

1 Answers

0
votes

Your first problem here is you are using await but the function you are using await on is not async.

public async clickEXWMenu(){
   await this.EXWenquirymenu.click();
}

This is how it should be ^