Search code examples
javascriptnode.jsleadfoot

polluntil undefined is not a function


I have the following code:

define(function(require) {
    function myclass(remote) {
        this.remote = remote;
    }

myclass.prototype = {
    constructor: myclass,

.....

create_campaign: function() {
    var name = 'mycampaign';
    this.camapaignName = name.concat((Math.random()*1000).toString())

    return this.remote
        .findByXpath('//*[@id="new_campaign"]/button')
            .click()
            .end()
        .then(this.remote.pollUntil(function() {
            return (document.getElementsByClassName('fa fa-user-plus').length == 1) ? true : null;
        },10000))
        .then(function() {
            return true;
        });

Intern keeps on giving me

TypeError: undefined is not a function

When I try to assign pollUntil to a variable and call it, it still gives me the same error. I'm using the latest versions of Chromedriver/Chrome/etc.


Solution

  • I needed to add the code in the AMD defines:

    var pollUntil = require('intern/dojo/node!leadfoot/helpers/pollUntil');