Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
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))
Ejemplo n.º 3
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
Ejemplo n.º 4
0
    def test_delete_data_sender_and_re_register(self):
        all_data_sender_page = self.page
        self.delete_ds(all_data_sender_page)
        self.assertEqual(all_data_sender_page.get_delete_success_message(),
                         DELETE_SUCCESS_TEXT)
        global_navigation = GlobalNavigationPage(self.driver)
        global_navigation.sign_out()

        sms_tester_page = SMSTesterPage(self.driver)
        self.send_sms(VALID_SMS, sms_tester_page)
        self.assertEqual(sms_tester_page.get_response_message(),
                         SMS_ERROR_MESSAGE)

        self.login()
        self.driver.go_to(DATA_WINNER_CREATE_DATA_SENDERS)
        add_data_sender_page = AddDataSenderPage(self.driver)
        add_data_sender_page.enter_data_sender_details_from(VALID_DATA)
        message = add_data_sender_page.get_success_message()
        self.assertRegexpMatches(message, fetch_(SUCCESS_MSG,
                                                 from_(VALID_DATA)))
        self.assertNotEqual(message.split()[-1],
                            fetch_(UID, from_(DELETE_DATA_SENDER)))
        self.driver.wait_until_modal_dismissed(10)
        global_navigation.sign_out()

        self.send_sms(VALID_SMS, sms_tester_page)
        self.assertEqual(sms_tester_page.get_response_message(),
                         fetch_(SUCCESS_MESSAGE, from_(VALID_SMS)))
        self.login()
Ejemplo n.º 5
0
    def navigate_to_add_a_data_sender_page(self):
        """
        Function to navigate to add a data sender page of the website

        Return create project page
         """
        self.driver.find(REGISTER_SENDER_LINK).click()
        return AddDataSenderPage(self.driver)
Ejemplo n.º 6
0
 def test_should_uncheck_reporter_id_checkbox_if_user_has_given_id(self):
     self.driver.go_to(DATA_WINNER_CREATE_DATA_SENDERS)
     add_data_sender_page = AddDataSenderPage(self.driver)
     self.assertTrue(add_data_sender_page.unique_id_check_box_is_checked())
     add_data_sender_page.enter_data_sender_details_from(
         INVALID_MOBILE_NUMBER_DATA, "DS040")
     time.sleep(1)
     self.assertFalse(add_data_sender_page.unique_id_check_box_is_checked())
     self.assertTrue(add_data_sender_page.unique_id_field_is_enabled())
    def navigate_to_add_a_data_sender_page(self, wait_for_page_loading=False, lightbox=True):
        """
        Function to navigate to add a data sender page of the website

        Return create project page
         """
        locator = ADD_A_DATA_SENDER_LINK if lightbox else DATASENDER_FORM_TAB_LINK_XPATH
        self.driver.find(locator).click()
        if wait_for_page_loading:
            self.driver.wait_for_element(20, by_id("id_register_button"))
        return AddDataSenderPage(self.driver)
Ejemplo n.º 8
0
 def test_should_not_able_to_use_other_datasender_mobile_number(self):
     self.all_datasenders_page.search_with('rep10')
     self.all_datasenders_page.select_a_data_sender_by_id('rep10')
     self.all_datasenders_page.select_edit_action()
     page = AddDataSenderPage(self.driver)
     page.enter_datasender_mobile_number("1234567890")
     page.click_submit_button()
     time.sleep(2)
     self.assertEqual(
         page.get_error_message(),
         u'Sorry, the telephone number 1234567890 has already been registered.'
     )
Ejemplo n.º 9
0
 def test_should_not_able_to_use_other_datasender_mobile_number(self):
     self.all_datasenders_page.search_with('rep10')
     self.all_datasenders_page.select_a_data_sender_by_id('rep10')
     self.all_datasenders_page.select_edit_action()
     page = AddDataSenderPage(self.driver)
     page.enter_datasender_mobile_number("1234567890")
     page.click_submit_button()
     time.sleep(2)
     self.assertEqual(
         page.get_error_message(),
         u'This phone number is already in use. Please supply a different phone number'
     )
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
 def test_should_show_updated_datasender_details_after_edit(self):
     self.all_datasenders_page.search_with(
         self.datasender_id_with_web_access)
     self.all_datasenders_page.select_a_data_sender_by_id(
         self.datasender_id_with_web_access)
     self.all_datasenders_page.select_edit_action()
     AddDataSenderPage(self.driver).enter_data_sender_details_from(
         EDITED_DATA_SENDER).navigate_to_datasender_page()
     self.all_datasenders_page.wait_for_table_to_load()
     self.all_datasenders_page.search_with(
         self.datasender_id_with_web_access)
     self.assertEqual(fetch_(NAME, EDITED_DATA_SENDER),
                      self.all_datasenders_page.get_cell_value(1, 2))
     self.assertEqual(self.datasender_id_with_web_access,
                      self.all_datasenders_page.get_cell_value(1, 7))
     location_appended_with_account_location = fetch_(
         COMMUNE, EDITED_DATA_SENDER) + ",Madagascar"
     self.assertEqual(location_appended_with_account_location,
                      self.all_datasenders_page.get_cell_value(1, 5))
     self.assertEqual(fetch_(GPS, EDITED_DATA_SENDER),
                      self.all_datasenders_page.get_cell_value(1, 6))
     self.assertEqual(fetch_(MOBILE_NUMBER, EDITED_DATA_SENDER),
                      self.all_datasenders_page.get_cell_value(1, 3))
Ejemplo n.º 12
0
 def edit_datasender(self, uid=None):
     if not uid: return False
     self.select_a_data_sender_by_id(uid)
     self.select_edit_action()
     return AddDataSenderPage(self.driver)
Ejemplo n.º 13
0
 def setUp(self):
     TestAllDataSenderRegistration.driver.refresh()
     self.driver.go_to(DATA_WINNER_CREATE_DATA_SENDERS)
     self.current_page = AddDataSenderPage(self.driver)
 def setUp(self):
     TestAllDataSenderRegistration.driver.refresh()
     self.driver.go_to(DATA_WINNER_CREATE_DATA_SENDERS)
     self.driver.find(by_id("register_link")).click()
     self.current_page = AddDataSenderPage(self.driver)