I'm writing cucumber tests to test user 'Remember me' type functionality, and in order to do that in real life the user would close their browser, reopen their browser, and come back to the site.
My test so far looks like this:
Scenario: 'Remember me' checked
Given I have checked "Remember me"
And I am logged in as "[email protected]"
When I close and re-open my browser
And I come back to the dashboard
Then I should be on the dashboard
However I don't know what to fill in for the 'When I close and re-open the browser' step definition.
Does anyone know how I would do this (or if this isn't what I should be doing, how I should be testing it?)
I use Show me the cookies.
Add to bundle with gem 'show_me_the_cookies'
and then add World(ShowMeTheCookies)
in your features/support/env.rb
Then just define a step:
When /^I reopen the browser$/ do
expire_cookies
visit [ current_path, page.driver.request.env['QUERY_STRING'] ].reject(&:blank?).join('?')
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With