Skip to content

RSpec 1 Selenium Testing

testingbot edited this page Apr 9, 2012 · 1 revision

Our gem supports running an RSpec 1 test against our grid.

require 'rubygems'
gem "rspec", "<2"
gem "selenium-client"
require "selenium/client"
require "selenium/rspec/spec_helper"
gem "testingbot"
require "testingbot"

describe "Test" do
  attr_reader :selenium_driver
  alias :page :selenium_driver

    before(:all) do
        @selenium_driver = Selenium::Client::Driver.new \
            :browser => "firefox", 
            :url => "http://www.google.com", 
            :timeout_in_second => 90,
            :platform => "WINDOWS",
            :version => "10"
    end

    before(:each) do
      @selenium_driver.start_new_browser_session
    end

    append_after(:each) do 
      @selenium_driver.close_current_browser_session
    end

    it "can find the right title" do    
      page.open "/"
      page.title.should eql("Google")   
    end
end
Clone this wiki locally