【问题标题】:Overriding function "it" in WDIOWDIO 中的重写函数“it”
【发布时间】:2021-12-28 09:09:28
【问题描述】:

我想重写一个函数“它”。我能做到吗?

old_it = it
it = (name, foo) ->
  console.log('111')
  old_it(name, foo)
  console.log('222')

当我运行此代码时,控制台会输出一条消息“it = undefined”

【问题讨论】:

    标签: testing webdriver-io wdio


    【解决方案1】:

    您需要更正文件 wdio.conf.js 中的 beforeTestafterTest 属性

    ...
        beforeTest: function (test, context) {
            console.log('start test ' + test.title)
        },
    ...
    
        afterTest: function(test, context, { error, result, duration, passed, retries }) {
            console.log('finish test ' + test.title)
        },
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-02
      • 2020-01-01
      • 2019-06-17
      • 2015-02-02
      • 1970-01-01
      • 2013-07-03
      • 2021-05-20
      • 1970-01-01
      相关资源
      最近更新 更多