1

I'm writing intern 4 functional tests. When I try to use pollUntil it is undefined

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

Error:

 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

I've tried various things to import the pollUntil function like

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

None have worked.

Anyone have a hint on how to access pollUntil?

Marc
  • 19,394
  • 6
  • 47
  • 51

1 Answers1

0

pollUntil is the default export of the helpers/pollUntil module. Intern and Leadfoot are built using ESM default export semantics, so the default export is called "default". Try:

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

or

const pollUntil = require('leadfoot/helpers/pollUntil').default;
jason0x43
  • 3,363
  • 1
  • 16
  • 15