meteormeteor-velocity

meteor-testing tutorial fails


I started the meteor-testing tutorial, but the 2nd automatic generated test fails with:

TypeError: Cannot call method 'url' of undefined

So it seems that the client variable is not defined. Did anybody experience similar issues? (btw is there a way to debug this)

i'm using ubuntu 14.04 with

Meteor 1.2.0.2
node v4.0.0
xolvio:cucumber       0.19.4_1  CucumberJS for Velocity

Update:

Generated test code intests/cucumber/features/step_definitions/sample_steps.js:

// 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');
  // 1st TEST OK
  this.Given(/^I am a new user$/, function () {
    server.call('reset'); // server is a connection to the mirror
  });
  // 2nd TEST FAIL
  this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
    // process.env.ROOT_URL always points to the mirror
    client.url(url.resolve(process.env.ROOT_URL, relativePath));
  });
...
};

Solution

  • I was said to file an issue in the chimp repository, where I was pointed to the solution:

    // 2nd TEST FAIL
    this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
      // REPLACE client with browser
      browser.url(url.resolve(process.env.ROOT_URL, relativePath));
    });
    

    This is a short fix, but I'm not sure whether you should later rather use client (seems to be wrapper for different environments).


    **Update: ** meanwhile this was fixed, no adaption necessary anymore