【发布时间】:2019-03-11 07:54:41
【问题描述】:
先生,我正在尝试使用量角器黄瓜框架运行文件 async 和 await 概念它通过了我所有的测试,但它总是给出错误 关于角度可测试性,我不知道为什么它会给出这样的类型 错误,请阅读下面的代码并帮助我弄清楚我在哪里 这种方法是错误的。
请参考下面我的功能文件:-
请参考我的 pageobjects 文件如下:-
请参考以下步骤定义文件:-
请参考下面的配置文件conf.ts :-
请参考以下控制台日志:-
[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
【问题讨论】:
-
当您的应用程序的某些部分没有角度时,最常见的错误是。你知道你的应用程序是否有这样的部分,比如第三方提供的登录屏幕?
-
@keshav - 尝试添加 browser.ignoreSynchrosisation = true;在您的配置文件中,您的应用程序可能是非角度的,通过添加上面的命令它不会用于角度页面。
-
@Parthi 我的应用程序是 Angular 应用程序,我尝试通过添加 browser.ignoresynchronization=true 但它给出了 nosuchelementexception 错误,并且我得到 UnhandledPromiseRejectionWarning: Unhandled Promise Rejection。此错误源于在没有 catch 块的情况下抛出异步函数内部,或拒绝未使用 .catch() 处理的承诺。
-
@Parthi 请参考此链接以了解当我们添加 ignoresynchronization=true, pasteboard.co/I4VBe5q.png 时究竟会发生什么
标签: protractor cucumber cucumberjs