Created
September 29, 2011 16:18
-
-
Save rossta/1251137 to your computer and use it in GitHub Desktop.
Sample Watir Unit Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'test/unit' | |
require 'watir-webdriver' | |
class LoginTest < Test::Unit::TestCase | |
def setup | |
@browser = Watir::Browser.new :ff | |
end | |
def teardown | |
@browser.close | |
end | |
def test_login | |
@browser.goto "challengepost.com" | |
@browser.link(:text, "Log in").click | |
@browser.text_field(:id, "user_email").set("") | |
@browser.text_field(:id, "user_password").set("") | |
@browser.button(:id, "user_submit").click | |
assert(@browser.text.include?("foobar")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment