def test_1_correct_credentials(): print(colored('Running: test_1_correct_credentials - estimate: 2s', 'yellow')) clear_inputs(['username', 'password'], 'id') Root.login_user(browser, {'username': '******', 'password': '******'}) print(colored('\ttest_1_correct_credentials: login successful - asserting...', 'blue')) assert "No user in Juice matches the login credentials." not in browser.page_source assert "Username and Password are required." not in browser.page_source # check for user menu print(colored('\ttest_1_correct_credentials: passed.', 'cyan'))
def test_3_incorrect_credentials(self, form): print( colored('Running: test_3_incorrect_credentials - estimate: 2m 10s', 'yellow')) print( colored( '\ttest_3_incorrect_credentials: both fields incorrect - asserting...', 'blue')) clear_inputs(['username', 'password'], 'id') Root.login_user(browser, { 'username': faker.last_name(), 'password': faker.word() }) try: assert_checking(self, 'No user in Juice matches the login credentials.') except AssertionError: assert_checking(self, 'No record in Juice matches the data.') print( colored( '\ttest_3_incorrect_credentials: password incorrect - asserting...', 'blue')) clear_inputs(['username', 'password'], 'id') Root.login_user(browser, { 'username': '******', 'password': faker.word() }) try: assert_checking(self, 'No user in Juice matches the login credentials.') except AssertionError: assert_checking(self, 'No record in Juice matches the data.') print(colored('\ttest_3_incorrect_credentials: passed.', 'cyan'))