流星测试教程失败

时间:2015-10-25 21:46:00

标签: meteor meteor-velocity

我启动了meteor-testing tutorial,但第二次自动生成测试失败了:

TypeError: Cannot call method 'url' of undefined

所以似乎没有定义客户端变量。有没有人遇到过类似的问题? (顺便问一下调试这个的方法)

我正在使用ubuntu 14.04和

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

更新

生成的测试代码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));
  });
...
};

1 个答案:

答案 0 :(得分:0)

据说我提交issue in the chimp repository,我指的是解决方案:

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

这是一个简短的修复,但我不确定您以后是否应该使用客户端(似乎是不同环境的包装)。

**更新:**同时这是固定的,不再需要适应