def prepare_data_for_showing_only_logs_for_current_organization(self): confirmation_page, email = register_and_get_email(self.driver) account_activate_page = ActivateAccountPage(self.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(email.lower()) account_activate_page.activate_account(activation_code) self.login(credential={USERNAME: email, PASSWORD: "******"})
def test_successful_activation_of_account(self): """ Function to test the successful activation of account with given details """ email = self.prerequisites_of_activate_account() account_activate_page = ActivateAccountPage(self.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(email) account_activate_page.activate_account(activation_code) self.assertRegexpMatches(account_activate_page.get_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_ACTIVATION_DETAILS)))
def test_successful_activation_of_account(self): """ Function to test the successful activation of account with given details """ email = self.prerequisites_of_activate_account() account_activate_page = ActivateAccountPage(self.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(email) account_activate_page.activate_account(activation_code) self.assertRegexpMatches( account_activate_page.get_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_ACTIVATION_DETAILS)))
def setUp(self): super(TestActivateAccount, self).setUp() registration_confirmation_page, self.email = register_and_get_email( self.driver) self.assertEquals( registration_confirmation_page.registration_success_message(), REGISTRATION_SUCCESS_MESSAGE) self.account_activate_page = ActivateAccountPage(self.driver) self.dbmanager = DatabaseManager() self.activation_code = self.dbmanager.get_activation_code( self.email.lower()) self.account_activate_page.activate_account(self.activation_code)
def test_should_show_default_datasender_for_newly_created_datasender(self): registration_confirmation_page, self.email = register_and_get_email(self.driver) assert REGISTRATION_SUCCESS_MESSAGE == registration_confirmation_page.registration_success_message() self.account_activate_page = ActivateAccountPage(self.driver) self.postgres_dbmanager = DatabaseManager() self.activation_code = self.postgres_dbmanager.get_activation_code(self.email.lower()) self.account_activate_page.activate_account(self.activation_code) self.page = AllDataSendersPage(self.driver) self.page.load() all_ds_page = self.page self.assertEqual(1, all_ds_page.get_datasenders_count())
def setUpClass(cls): cls.driver = setup_driver() registration_confirmation_page, cls.email = register_and_get_email(cls.driver) assert REGISTRATION_SUCCESS_MESSAGE == registration_confirmation_page.registration_success_message() cls.account_activate_page = ActivateAccountPage(cls.driver) cls.postgres_dbmanager = DatabaseManager() cls.activation_code = cls.postgres_dbmanager.get_activation_code(cls.email.lower()) cls.account_activate_page.activate_account(cls.activation_code)
class TestActivateAccount(BaseTest): def setUp(self): super(TestActivateAccount, self).setUp() registration_confirmation_page, self.email = register_and_get_email( self.driver) self.assertEquals( registration_confirmation_page.registration_success_message(), REGISTRATION_SUCCESS_MESSAGE) self.account_activate_page = ActivateAccountPage(self.driver) self.dbmanager = DatabaseManager() self.activation_code = self.dbmanager.get_activation_code( self.email.lower()) self.account_activate_page.activate_account(self.activation_code) def tearDown(self): if self.email is not None: dbmanager = DatabaseManager() dbname = dbmanager.delete_organization_all_details( self.email.lower()) couchwrapper = CouchHttpWrapper("localhost") couchwrapper.deleteDb(dbname) super(TestActivateAccount, self).tearDown() @attr('functional_test', 'smoke') def test_successful_activation_of_account(self): self.assertRegexpMatches( self.account_activate_page.get_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_ACTIVATION_DETAILS))) @attr('functional_test') def test_successful_login_with_uppercased_email(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) dashboard_page = login_page.do_successful_login_with({ USERNAME: self.email.upper(), PASSWORD: u"ngo001" }) self.assertEqual(dashboard_page.welcome_message(), u"Welcome Mickey!")
class TestAllDatasenderBehaviourInTrialOrg(HeadlessRunnerTest): @classmethod def setUpClass(cls): HeadlessRunnerTest.setUpClass() @attr('functional_test') def test_should_show_default_datasender_for_newly_created_datasender(self): registration_confirmation_page, self.email = register_and_get_email(self.driver) assert REGISTRATION_SUCCESS_MESSAGE == registration_confirmation_page.registration_success_message() self.account_activate_page = ActivateAccountPage(self.driver) self.postgres_dbmanager = DatabaseManager() self.activation_code = self.postgres_dbmanager.get_activation_code(self.email.lower()) self.account_activate_page.activate_account(self.activation_code) self.page = AllDataSendersPage(self.driver) self.page.load() all_ds_page = self.page self.assertEqual(1, all_ds_page.get_datasenders_count())
def test_successful_login_with_uppercased_email(self): registration_confirmation_page, self.email = register_and_get_email( self.driver) assert REGISTRATION_SUCCESS_MESSAGE == registration_confirmation_page.registration_success_message( ) self.account_activate_page = ActivateAccountPage(self.driver) self.postgres_dbmanager = DatabaseManager() self.activation_code = self.postgres_dbmanager.get_activation_code( self.email.lower()) self.account_activate_page.activate_account(self.activation_code) self.driver.go_to(LOGOUT) self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) dashboard_page = login_page.do_successful_login_with({ USERNAME: self.email.upper(), PASSWORD: u"ngo001" }) self.assertEqual(dashboard_page.welcome_message(), u"Welcome Mickey Gö!")
def test_intregation_of_application(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) registration_page = login_page.navigate_to_registration_page() self.assertEqual(registration_page.get_title(), "Register") registration_confirmation_page, self.email = registration_page.successful_registration_with( REGISTRATION_DATA_FOR_SUCCESSFUL_REGISTRATION) self.assertEquals( registration_confirmation_page.registration_success_message(), fetch_(SUCCESS_MESSAGE, from_(REGISTRATION_DATA_FOR_SUCCESSFUL_REGISTRATION))) dbmanager = DatabaseManager() organization_sms_tel_number = get_epoch_last_ten_digit() dbmanager.set_sms_telephone_number(organization_sms_tel_number, self.email) account_activate_page = ActivateAccountPage(self.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(self.email) account_activate_page.activate_account(activation_code) self.assertRegexpMatches( account_activate_page.get_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_ACTIVATION_DETAILS))) self.driver.go_to(DATA_WINNER_LOGIN_PAGE) VALID_LOGIN_CREDENTIALS = VALID_CREDENTIALS VALID_LOGIN_CREDENTIALS[USERNAME] = self.email dashboard_page = login_page.do_successful_login_with( VALID_LOGIN_CREDENTIALS) self.assertEqual( dashboard_page.welcome_message(), fetch_(WELCOME_MESSAGE, from_(VALID_LOGIN_CREDENTIALS))) register_reporter_page = dashboard_page.navigate_to_register_reporter_page( ) register_reporter_page.register_with(VALID_DATA_FOR_REPORTER) self.assertRegexpMatches( register_reporter_page.get_success_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_DATA_FOR_REPORTER))) self.driver.go_to(DATA_WINNER_ADD_SUBJECT) add_subject_type_page = AddSubjectTypePage(self.driver) add_subject_type_page.add_entity_type_with(VALID_SUBJECT_TYPE1) self.assertEqual(add_subject_type_page.get_flash_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_SUBJECT_TYPE1))) add_subject_type_page.add_entity_type_with(VALID_SUBJECT_TYPE2) self.assertEqual(add_subject_type_page.get_flash_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_SUBJECT_TYPE2))) self.driver.go_to(DATA_WINNER_HOME_PAGE) register_subject_page = dashboard_page.navigate_to_register_subject_page( ) message = register_subject_page.successfully_register_subject_with( VALID_DATA_FOR_SUBJECT) self.assertRegexpMatches(register_subject_page.get_flash_message(), message) self.driver.go_to(DATA_WINNER_HOME_PAGE) create_project_page = dashboard_page.navigate_to_create_project_page() create_subject_questionnaire_page = create_project_page.successfully_create_project_with( VALID_DATA_FOR_PROJECT) self.assertRegexpMatches( create_subject_questionnaire_page.get_title(), fetch_(PAGE_TITLE, from_(VALID_DATA_FOR_PROJECT))) create_questionnaire_page = create_subject_questionnaire_page.successfully_create_subject_questionnaire_with( None) self.assertRegexpMatches( create_questionnaire_page.get_title(), fetch_(PAGE_TITLE, from_(VALID_DATA_FOR_SUBJECT_QUESTIONNAIRE))) create_questionnaire_page.create_questionnaire_with(QUESTIONNAIRE_DATA) index = 2 for question in fetch_(QUESTIONS, from_(QUESTIONNAIRE_DATA)): question_link_text = fetch_(QUESTION, from_(question)) + " " + fetch_( CODE, from_(question)) self.assertEquals( create_questionnaire_page.get_question_link_text(index), question_link_text) index += 1 time.sleep(5) self.assertEquals( create_questionnaire_page.get_remaining_character_count(), fetch_(CHARACTER_REMAINING, from_(QUESTIONNAIRE_DATA))) create_questionnaire_page.save_questionnaire() time.sleep(3) self.assertEqual(create_questionnaire_page.get_title(), "Finish & Test") self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE) sms_tester_page = SMSTesterPage(self.driver) sms_tester_data = VALID_DATA_FOR_SMS sms_tester_data[RECEIVER] = organization_sms_tel_number sms_tester_page.send_sms_with(sms_tester_data) self.assertEqual(sms_tester_page.get_response_message(), fetch_(SUCCESS_MESSAGE, from_(sms_tester_data))) self.driver.go_to(DATA_WINNER_HOME_PAGE) view_all_project_page = dashboard_page.navigate_to_view_all_project_page( ) time.sleep(3) project_overview_project = view_all_project_page.navigate_to_project_page( fetch_(PROJECT_NAME, VALID_DATA_FOR_PROJECT)) time.sleep(3) data_page = project_overview_project.navigate_to_data_page() time.sleep(3) submission_log_page = data_page.navigate_to_all_data_record_page() time.sleep(3) self.assertRegexpMatches( submission_log_page.get_submission_message(SMS_DATA_LOG), fetch_(SMS_SUBMISSION, from_(SMS_DATA_LOG))) self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE) sms_tester_data = VALID_DATA_FOR_SMS sms_tester_data[RECEIVER] = organization_sms_tel_number sms_tester_page.send_sms_with(sms_tester_data) self.assertEqual(sms_tester_page.get_response_message(), fetch_(SUCCESS_MESSAGE, from_(sms_tester_data)))
def activate_account(driver, email): account_activate_page = ActivateAccountPage(driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(email) account_activate_page.activate_account(activation_code) return account_activate_page
def prepare_data_for_showing_only_logs_for_current_organization(cls): confirmation_page, cls.email = register_and_get_email(cls.driver) account_activate_page = ActivateAccountPage(cls.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(cls.email.lower()) account_activate_page.activate_account(activation_code)
def test_intregation_of_application(self): self.driver.go_to(DATA_WINNER_LOGIN_PAGE) login_page = LoginPage(self.driver) registration_page = login_page.navigate_to_registration_page() self.assertEqual(registration_page.get_title(), "Register") registration_confirmation_page, self.email = registration_page.successful_registration_with(REGISTRATION_DATA_FOR_SUCCESSFUL_REGISTRATION) self.assertEquals(registration_confirmation_page.registration_success_message(), fetch_(SUCCESS_MESSAGE, from_(REGISTRATION_DATA_FOR_SUCCESSFUL_REGISTRATION))) dbmanager = DatabaseManager() organization_sms_tel_number = get_epoch_last_ten_digit() dbmanager.set_sms_telephone_number(organization_sms_tel_number, self.email) account_activate_page = ActivateAccountPage(self.driver) dbmanager = DatabaseManager() activation_code = dbmanager.get_activation_code(self.email) account_activate_page.activate_account(activation_code) self.assertRegexpMatches(account_activate_page.get_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_ACTIVATION_DETAILS))) self.driver.go_to(DATA_WINNER_LOGIN_PAGE) VALID_LOGIN_CREDENTIALS = VALID_CREDENTIALS VALID_LOGIN_CREDENTIALS[USERNAME] = self.email dashboard_page = login_page.do_successful_login_with(VALID_LOGIN_CREDENTIALS) self.assertEqual(dashboard_page.welcome_message(), fetch_(WELCOME_MESSAGE, from_(VALID_LOGIN_CREDENTIALS))) register_reporter_page = dashboard_page.navigate_to_register_reporter_page() register_reporter_page.register_with(VALID_DATA_FOR_REPORTER) self.assertRegexpMatches(register_reporter_page.get_success_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_DATA_FOR_REPORTER))) self.driver.go_to(DATA_WINNER_ADD_SUBJECT) add_subject_type_page = AddSubjectTypePage(self.driver) add_subject_type_page.add_entity_type_with(VALID_SUBJECT_TYPE1) self.assertEqual(add_subject_type_page.get_flash_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_SUBJECT_TYPE1))) add_subject_type_page.add_entity_type_with(VALID_SUBJECT_TYPE2) self.assertEqual(add_subject_type_page.get_flash_message(), fetch_(SUCCESS_MESSAGE, from_(VALID_SUBJECT_TYPE2))) self.driver.go_to(DATA_WINNER_HOME_PAGE) register_subject_page = dashboard_page.navigate_to_register_subject_page() message = register_subject_page.successfully_register_subject_with(VALID_DATA_FOR_SUBJECT) self.assertRegexpMatches(register_subject_page.get_flash_message(), message) self.driver.go_to(DATA_WINNER_HOME_PAGE) create_project_page = dashboard_page.navigate_to_create_project_page() create_subject_questionnaire_page = create_project_page.successfully_create_project_with(VALID_DATA_FOR_PROJECT) self.assertRegexpMatches(create_subject_questionnaire_page.get_title(), fetch_(PAGE_TITLE, from_(VALID_DATA_FOR_PROJECT))) create_questionnaire_page = create_subject_questionnaire_page.successfully_create_subject_questionnaire_with(None) self.assertRegexpMatches(create_questionnaire_page.get_title(), fetch_(PAGE_TITLE, from_(VALID_DATA_FOR_SUBJECT_QUESTIONNAIRE))) create_questionnaire_page.create_questionnaire_with(QUESTIONNAIRE_DATA) index = 2 for question in fetch_(QUESTIONS, from_(QUESTIONNAIRE_DATA)): question_link_text = fetch_(QUESTION, from_(question)) + " " + fetch_(CODE, from_(question)) self.assertEquals(create_questionnaire_page.get_question_link_text(index), question_link_text) index += 1 time.sleep(5) self.assertEquals(create_questionnaire_page.get_remaining_character_count(), fetch_(CHARACTER_REMAINING, from_(QUESTIONNAIRE_DATA))) create_questionnaire_page.save_questionnaire() time.sleep(3) self.assertEqual(create_questionnaire_page.get_title(), "Finish & Test") self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE) sms_tester_page = SMSTesterPage(self.driver) sms_tester_data = VALID_DATA_FOR_SMS sms_tester_data[RECEIVER] = organization_sms_tel_number sms_tester_page.send_sms_with(sms_tester_data) self.assertEqual(sms_tester_page.get_response_message(), fetch_(SUCCESS_MESSAGE, from_(sms_tester_data))) self.driver.go_to(DATA_WINNER_HOME_PAGE) view_all_project_page = dashboard_page.navigate_to_view_all_project_page() time.sleep(3) project_overview_project = view_all_project_page.navigate_to_project_page(fetch_(PROJECT_NAME, VALID_DATA_FOR_PROJECT)) time.sleep(3) data_page = project_overview_project.navigate_to_data_page() time.sleep(3) submission_log_page = data_page.navigate_to_all_data_record_page() time.sleep(3) self.assertRegexpMatches(submission_log_page.get_submission_message(SMS_DATA_LOG), fetch_(SMS_SUBMISSION, from_(SMS_DATA_LOG))) self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE) sms_tester_data = VALID_DATA_FOR_SMS sms_tester_data[RECEIVER] = organization_sms_tel_number sms_tester_page.send_sms_with(sms_tester_data) self.assertEqual(sms_tester_page.get_response_message(), fetch_(SUCCESS_MESSAGE, from_(sms_tester_data)))