changing selenium domain/subdomain within cucumber scenarios

Posted by dalyons on Stack Overflow See other posts from Stack Overflow or by dalyons
Published on 2010-04-27T00:19:56Z Indexed on 2010/04/27 0:23 UTC
Read the original article Hit count: 684

Filed under:
|
|
|

So, I have a Rails webapp that utilizes subdomains for separating the admin functionality from the public functionality using subdomain-fu. So there is functionality(that I want to test!) contained within two urls(eg admin.example.com and www.example.com). I want some scenarios to run against the admin domain, and some against the www domain.

My problem is that I cant figure out how to change the domain that selenium uses at any time after startup. I can put something like this in my env.rb:

Webrat.configure do |config|
  config.mode = :selenium
  config.application_address = "admin.example.com"
end

And it will work, but only for the scenarios that need the admin domain. If I try something like:

host! "www.example.com"

inside my steps, well it seems to just be ignored by selenium, which goes on using "admin.example.com"

Any ideas? Or if its not possible, any ideas for a workaround?

© Stack Overflow or respective owner

Related posts about selenium

Related posts about cucumber