Skip to content

Instantly share code, notes, and snippets.

@VirtuosiMedia
Created February 17, 2012 21:58
Show Gist options
  • Save VirtuosiMedia/1855690 to your computer and use it in GitHub Desktop.
Save VirtuosiMedia/1855690 to your computer and use it in GitHub Desktop.
Trial Selenium Test - Pricing Page
require "selenium-webdriver"
require "test/unit"
class FindPricingPage < Test::Unit::TestCase
def setup
@driver = Selenium::WebDriver.for :firefox
@base_url = "http://staging.youeye.com/"
@driver.manage.timeouts.implicit_wait = 30
@verification_errors = []
end
def teardown
@driver.quit
assert_equal [], @verification_errors
end
def test_find_pricing_page
@driver.get(@base_url + "/")
@driver.find_element(:link, "Pricing").click
assert_equal "http://staging.youeye.com/pricing", @driver.current_url
end
def element_present?(how, what)
@driver.find_element(how, what)
true
rescue Selenium::WebDriver::Error::NoSuchElementError
false
end
def verify(&blk)
yield
rescue Test::Unit::AssertionFailedError => ex
@verification_errors << ex
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment