[rspec-users] Cucumber speed tips
ben at benmabey.com
Sun Jan 4 19:08:27 EST 2009
On 1/3/09 8:36 PM, Luke Melia wrote:
> On Jan 3, 2009, at 9:12 PM, Ben Mabey wrote:
>> The downside with this approach is that it only works with the rails
>> webrat adapter. One solution which I have been meaning to do is to
>> create a UsersSessionManager. The manager would be responsible for
>> logging in all the various roles you use in your app with different
>> webrat sessions (and then caching them.) You could then swap out
>> which session you would be using in your steps...
>> So you could then do something like:
>> logged_in_as 'Admin' do |session|
>> session.click_link 'Foo'
>> Given /^I am logged in as an '(.+)'$/ |role|
>> login_as role
>> The 'login_as' would swap out the session that the World object uses
>> so the next steps would be using the appropriate session.
> In general I like the idea, Ben. At weplay, we use webrat to drive
> rails and selenium, and logged_in_as method has the following
> implementation in the Selenium world:
> def logged_in_as(user)
> visit login_for_test_path(user)
> where login_for_test_path is is a named route defined only for the
> selenium environment that provides a "quick" login of a given user.
> Would the solution you're thinking of help with this? I'm not sure how
> you would "cache" a selenium session.
I'm by no means a Selenium expert so I may be making some incorrect
assumptions. I thought that it was possible with Selenium to have
different sessions open concurrently for the same selenium server. (i.e.
have more than one SeleniumDriver/browser instance running against the
same server but with different session ids.) Is that not possible?
> Luke Melia
> luke at lukemelia.com
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users