views:

413

answers:

3

When I'm working with AJAX + Webrat in Selenium mode, I'll often have to specify real domains and subdomains. Consequentially I'll get this message a lot:

14:00:45.222 WARN - you appear to be changing domains from http://test.host:3001 to http://elabs.test.host:3001/dashboard this may lead to a 'Permission denied' from the browser (unless it is running as *iehta or *chrome, or alternatively the selenium server is running in proxy injection mode)

While accurate, it clogs up my output and is pretty useless to me. Any ideas on how to get suppress this message while running in Selenium mode?

+1  A: 

You can and 2 extra config parameters to your webrat configuration:

 Webrat.configure do |config|
  config.mode = :selenium
  config.application_address = "elabs.test.host"
  config.application_port = "3001/dashboard"
  // other properties
end

The port looks weird I know but webrat does simple string concatenation (address + port).

Michal Kuklis
I know I can set it in the beginning, but what about subdomains? Many of our apps have different subdomains so you'll be moving from "test.host" to "elabs.test.host" pretty often during a scenario
kfitzpatrick
A: 

alternatively, you could specify your base url in config.application_address and skip the application_port:

Webrat.configure do |config|
  config.mode = :selenium
  config.application_address = "elabs.test.host:3001/dashboard/"
  // other properties
end
Doug Chew
A: 

I had exctaly the same problem and the it was caused by accessing the wrong URL. Like this:

def path_to(page_name)
    case page_name

    when /home/
      url_for(:controller => 'admin/colaboracao', :action => 'show')

This is how it was solved:

def path_to(page_name)
    case page_name

    when /home/
      '/admin/colaboracao'