haikuwebdev (owner)

Revisions

gist: 18644 Download_button fork
public
Public Clone URL: git://gist.github.com/18644.git
Embed All Files: show embed
selenium_test #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require "selenium"
require "test/unit"
 
class NewTest < Test::Unit::TestCase
  def setup
    @verification_errors = []
    if $selenium
      @selenium = $selenium
    else
      @selenium = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://www.google.com/", 10000);
      @selenium.start
    end
    @selenium.set_context("test_new")
  end
  
  def teardown
    @selenium.stop unless $selenium
    assert_equal [], @verification_errors
  end
  
  def test_new
    @selenium.open "/"
    @selenium.type "q", "duke health"
    @selenium.click "btnG"
    @selenium.wait_for_page_to_load "30000"
    @selenium.click "//div[@id='res']/div[1]/ol/li[1]/h3/a/em"
    @selenium.wait_for_page_to_load "30000"
    @selenium.type "search_input", "directions"
    @selenium.click "search_button"
    @selenium.wait_for_page_to_load "30000"
    begin
        assert @selenium.is_text_present("Hospital")
    rescue Test::Unit::AssertionFailedError
        @verification_errors << $!
    end
  end
end