Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created June 28, 2010 13:25
Show Gist options
  • Save qoelet/455826 to your computer and use it in GitHub Desktop.
Save qoelet/455826 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'watir'
browser = gets.strip
if browser == 'safari' or browser == 'firefox'
Watir::Browser.default = browser
b = Watir::Browser.new
b.goto "http://localhost:8000/"
sleep 5.0
at_homepage = b.link(:text, "Login").exists?
unless at_homepage == false:
b.link(:text, "Login").click
b.text_field(:name,"email").set "[email protected]"
b.text_field(:name,"password").set "abc123"
b.button(:class, "button").click
sleep 10.0
if b.link(:text, "Logout").exists? == true
print "Basic startup ok.\n"
else
print "Basic startup NOT ok.\n"
end
end
else
print "Error, browser choice not recognized.\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment