Reputation: 3211
I have started building a test suite for a Meteor app with Cucumber (following http://joshowens.me/cucumber-js-and-meteor-the-why-and-how-of-it/). Some tests are passing without any functionality in place.
For example, the test file login.feature
includes Feature: Allow users to login
, with Scenario: A user can login with valid information
and When I click on sign in link
which is supported in the file loginSteps.js
with:
this.When(/^I click on sign in link$/, function (callback) {
helper.world.browser.
waitForExist('.at-signup', 7000).
waitForVisible('.at-signup').
click('.at-signup').
call(callback);
});
The sign in button actually has class="btn btn-default navbar-btn"
and yet Velocity says that the test passes in 858ms. Another test passes url(helper.world.cucumber.mirror.rootUrl + "event/1")
although there is no such url.
Other tests do fail, however, like:
getText('.user-menu .dropdown-top-level', function (err, username) {
assert.equal(username[0], 'userme');
}).
with error:
Then I should be logged in Fail
TypeError: Cannot read property '0' of undefined
Any ideas?
Upvotes: 1
Views: 445
Reputation: 191
Try doing a console.log(err) inside your getText statement. My guess is that you aren't finding a match when you run it.
Try something like this:
getText('.user-menu .dropdown-top-level', function (err, username) {
if (err) {
callback.fail(err.message);
}
assert.equal(username[0], 'userme');
}).
Upvotes: 1