-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Finalize initial set of User Accounts tests (#39)"
This reverts commit e5db4d0.
- Loading branch information
Eugene Alvin Villar
committed
Sep 20, 2017
1 parent
e5db4d0
commit 4e528a2
Showing
15 changed files
with
346 additions
and
755 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.2.1' | ||
__version__ = '0.2.0' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,28 @@ | ||
import pytest | ||
|
||
from ..base_test import SeleniumTestCase | ||
from ..util import random_string | ||
|
||
pytestmark = pytest.mark.skip | ||
|
||
class TestLogin(SeleniumTestCase): | ||
|
||
@pytest.fixture(autouse=True) | ||
def get_generic_user(self, generic_user): | ||
self.user = generic_user | ||
class Login(SeleniumTestCase): | ||
|
||
def test_user_can_login_by_username(self): | ||
"""Verifies User Accounts test case #L1.""" | ||
def test_login(self): | ||
self.open("/account/login/") | ||
self.wd.find_css('#id_login').send_keys("cadasta-test-user-1") | ||
self.wd.find_css("#id_password").send_keys('XYZ#qwerty') | ||
self.wd.find_element_by_xpath('//button[@name="sign-in"]').click() | ||
self.wd.find_elements_by_xpath( | ||
"//span[contains(text(), 'cadasta-test-user-1')]") | ||
|
||
self.wd.BY_LINK('Sign in').click() | ||
self.update_form_field('login', self.user['username']) | ||
self.update_form_field('password', self.user['password']) | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wd.wait_for_xpath( | ||
'//header//*[normalize-space()=""]'.format(self.user['full_name'])) | ||
self.wait_for_alert( | ||
'Successfully signed in as {}.'.format(self.user['username'])) | ||
|
||
def test_user_can_login_by_email(self): | ||
"""Verifies User Accounts test case #L3.""" | ||
|
||
self.wd.BY_LINK('Sign in').click() | ||
self.update_form_field('login', self.user['email']) | ||
self.update_form_field('password', self.user['password']) | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wd.wait_for_xpath( | ||
'//header//*[normalize-space()=""]'.format(self.user['full_name'])) | ||
self.wait_for_alert( | ||
'Successfully signed in as {}.'.format(self.user['username'])) | ||
|
||
def test_user_cannot_log_in(self): | ||
"""Verifies User Accounts test case #L2.""" | ||
|
||
self.wd.BY_LINK('Sign in').click() | ||
|
||
msg = 'The username and/or password you specified are not correct.' | ||
|
||
self.update_form_field('login', self.user['username']) | ||
self.update_form_field('password', random_string()) | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wait_for_alert(msg) | ||
self.wd.BY_LINK('Sign in') | ||
self.wd.BY_LINK('Register') | ||
|
||
self.update_form_field('login', random_string()) | ||
self.update_form_field('password', self.user['password']) | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wait_for_alert(msg) | ||
self.wd.BY_LINK('Sign in') | ||
self.wd.BY_LINK('Register') | ||
|
||
msg = ('The e-mail address and/or password you specified are not ' | ||
'correct.') | ||
|
||
self.update_form_field('login', self.user['email']) | ||
self.update_form_field('password', random_string()) | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wait_for_alert(msg) | ||
self.wd.BY_LINK('Sign in') | ||
self.wd.BY_LINK('Register') | ||
class LoginFailure(SeleniumTestCase): | ||
|
||
self.update_form_field('login', random_string() + '@cadasta.org') | ||
self.update_form_field('password', self.user['password']) | ||
def test_login_failure(self): | ||
self.open("/account/login/") | ||
self.wd.BY_NAME('login').send_keys('admin') | ||
self.wd.BY_NAME('password').send_keys('admin') | ||
self.wd.BY_NAME('sign-in').click() | ||
self.wait_for_alert(msg) | ||
self.wd.BY_LINK('Sign in') | ||
self.wd.BY_LINK('Register') | ||
self.wd.BY_XPATH( | ||
'//*[@role="alert" and contains(normalize-space(),' | ||
'"The login and/or password you specified are not correct.")]') |
Oops, something went wrong.