1
votes

I'm writing some e2e tests for my Vue application. I so this post: waitForText and I decided to give it a try. I'm using nightwatch v0.9.21 with node v9.11.1.

My test look like this:

 beforeEach: function(browser) {
    const devServer = browser.globals.devServerURL;

    browser
      .url(devServer)
      .waitForElementVisible('#AuthenticationWrapper', 5000)
      .setValue('input[type=text]', '[email protected]')
      .setValue('input[type=password]', 'demo')
      .click('button')
      .pause(4000)
      .useXpath()
      .waitForText('//*[@id="userMenu"]/div[1]/div/button/div', (text) => {
        return text == 'DEMO USER';
      });
  },

But when I run the tests I get the following error:

TypeError: browser.url(...).waitForElementVisible(...).setValue(...).setValue(...).click(...).pause(...).useXpath(...).waitForText is not a function

You know how can I solve this?

1
browser.url(...).waitForElementVisible(...).setValue(...).setValue(...).click(...).pause(...).useXpath(...) doesn't have the method .waitForText(). You should try to check the former by logging it in the console. - Ivan

1 Answers

1
votes

It looks like you haven't installed "nightwatch-commands" node js package in your project.