def test_should_update_submission_log_when_DS_info_is_edited(self):
        all_project_page = self.dashboard.navigate_to_view_all_project_page()
        project_overview_page = all_project_page.navigate_to_project_overview_page(
            "clinic test project1")
        my_data_sender_page = project_overview_page.navigate_to_datasenders_page(
        )
        add_ds_page = my_data_sender_page.navigate_to_add_a_data_sender_page()
        add_ds_page.enter_data_sender_details_from(DATASENDER_DETAILS)
        ds_id = add_ds_page.get_registered_datasender_id()

        send_valid_sms_with(VALID_DATA)

        submission_log_page = self.get_first_project_submission_log_page()
        submission_log_page.search(ds_id)
        self.assertTrue(DATASENDER_DETAILS[NAME] in
                        submission_log_page.get_cell_value(row=1, column=2))

        self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE)
        all_datasenders_page = AllDataSendersPage(self.driver)

        all_datasenders_page.search_with(ds_id)
        all_datasenders_page.wait_for_table_to_load()

        all_datasenders_page.select_a_data_sender_by_id(ds_id)
        all_datasenders_page.select_edit_action()
        AddDataSenderPage(self.driver).enter_data_sender_details_from(
            EDITED_DATASENDER_DETAILS)
        submission_log_page = self.get_first_project_submission_log_page()
        submission_log_page.search(ds_id)
        self.assertTrue(EDITED_DATASENDER_DETAILS[NAME] in
                        submission_log_page.get_cell_value(row=1, column=2))
예제 #2
0
    def add_edit_datasender(self):
        global_navigation = GlobalNavigationPage(self.driver)
        all_data_sender_page = global_navigation.navigate_to_all_data_sender_page(
        )
        add_data_sender_page = all_data_sender_page.navigate_to_add_a_data_sender_page(
        )
        email = generate_random_email_id()
        add_data_sender_page.enter_data_sender_details_from(
            VALID_DATA_WITH_EMAIL, email=email)
        success_msg = add_data_sender_page.get_success_message()
        self.assertIn(fetch_(SUCCESS_MESSAGE, from_(VALID_DATA_WITH_EMAIL)),
                      success_msg)
        add_data_sender_page.navigate_to_datasender_page()
        all_data_sender_page = AllDataSendersPage(self.driver)

        rep_id = success_msg.replace(VALID_DATA_WITH_EMAIL[SUCCESS_MESSAGE],
                                     '')
        all_data_sender_page.select_a_data_sender_by_id(rep_id)

        all_data_sender_page.select_edit_action()
        time.sleep(2)
        edit_datasender_page = AddDataSenderPage(self.driver)
        edit_datasender_page.enter_data_sender_details_from(
            VALID_DATA_WITH_EMAIL_FOR_EDIT)
        self.assertRegexpMatches(
            edit_datasender_page.get_success_message(),
            fetch_(SUCCESS_MSG, from_(VALID_DATA_WITH_EMAIL_FOR_EDIT)))

        edit_datasender_page.navigate_to_datasender_page()
        all_data_sender_page = AllDataSendersPage(self.driver)
        all_data_sender_page.associate_datasender_to_projects(
            rep_id, [self.project_name])
        return email
예제 #3
0
    def test_should_update_submission_log_when_DS_info_is_edited(self):
        self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE)
        all_datasenders_page = AllDataSendersPage(self.driver)
        ds_id = self.register_datasender(DATASENDER_DETAILS,
                                         all_datasenders_page)

        self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE)
        sms_tester_page = SMSTesterPage(self.driver)
        sms_tester_page.send_valid_sms_with(VALID_DATA)

        message = sms_tester_page.get_response_message()
        self.assertTrue(
            fetch_(SUCCESS_MESSAGE, VALID_DATA) in message,
            "message:" + message)

        submission_log_page = self.go_to_submission_log_page()
        submission_log_page.search(ds_id)
        self.assertTrue(DATASENDER_DETAILS[NAME] in
                        submission_log_page.get_cell_value(row=1, column=2))

        self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE)
        all_datasenders_page.search_with(ds_id)
        all_datasenders_page.wait_for_table_to_load()

        all_datasenders_page.select_a_data_sender_by_id(ds_id)
        all_datasenders_page.select_edit_action()
        AddDataSenderPage(self.driver).enter_data_sender_details_from(
            EDITED_DATASENDER_DETAILS)
        submission_log_page = self.go_to_submission_log_page()
        submission_log_page.search(ds_id)
        self.assertTrue(EDITED_DATASENDER_DETAILS[NAME] in
                        submission_log_page.get_cell_value(row=1, column=2))
    def test_successful_addition_editing_of_data_sender(self):
        add_data_sender_page = self.current_page
        add_data_sender_page.enter_data_sender_details_from(VALID_DATA)

        self.assertRegexpMatches(add_data_sender_page.get_success_message(),
                                 fetch_(SUCCESS_MSG, from_(VALID_DATA)))
        self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE)
        all_data_senders_page = AllDataSendersPage(self.driver)
        all_data_senders_page.select_a_data_sender_by_mobile(VALID_DATA[MOBILE_NUMBER_WITHOUT_HYPHENS])
        all_data_senders_page.select_edit_action()
        self.current_page.enter_data_sender_details_from(VALID_EDIT_DATA)
        self.assertRegexpMatches(self.current_page.get_success_message(),
            fetch_(SUCCESS_MSG, from_(VALID_EDIT_DATA)))
 def test_successful_addition_and_editing_of_data_sender(self):
     add_data_sender_page = self.current_page
     add_data_sender_page.enter_data_sender_details_from(VALID_DATA)
     success_msg = add_data_sender_page.get_success_message()
     self.assertIn(fetch_(SUCCESS_MSG, from_(VALID_DATA)), success_msg)
     rep_id = self._parse(success_msg)
     all_data_senders_page = AllDataSendersPage(self.driver)
     all_data_senders_page.load()
     all_data_senders_page.search_with(rep_id)
     all_data_senders_page.select_a_data_sender_by_id(rep_id)
     all_data_senders_page.select_edit_action()
     self.current_page.enter_data_sender_details_from(VALID_EDIT_DATA)
     self.assertRegexpMatches(self.current_page.get_success_message(),
                              fetch_(SUCCESS_MSG, from_(VALID_EDIT_DATA)))
예제 #6
0
 def test_should_update_user_name_when_edited_from_datasender_page(self):
     add_user_page = self.all_users_page.navigate_to_add_user()
     add_user_page.add_user_with(EDIT_USER_DATA)
     self.driver.go_to(DATA_WINNER_ALL_DATA_SENDERS_PAGE)
     all_datasenders_page = AllDataSendersPage(self.driver)
     all_datasenders_page.search_with(EDIT_USER_DATA.get('username'))
     self.driver.find(all_datasenders_page.get_checkbox_selector_for_datasender_row(1)).click()
     all_datasenders_page.select_edit_action()
     EDIT_DETAILS = {"name": "New testUser",
                     "mobile_number": EDIT_USER_DATA.get("mobile_phone"),
                     "commune": "Madagascar",
                     "gps": "-21.7622088847 48.0690991394"}
     AddDataSenderPage(self.driver).enter_data_sender_details_from(EDIT_DETAILS).navigate_to_datasender_page()
     self.driver.go_to(ALL_USERS_URL)
     self.all_users_page = AllUsersPage(self.driver)
     element = self.driver.find(by_xpath(NAME_COLUMN % EDIT_USER_DATA.get("username")))
     self.assertEquals(EDIT_DETAILS.get("name"),element.text)