Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests in conjunction with fix for issue #1045 in cadasta-platform #18

Merged
merged 2 commits into from
Feb 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cadasta_test_suites.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
EmptyUsernameValidation,
EmptyEmailValidation,
EmptyPasswordValidation,
EmptyConfirmPasswordValidation
EmptyConfirmPasswordValidation,
EmptyUsernameInPasswordValidation,
EmptyEmailInPasswordValidation
)
from selenium_tests.accounts.login import (
Login,
Expand Down Expand Up @@ -115,6 +117,8 @@
empty_email_validation = unittest.TestLoader().loadTestsFromTestCase(EmptyEmailValidation)
empty_password_validation = unittest.TestLoader().loadTestsFromTestCase(EmptyPasswordValidation)
empty_confirm_password_validation = unittest.TestLoader().loadTestsFromTestCase(EmptyConfirmPasswordValidation)
empty_username_in_password_validation = unittest.TestLoader().loadTestsFromTestCase(EmptyUsernameInPasswordValidation)
empty_email_in_password_validation = unittest.TestLoader().loadTestsFromTestCase(EmptyEmailInPasswordValidation)
login_success = unittest.TestLoader().loadTestsFromTestCase(Login)
login_failure = unittest.TestLoader().loadTestsFromTestCase(LoginFailure)
password_reset = unittest.TestLoader().loadTestsFromTestCase(PasswordReset)
Expand Down Expand Up @@ -179,6 +183,8 @@
empty_email_validation,
empty_password_validation,
empty_confirm_password_validation,
empty_username_in_password_validation,
empty_email_in_password_validation,
password_reset,
# password_change,
username_change,
Expand Down
44 changes: 44 additions & 0 deletions selenium_tests/accounts/registration_form_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,49 @@ def test_empty_confirm_password(self):
text = self.wd.wait_for_xpath("//ul[contains(@class, 'parsley-errors-list')]").text
assert text == "This field is required."

def tearDown(self):
self.wd.quit()

class EmptyUsernameInPasswordValidation(SeleniumTestCase):

def setUp(self):
self.wd = CustomWebDriver()

def test_empty_username_in_password(self):
self.open("/account/signup/")

self.wd.find_css('#id_username').send_keys('')
self.wd.find_css('#id_email').send_keys("[email protected]")
self.wd.find_css("#id_password1").send_keys('XYZ#qwerty')
self.wd.find_css("#id_password2").send_keys('XYZ#qwerty')
self.wd.find_css("#id_full_name").send_keys('user2-name')
action = ActionChains(self.wd)
action.send_keys(Keys.TAB).send_keys(Keys.RETURN).perform()

text = self.wd.find_elements_by_xpath("//ul[contains(@class, 'parsley-errors-list')]")
assert len(text) == 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expecting only one error after the fix


def tearDown(self):
self.wd.quit()

class EmptyEmailInPasswordValidation(SeleniumTestCase):

def setUp(self):
self.wd = CustomWebDriver()

def test_empty_email_in_password(self):
self.open("/account/signup/")

self.wd.find_css('#id_username').send_keys("cadasta-test-user2")
self.wd.find_css('#id_email').send_keys("")
self.wd.find_css("#id_password1").send_keys('XYZ#qwerty')
self.wd.find_css("#id_password2").send_keys('XYZ#qwerty')
self.wd.find_css("#id_full_name").send_keys('user2-name')
action = ActionChains(self.wd)
action.send_keys(Keys.TAB).send_keys(Keys.RETURN).perform()

text = self.wd.find_elements_by_xpath("//ul[contains(@class, 'parsley-errors-list')]")
assert len(text) == 1

def tearDown(self):
self.wd.quit()