0

我开始了流星测试教程,但是第二次自动生成的测试失败了:

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));
  });
...
};
4

1 回答 1

0

据说我在黑猩猩存储库中提出了一个问题,在那里我被指出了解决方案:

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

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


**更新:**同时这已修复,不再需要调整

于 2015-10-29T15:00:03.583 回答