1

我正在编写实习生 4 功能测试。当我尝试使用 pollUntil 它是未定义的

  .findDisplayedByCssSelector('button.primary')
  .then( el => pollUntil(function(pollEl) {
      if( pollEl.isEnabled() ) return true;
      return null;
  }, el, 300000 )

错误:

 chrome 63.0.3239.132 on Windows NT -  Test - do create (0.352s)
   ReferenceError: pollUntil is not defined
     at Command.remote.findDisplayedByClassName.findByXpath.click.clearValue.type.end.end.findDisplayedByCssSelector.then.end.findDisplayed

我尝试了各种方法来导入 pollUntil 函数,例如

const { pollUntil } = require('leadfoot/helpers/pollUntil');

没有一个工作。

有人对如何访问 pollUntil 有提示吗?

4

1 回答 1

0

pollUntilhelpers/pollUntil模块的默认导出。Intern 和 Leadfoot 是使用 ESM 默认导出语义构建的,因此默认导出称为“默认”。尝试:

const { default: pollUntil } = require('leadfoot/helpers/pollUntil');

或者

const pollUntil = require('leadfoot/helpers/pollUntil').default;
于 2018-02-06T13:14:28.253 回答