在运行量角器黄瓜框架时面临问题

时间:2019-03-11 07:54:42

标签: protractor cucumber cucumberjs

先生,我正在尝试通过使用量角器黄瓜框架运行文件 异步并等待的概念,它通过了我所有的测试,但始终给出错误 关于角度可测性,我不知道为什么会给出这种类型的 错误,请一次阅读以下代码,帮助我弄清楚我在哪里 这种方法是错误的。

请在下面参考我的功能文件:-

featurefile

请参考以下我的pageobjects文件:-

pageobject file

请参考以下步骤定义文件:-

stepdefinitionfile

请参考以下配置文件conf.ts :-

configurationfile

请参考以下控制台日志:-

[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 个答案:

答案 0 :(得分:0)

您的第一个问题是您正在使用await,但是您正在使用await的函数不是异步的。

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

这应该是^