1 from selenium import selenium
2 import unittest, time, re
5 class registration_login(unittest.TestCase):
7 rand_number = random.randrange(1, 10000)
8 self.verificationErrors = []
9 self.account_name = 'TestAccount%d' % rand_number
10 self.account_email = 'test_account_%d@example.com' % rand_number
11 self.selenium = selenium("localhost", 4444, "*chrome", "http://127.0.0.1:8000/")
14 def test_registration_login(self):
16 sel.open("/account/signin/")
17 sel.click("link=Create account")
18 sel.wait_for_page_to_load("30000")
19 sel.type("id_username", "%s" % self.account_name)
20 sel.type("id_email", "%s" % self.account_email)
21 sel.type("id_password1", "test")
22 sel.type("id_password2", "test")
23 sel.click("bnewaccount")
24 sel.wait_for_page_to_load("30000")
25 sel.click("link=logout")
26 sel.wait_for_page_to_load("30000")
28 sel.wait_for_page_to_load("30000")
29 sel.click("link=login")
30 sel.wait_for_page_to_load("30000")
31 sel.type("id_username", "%s" % self.account_name)
32 sel.type("id_password", "test")
34 sel.wait_for_page_to_load("30000")
35 try: self.failUnless(sel.is_element_present("link=%s" % self.account_name))
36 except AssertionError, e: self.verificationErrors.append(str(e))
40 self.assertEqual([], self.verificationErrors)
42 if __name__ == "__main__":