Xolvio/meteor-cucumber passing but not creating data in db


#1

I am trying to use xolvio/meteor-cucumber to do the steps of creating a user. The tests pass but no data is being created in the database as it would if I did these steps manually. The steps looks like this:

Feature: Create a new salon for existing or new user

	Create a new salon for new or existing user.
	
	Background:
		Given I am not logged in

	@dev
    Scenario: Clicking the signup link and filling in the fields to create a new salon
		Then I am at the login screen "/login"
		When I click the signup link "Signa upp och börja använda Wavy"
    Then I see the signup form "/register"
		And I should see the registration div element ".registerModal"
    When I fill in the first name with "Tester"
		And I fill in the last name with "Testing"
		And I fill in the number with "070*******"
		And I will in the email with "test@example.com"
		And I click the acceptance checkbox "Jag godkänner villkoren"
		And I click "Starta Wavy"
		Then I am in the sms verification page "/verify_phone_number"

And the steps are defined like this:

(function () {
 
  'use strict';
 
  // You can include npm dependencies for support files in tests/cucumber/package.json
  var _ = require('underscore');
 
  module.exports = function () {
 
    // You can use normal require here, cucumber is NOT run in a Meteor context (by design)
    var url = require('url');
 
    this.Given(/^I am not logged in$/, function () {
      // no callbacks! DDP has been promisified so you can just return it
      return this.server.call('userId');
    });
 
    this.Then(/^I am at the login screen "([^"]*)"$/, function (relativePath, callback) {
      // WebdriverIO supports Promises/A+ out the box, so you can return that too 
      this.client. // this.browser is a pre-configured WebdriverIO + PhantomJS instance
        url(url.resolve(process.env.ROOT_URL, relativePath)). // process.env.ROOT_URL always points to the mirror
        call(callback);
    });
 
    this.When(/^I click the signup link "([^"]*)"$/, function (arg1, callback) {
      // click an element 
      this.client.click('.register').call(callback);
    });
 
    this.Then(/^I see the signup form "([^"]*)"$/, function (relativePath, callback) {
      // get the pages url
      this.client.url(url.resolve(process.env.ROOT_URL, relativePath)).call(callback);
    });
 
    this.Then(/^I should see the registration div element "([^"]*)"$/, function (args1, callback) {
      // you can use chai-as-promised in step definitions also
      this.client.waitForVisible('.registerModal').call(callback);
    });
 
    this.When(/^I fill in the first name with "([^"]*)"$/, function (arg1, callback) {
      this.client.setValue('#fname', arg1).call(callback);
    });
 
    this.When(/^I fill in the last name with "([^"]*)"$/, function (arg1, callback) {
      this.client.setValue('#lname', arg1).call(callback);
    });
 
    this.When(/^I fill in the number with "([^"]*)"$/, function (arg1, callback) {
      this.client.setValue('#tel', arg1).call(callback);
    });
 
    this.When(/^I will in the email with "([^"]*)"$/, function (arg1, callback) {
      this.client.setValue('#email', arg1).call(callback);
    });
 
    this.When(/^I click the acceptance checkbox "([^"]*)"$/, function (arg1, callback) {
      this.client.click('#terms').call(callback);
    });
 
    this.When(/^I click "([^"]*)"$/, function (arg1, callback) {
      this.client.click('.createUser').call(callback);
    });
 
    this.Then(/^I am in the sms verification page "([^"]*)"$/, function (relativePath, callback) {
      this.client.url(url.resolve(process.env.ROOT_URL, relativePath)).call(callback);
    });
  };
})();

How come nothing is being inserted in the DB if we manage to reach the “/verify_phone_number” page at which point we should have created a user.


#2

Ok, it’s just me using url wrong. Should not be using url.resolve.