I have a Behat scenario that looks like the following:
Scenario: Creating and booking an event
Given I go to "http://domain.com/"
And I am logged in with the username "user" and password "pass"
And I follow "link"
When I press "Book Now"
Then I should see "Booking Confirm"
This works fine, but i want to be able to specify a specific URL to go to after logging in, rather than just following a link. Like this:
Scenario: Creating and booking an event
Given I go to "http://domain.com/"
And I am logged in with the username "user" and password "pass"
And I go to "http://domain.com/single-event/?event_id=14&start_time=1457481600&finish_time=1457481600"
When I press "Book Now"
Then I should see "Booking Confirm"
When i write the test like this it doesn't work - I get:
Button with id|name|title|alt|value "Book Now" not found.
I've dumped the HTML that is being parsed at this point and it is apparent that the user is logged out (the Book Now button doesn't appear if the user is logged out). It seems that a new session is being started after the "And I go to" statement - is the avoidable, and is there any other way to achieve what I'm looking for?