Xolvio/meteor-cucumber test finds element that does not exist only to fail the next step where it will be used


#1

I am doing three steps where I am getting an error:

And I click Starta Wavy ".createUser"
Then I am at the sms verification page "#smsCodeVerification"
And I fill in the sms code "#smsCodeVerification"

These steps are defined like this:

this.When(/^I click Starta Wavy "([^"]*)"$/, function (startWavyButton, callback) {
  this.client
    .waitForExist(startWavyButton)
    .waitForVisible(startWavyButton)
    .click(startWavyButton)
    .call(callback);
});

this.Then(/^I am at the sms verification page "([^"]*)"$/, function (verificationElement, callback) {
  this.client
    .waitForExist(verificationElement, 4000)
    //.waitForVisible(verificationElement, 3000) 
    .call(callback);
});

this.Then(/^I fill in the sms code "([^"]*)"$/, function (verificationField, callback) {
  this.client
    .waitForExist(verificationField, 4000)
    //.waitForVisible(verificationField)
    .setValue(verificationField, parseInt(this.server.call('getSmsCodeForUser', "+467*******").toString()))
    .call(callback);
});
  1. I wait for a button and click it. Pass
  2. I wait for an element to show so that I know I’ve been moved to the next page from the button click. Pass
  3. I use the id of the field (same id as used in step 2) to fill a value in the input field. Here it fails saying that the element does not exist but it did exist in step 2.

On the error screenshot I see that I have not been moved on to the next page but I am still on the page where I click a button. What am I doing wrong?