Having a Cucumber test create a user


I’m writing a simple user login feature:

Feature: User Login

  As a user
  I want to be able to log in
  So that I can access my account

  Scenario: A successful login
    Given I am on the login page
    And my account exists
    And I am not currently logged in
    When I fill out the username and password fields and click submit
    Then I am redirected to the dashboard

My question is, do I put my Accounts.createUser call in the “my account exists” step, or do I put it in fixtures instead?

Or do I leave out the “And my account exists” step, and just create the user in fixtures?


Part two question: I’m not sure how to access Meteor.userId() within Cucumber step definitions. I suppose I could make a Meteor method that I could call via server.call, which returns true if logged in.