Hi all

Tonight I wanted to test out selenium in a story to test some ajax  
stuff on a page.

After struggling for an hour or two with disappearing database objects  
I found the solution in a blog post by Kerry Buckley.

with the comment included it reads:

# Don't add an ActiveRecordSafetyListener, or it'll roll stuff back
class Spec::Story::Runner::ScenarioRunner
   def initialize
     @listeners = []
   end
end

(the above code belongs in the story helper file, or more specific,  
for me in my selenium helper file as not every story uses selenium)

Ok, that worked, but I don't understand why. Can someone explain what  
the big difference is with normal stories and can't it be solved in a  
more cleaner way?


That said, it's actually very easy to use selenium in a story. Just in  
case someone is searching:

1) Add this in the helper file for selenium stories:

####################
class Spec::Story::Runner::ScenarioRunner
   def initialize
     @listeners = []
   end
end

require 'vendor/plugins/selenium-ruby-client-driver/selenium'

$s = Selenium::SeleniumDriver.new("localhost", 4444, "*firefox", 
"http://localhost:3000 
", 10000);
$s.start

####################

2) download the selenium ruby driver, place it in vendor/plugins/ 
selenium-ruby-client-driver
3) start the selenium server (java -jar selenium-server.jar)
4) start the script/server in test environment

That's it, in stories you can now use things like: $s.open("/orders")

-gr
Ivo
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to