【问题标题】:I want to know the count of how many times my after launch is getting executed in config file我想知道我的启动后在配置文件中执行了多少次
【发布时间】:2019-08-09 18:21:53
【问题描述】:

在我的配置文件 beforeLaunch 和 afterLaunch 执行两次,因为失败的脚本再次重新执行。我使用量角器薄片重新执行文件。我想知道 afterlanch 和 beforeLaunch 计数。谁能帮忙

【问题讨论】:

    标签: typescript protractor


    【解决方案1】:

    我不确定 protractor flake npm 包是如何工作的,但您可以尝试使用允许您创建的 global variables 节点。

    conf.js

    //Declare the variable
    global.glbBeforeLaunchCounter = 0;
    global.glbAfterLaunchCounter = 0;
    
    exports.config = {
      beforeLaunch: function () {
        glbBeforeLaunchCounter = glbBeforeLaunchCounter + 1;
    
        //...
      },
      afterLaunch: function () {
        glbAfterLaunchCounter = glbAfterLaunchCounter + 1;
    
        //...
      }
    }
    

    【讨论】:

    • 我实际上尝试过这样做,但是在声明它时显示错误“[ts] Property 'glbAfterLaunchCounter' does not exist on type 'Global'. [2339]”
    • @akhila 你确定用小写的'g'声明你的全局变量吗?
    • 实际上@akhila 如果您使用的是打字稿this question 可能有用
    猜你喜欢
    • 1970-01-01
    • 2022-11-03
    • 2016-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-01
    • 1970-01-01
    相关资源
    最近更新 更多