【问题标题】:Protractor: Getting [DEP0018] DeprecationWarning and test run is terminated randomly量角器:获取 [DEP0018] DeprecationWarning 和测试运行随机终止
【发布时间】:2018-06-09 06:45:50
【问题描述】:

我正在使用带有节点 8.9.3 和 npm 5.6.0 的最新量角器版本 5.2.2 我有大约 30 个测试套件,每个套件都有大约 150 个测试用例。 它们都在我的本地运行良好,但是当我使用 grunt 在具有 Windows 和完全相同的节点和量角器版本的 Jenkins 机器上运行它们时,我随机收到以下错误并且执行卡住,直到我终止 Jenkins 作业。

(node:3060) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TimeoutError: timeout
(Session info: chrome=63.0.3239.84)
(Driver info: chromedriver=2.34.522940 
(1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 6.3.9600 x86_64)
(node:3060) [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:3060) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
A Jasmine spec timed out. Resetting the WebDriver Control Flow.

失败是随机发生的,而不是在某个测试用例之后发生的。所以有时它只会在开始时失败,有时会在中间失败,有时会在最后一个测试用例上失败。

我尝试过同时使用 seleniumAddressdirecConnect 但同样的问题。 这浪费了我很多时间,但仍然停留在我开始的地方。 在这里的任何帮助将不胜感激。

【问题讨论】:

    标签: node.js jenkins selenium-webdriver gruntjs protractor


    【解决方案1】:

    错误堆栈已告诉您根本原因“A Jasmine 规范超时”。这意味着某些规范需要很长时间才能完成,超过了超时时间。

    我认为在 Jenkins 机器上运行的网站比你本地的慢。

    请阅读下面的 Protractor 网站链接,您会找到解决方案。 http://www.protractortest.org/#/timeouts#timeouts-from-jasmine

    exports.config = {
    
        allScriptsTimeout: 120 * 1000,
    
        jasmineNodeOpts: {
            defaultTimeoutInterval: 120 * 1000,
            onComplete: null,
            isVerbose: true,
            showColors: true,
            includeStackTrace: true,
            realtimeFailure: true
        },
        ... 
    };
    

    【讨论】:

    • 我的 conf.js 中有以下内容,我认为加载它不会花费比这更多的时间,因为它是在本地运行的。 ignoreUncaughtExceptions: true allScriptsTimeout: 5000000 defaultTimeoutInterval: 4000000
    • 你是否使用了 Jasmine 并将 defaultTimeoutInterval 放入 jasmineNodeOpts 中?
    • 是的,我有jasmineNodeOpts: { isVerbose: true, showColors: true, includeStackTrace: true, defaultTimeoutInterval: 4000000 },
    • 你的配置是正确的,我现在只能怀疑的可能原因是量角器,也许你可以试试低版本的量角器而不是最新的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 2015-06-18
    • 1970-01-01
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    相关资源
    最近更新 更多