def test_login_with_invalid_password_credential(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(INVALID_PASSWORD) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(INVALID_PASSWORD)))
def setUpClass(cls): HeadlessRunnerTest.setUpClass() cls.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(cls.driver) login_page.login_with(DATA_SENDER_CREDENTIALS) cls.driver.wait_for_element(UI_TEST_TIMEOUT, by_css("span.welcome"), True)
def test_login_without_entering_email_and_password(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(BLANK_CREDENTIALS) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(BLANK_CREDENTIALS)))
def test_login_without_entering_email_address(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(BLANK_EMAIL_ADDRESS) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(BLANK_EMAIL_ADDRESS)))
def test_login_with_invalid_password_credential(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(INVALID_PASSWORD) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(INVALID_PASSWORD)))
def test_login_without_entering_email_address(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(BLANK_EMAIL_ADDRESS) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(BLANK_EMAIL_ADDRESS)))
def test_login_with_invalid_format_email_address(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(INVALID_EMAIL_ID_FORMAT) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(INVALID_EMAIL_ID_FORMAT)))
def test_login_with_unactivated_account_credentials(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(UNACTIVATED_ACCOUNT_CREDENTIALS) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(UNACTIVATED_ACCOUNT_CREDENTIALS)))
def test_login_without_entering_email_and_password(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(BLANK_CREDENTIALS) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(BLANK_CREDENTIALS)))
def test_login_with_invalid_format_email_address(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(INVALID_EMAIL_ID_FORMAT) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(INVALID_EMAIL_ID_FORMAT)))
def test_login_with_deactivated_account(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(DEACTIVATED_ACCOUNT_CREDENTIALS) self.assertEqual( login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(DEACTIVATED_ACCOUNT_CREDENTIALS)))
def login_with_created_datasenders_account(self, email): global_navigation = GlobalNavigationPage(self.driver) global_navigation.sign_out() self.driver.go_to(DATA_WINNER_LOGIN_PAGE) data_sender_credentials = {USERNAME: email, PASSWORD: "******"} login_page = LoginPage(self.driver) login_page.login_with(data_sender_credentials) message = global_navigation.welcome_message() return message
def test_cancel_link_should_be_available_for_datasender(self): self.driver.go_to(LOGOUT) self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(DATA_SENDER_CREDENTIALS) self.driver.go_to(self.add_subjects_url) self.assertRegexpMatches( (AddSubjectPage(self.driver)).get_cancel_url(), "/alldata/")
def test_login_with_expired_trial_account(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) dbmanager = DatabaseManager() dbmanager.update_active_date_to_expired( EXPIRED_TRIAL_ACCOUNT[USERNAME], 365) login_page = LoginPage(self.driver) time.sleep(2) login_page.login_with(EXPIRED_TRIAL_ACCOUNT) self.assertEqual(login_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(EXPIRED_TRIAL_ACCOUNT)))
def login_with_created_datasenders_account(self): self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE) all_data_senders_page = AllDataSendersPage(self.driver) email = all_data_senders_page.get_data_sender_email_by_mobile_number(VALID_DATA_WITH_EMAIL[MOBILE_NUMBER_WITHOUT_HYPHENS]) global_navigation = GlobalNavigationPage(self.driver) global_navigation.sign_out() self.driver.go_to(DATA_WINNER_LOGIN_PAGE) data_sender_crendentials = {USERNAME: email, PASSWORD: "******"} login_page = LoginPage(self.driver) login_page.login_with(data_sender_crendentials) message = global_navigation.welcome_message() return email, message
def test_login_with_expired_trial_account(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) dbmanager = DatabaseManager() dbmanager.update_active_date_to_expired( EXPIRED_TRIAL_ACCOUNT[USERNAME], 31) login_page = LoginPage(self.driver) login_page.login_with(EXPIRED_TRIAL_ACCOUNT) expired_trail_account_page = ExpiredTrialPage(self.driver) self.assertEqual(expired_trail_account_page.get_error_message(), fetch_(ERROR_MESSAGE, from_(EXPIRED_TRIAL_ACCOUNT))) subscribe_button = expired_trail_account_page.get_subscribe_button() self.assertEqual("Subscribe Now", subscribe_button[0].text)
def verify_submission_via_web(self, ds_email): self.driver.go_to(LOGOUT) user = User.objects.get(username=ds_email) token = default_token_generator.make_token(user) self.driver.go_to( url(DS_ACTIVATION_URL % (int_to_base36(user.id), token))) activation_page = ResetPasswordPage(self.driver) activation_page.type_same_password(NEW_PASSWORD) activation_page.click_submit() self.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, "Data Submission") self.assertEqual(self.driver.get_title(), "Data Submission") self.driver.go_to(LOGOUT) self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with({USERNAME: ds_email, PASSWORD: NEW_PASSWORD}) data_sender_page = DataSenderPage(self.driver) submission_page = data_sender_page.send_in_data() submission_page.fill_and_submit_answer(WEB_ANSWERS) self.driver.go_to(LOGOUT) self.do_login() self.verify_submission(WEB_ANSWER_LOG, self.project_name)
def login_with(self, credential): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(credential)
def setUpClass(cls): cls.driver = setup_driver() cls.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(cls.driver) login_page.login_with(DATA_SENDER_CREDENTIALS)
def go_to_data_sender_page(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) login_page.login_with(DATA_SENDER_CREDENTIALS) data_sender_page = DataSenderPage(self.driver) return data_sender_page