]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/tests/registration_login.py
Validation email template bugfix
[osqa.git] / forum / skins / default / tests / registration_login.py
1 from selenium import selenium
2 import unittest, time, re
3 import random
4
5 class registration_login(unittest.TestCase):
6     def setUp(self):
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/")
12         self.selenium.start()
13     
14     def test_registration_login(self):
15         sel = self.selenium
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")
27         sel.click("btLogout")
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")
33         sel.click("blogin")
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))
37     
38     def tearDown(self):
39         self.selenium.stop()
40         self.assertEqual([], self.verificationErrors)
41
42 if __name__ == "__main__":
43     unittest.main()