异步函数结束后导出量角器配置



我正在设置配置对象以启动量角器,并且在异步功能完成之前导出配置对象,因此我从中调用异步函数的字段为空。

例:


const config: Config = {
  directConnect: true,
  SELENIUM_PROMISE_MANAGER: false,
  allScriptsTimeout: 60000,
  stopSpecOnExpectationFailure: true,
  jasmineNodeOpts: getJasmineNodeOpts(),
  baseUrl: env.baseUrl,
  capabilities: capabilities,
  specs: getTestfailed()  <------- This is the async function
)```
exports.config = config

so the config object is exported before specs have been updated.

您可以尝试以下方式更新规格

return browser.getProcessedConfig().then(function(config) {
        config.specs = //this take array of string
       }

在尝试了许多方法之后...我决定做http请求(getTestfailed(((同步,我知道这并不理想,但足以达到目的

最新更新