Skip to content

Instantly share code, notes, and snippets.

Created June 2, 2015 15:06
Show Gist options
  • Save anonymous/0b2dc24849151df179c3 to your computer and use it in GitHub Desktop.
Save anonymous/0b2dc24849151df179c3 to your computer and use it in GitHub Desktop.
class InstanceTest < Minitest::Test
def setup
url = ARGV.shift
url = self.validate_instance(url)
@driver ||= Selenium::WebDriver.for(:remote, :url => url)
end
def teardown
@driver.quit
end
def validate_instance(instance)
if not instance
puts "Usage: #{$PROGRAM_NAME} instance_url"
exit
end
if ( instance =~ /^http:\/\// )
return instance
else
instance = "https://" + instance
return instance
end
end
def test_login
element = @driver.find_element(:id, 'username')
element.send_keys('user')
element2 = @driver.find_element(:id, 'password')
element2.send_keys('****8')
element2.submit
@driver.title.must_match(/^Website\s+\(.*\)$/)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment