Created
April 8, 2010 12:33
-
-
Save wheresalice/360039 to your computer and use it in GitHub Desktop.
Very basic test suite using Watir to ensure a Drupal site is working
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
#!/usr/bin/ruby1.9.1 | |
require "rubygems" | |
require "test/unit" | |
require "watir" | |
$site = ARGV[0] | |
puts $site | |
if ($site[-1,1] != "/") | |
puts "url must end in a slash" | |
exit | |
end | |
class DrupalTests < Test::Unit::TestCase | |
def test_anonymous_cant_update | |
browser = Watir::Browser.start($site + "update.php") | |
assert_equal(browser.h2(:index, 1).text, "Access denied") | |
browser.close | |
end | |
def test_root_shouldnt_show_errors_or_warnings | |
browser = Watir::Browser.start($site) | |
number_errors = browser.contains_text("error:") | |
number_warnings = browser.contains_text("warning:") | |
assert(number_errors == nil) | |
assert(number_warnings == nil) | |
browser.close | |
end | |
def test_anonymous_cant_access_admin | |
browser = Watir::Browser.start($site + "admin") | |
access_denied = browser.contains_text("Access denied") | |
assert(access_denied > 0) | |
browser.close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment