Exemplo n.º 1
0
    def delete_question(self, index):
        """
        Function change a text of one question

        """
        self.driver.find_elements_(by_css(".questions li"))[index - 1].click()
        self.driver.find_elements_(by_css(".questions li .delete_link"))[index - 1].click()
Exemplo n.º 2
0
    def test_unsaved_warning_on_language_change(self):
        def change_language():
            self.language_page.select_language("French")
        self.change_reply_messages()
        change_language()
        self.verify_warning_dialog_present()
        self.driver.find_visible_element(by_css(".cancel_button")).click()
        self.assertListEqual([msg + "new message" for msg in default_en_messages],  self.language_page.get_all_customized_reply_messages())

        change_language()
        self.verify_warning_dialog_present()
        self.language_page.click_revert_changes_button()

        self.assertFalse(self.is_warning_dialog_present())
        self.language_page.refresh()
        self.language_page = CustomizedLanguagePage(self.driver)
        self.assertFalse(self.is_warning_dialog_present())
        self.language_page.wait_for_reply_messages_to_load()
        self.check_for_default_en_messages()

        self.change_reply_messages()
        change_language()
        self.verify_warning_dialog_present()
        self.language_page.click_save_changes_button()
        self.driver.wait_for_element(UI_TEST_TIMEOUT, by_css(".success-message-box"), True)

        self.language_page.refresh()
        self.driver.wait_for_page_load()
        self.language_page = CustomizedLanguagePage(self.driver)
        self.language_page.wait_for_reply_messages_to_load()
        self.assertListEqual([msg + "new message" for msg in default_en_messages],  self.language_page.get_all_customized_reply_messages())
Exemplo n.º 3
0
    def test_dirty_dialog_behavior_for_add_new_language(self):
        self.change_reply_messages()
        self.language_page.select_add_new_language_option()
        self.assertTrue(self.is_warning_dialog_present())

        self.language_page.click_revert_changes_button()

        self.driver.wait_for_element(UI_TEST_TIMEOUT, by_id("add_new_language_pop"))
        self.language_page.save_new_language("new_lang"+random_string(4))
        self.assertEquals("Your language has been added successfully. Please translate the suggested automatic reply SMS text.",
                          self.language_page.get_success_message())

        self.driver.wait_until_element_is_not_present(UI_TEST_TIMEOUT, by_css(".success-message-box"))
        self.assertFalse(self.is_warning_dialog_present())

        self.language_page.select_language("English", True)

        self.assertFalse(self.is_warning_dialog_present())
        self.check_for_default_en_messages()

        self.language_page = CustomizedLanguagePage(self.driver)
        self.change_reply_messages()
        self.language_page.select_add_new_language_option()
        self.assertTrue(self.is_warning_dialog_present())

        self.language_page.click_save_changes_button()
        self.driver.wait_until_element_is_not_present(UI_TEST_TIMEOUT, by_css(".success-message-box"))
        self.driver.wait_for_element(UI_TEST_TIMEOUT, by_id("add_new_language_pop"))
        self.language_page.save_new_language("new_lang"+random_string(4))
        self.assertEquals("Your language has been added successfully. Please translate the suggested automatic reply SMS text.",
                          self.language_page.get_success_message())
        self.language_page.select_language("English", True)
        self.assertListEqual([msg + "new message" for msg in default_en_messages],  self.language_page.get_all_customized_reply_messages())
Exemplo n.º 4
0
    def test_unsaved_warning_dialog(self):
        def click_identification_number_page():
            self.driver.find(by_css("#global_subjects_link")).click()

        self.change_reply_messages()
        click_identification_number_page()
        self.verify_warning_dialog_present()
        self.driver.find_visible_element(by_css(".cancel_button")).click()
        self.assertListEqual([msg + "new message" for msg in default_en_messages],  self.language_page.get_all_customized_reply_messages())

        click_identification_number_page()
        self.verify_warning_dialog_present()
        self.language_page.click_revert_changes_button()

        self.assertFalse(self.is_warning_dialog_present())
        self.driver.find(by_css("#global_languages_link")).click()
        self.language_page = CustomizedLanguagePage(self.driver)
        self.assertFalse(self.is_warning_dialog_present())
        self.language_page.wait_for_reply_messages_to_load()
        self.check_for_default_en_messages()

        self.change_reply_messages()
        click_identification_number_page()
        self.verify_warning_dialog_present()
        self.language_page.click_save_changes_button()

        self.driver.find(by_css("#global_languages_link")).click()
        self.driver.wait_for_page_load()
        self.language_page = CustomizedLanguagePage(self.driver)
        self.language_page.wait_for_reply_messages_to_load()
        self.assertListEqual([msg + "new message" for msg in default_en_messages],  self.language_page.get_all_customized_reply_messages())
    def test_edit_submisssion(self):
        self.project_name = random_string()
        self.setUpFirefox()

        form_code = self._verify_questionnaire_creation(
            self.project_name, 'multiple-choices.xlsx')
        project_temp_name, web_submission_page = navigate_and_verify_web_submission_page_is_loaded(
            self.driver, self.global_navigation_page, self.project_name)
        self._do_web_submission(
            'edit_submission_ft-check-multiple-choices.xml', project_temp_name,
            form_code, self.admin_email_id, 'tester150411')

        submission_log_page = self.global_navigation_page.navigate_to_all_data_page(
        ).navigate_to_submission_log_page(
            self.project_name).wait_for_table_data_to_load()
        self.driver.create_screenshot("debug-ft-sub-log-edit-nth-sub")
        web_submission_page = submission_log_page.edit_nth_submission(1)
        sleep(5)
        data = self.driver.execute_script("return dataStrToEdit;")
        self.driver.create_screenshot("debug-ft-edit-sub-page")
        expected = "<idnr>food pet rhinitis</idnr><enfant><naissance_enfant>no</naissance_enfant><poids_enfant>16</poids_enfant><nom_enfant>John</nom_enfant><date_enfant>2016-12-01</date_enfant><text>Setra</text><select_enfant>trad other</select_enfant><age_enfant>3</age_enfant></enfant><form_code>%s</form_code>" % form_code
        self.assertIn(expected, data)
        self.driver.wait_for_page_load()

        self.driver.create_screenshot(
            "debug-ft-edit-adv-submission-before-change")
        text_answer_locator = by_css('input[name="/' + project_temp_name +
                                     '/enfant/nom_enfant"]')
        web_submission_page.update_text_input(text_answer_locator, "a")
        self.driver.create_screenshot(
            "debug-ft-edit-adv-submission-after-change")

        self.assertFalse(web_submission_page.is_warning_dialog_displayed())
        web_submission_page.navigate_to_submission_log()
        sleep(1)
        self.assertTrue(web_submission_page.is_warning_dialog_displayed())
        warning_dialog = WarningDialog(
            self.driver,
            cancel_link=by_css(
                'div.ui-dialog[style*="block"] > div.ui-dialog-content > div > a.dialog_cancel_link'
            ))
        warning_dialog.cancel(True)
        self.driver.create_screenshot(
            "debug-ft-edit-adv-submission-after-cancel-dialog")

        web_submission_page.submit(True)
        web_submission_page.wait_until_modal_dismissed()
        self.assertTrue(web_submission_page.is_success_message_tip_shown())

        web_submission_page.update_text_input(text_answer_locator, "b")
        sleep(5)
        web_submission_page.navigate_to_submission_log()
        sleep(1)
        self.assertTrue(web_submission_page.is_warning_dialog_displayed())

        warning_dialog.confirm()

        sleep(5)
        self.driver.wait_for_page_load()
        self.assertEqual(self.driver.get_title(), "Submission Log")
Exemplo n.º 6
0
 def test_add_datasender_with_long_uid(self):
     add_data_sender_page = self.current_page
     self.driver.find(by_css("#generate_id")).click()
     self.driver.find_text_box(
         by_css("#id_short_code")).enter_text("rep012345678901234567891")
     short_code = self.driver.find(
         by_css("#id_short_code")).get_attribute('value')
     self.assertEquals(len(short_code), 12)
 def select_poll_questionnaire_option(self):
     self.driver.wait_for_element(
         UI_TEST_TIMEOUT, by_css(POLL_QUESTIONNAIRE_SELECTION_ACCORDION),
         True)
     blank_questionnaire_accoridion = self.driver.find(
         by_css(POLL_QUESTIONNAIRE_SELECTION_ACCORDION))
     blank_questionnaire_accoridion.click()
     self.driver.wait_for_element(UI_TEST_TIMEOUT, CONTINUE_BTN, True)
     return self.go_to_create_questionnaire_page()
Exemplo n.º 8
0
 def has_DS_received_sms(self, recipent, row, column):
     self.select_element(POLL_TAB)
     self.select_element(POLL_SMS_ACCORDIAN)
     self.driver.wait_for_element(UI_TEST_TIMEOUT,
                                  by_css("#poll_sms_table"), True)
     recipient_name = self.driver.find(
         by_css(
             '#poll_sms_table>tbody>tr:nth-of-type(%s)>td:nth-of-type(%s)>span:nth-of-type(2)'
             % (row, column))).text
     return recipient_name in recipent
Exemplo n.º 9
0
 def enter_project_name_and_validate_error_msg(self, project_name_text,
                                               message):
     self.driver.find_text_box(by_css(
         ".project_title input.editField")).enter_text(project_name_text)
     self.driver.find(
         by_css(".project_title .editFieldSaveControllers button")).click()
     self.driver.wait_for_element(UI_TEST_TIMEOUT,
                                  by_css(".error .message"), True)
     self.assertEqual(
         self.driver.find(by_css(".error .message")).text, message)
Exemplo n.º 10
0
 def add_user_with(self, user_data, click_submit=True):
     for key, value in user_data.items():
         self.driver.find_text_box(by_css("input[name='%s']" %
                                          key)).enter_text(value)
     if click_submit:
         sleep(2)
         self.driver.find(by_css("button[id=submit]")).click()
         self.driver.wait_until_element_is_not_present(
             UI_TEST_TIMEOUT * 2, by_css(".loading"))
     sleep(2)
     self.driver.wait_for_page_load()
Exemplo n.º 11
0
 def test_should_revert_to_original_text_when_reset(self):
     self.change_account_messages()
     self.account_sms_page.save_changes()
     self.driver.wait_until_element_is_not_present(
         UI_TEST_TIMEOUT, by_css(".success-message-box"))
     self.account_sms_page.revert_to_original()
     self.check_default_account_messages()
     self.assertListEqual([
         u'Any changes you make to this text will apply for all Data Senders.'
     ] * 6, [
         e.text for e in self.driver.find_visible_elements_(
             by_css(".account_message_warning_message"))
     ])
     self.reset_account_messages()
Exemplo n.º 12
0
    def test_should_validate_add_new_language(self):
        self.language_page.add_new_language("")
        self.assertIn("Please enter a name for your language.", [
            e.text
            for e in self.driver.find_elements_(by_css(".validationText"))
        ])

        self.driver.find_text_box(NEW_LANGUAGE_INPUT_BOX).enter_text("english")
        self.driver.find(ADD_NEW_LANG_CONFIRM_BUTTON).click()
        self.assertIn("english already exists.", [
            e.text
            for e in self.driver.find_elements_(by_css(".validationText"))
        ])

        self.driver.find(ADD_NEW_LANG_CANCEL_BUTTON).click()
 def test_filter_for_one_day(self):
     activity_log_page = self.navigate_to_activity_log_page()
     today = datetime.datetime.today()
     self.driver.find_text_box(by_css("#dateRangePicker")).enter_text(today.strftime("%d-%m-%Y"))
     activity_log_page.click_on_filter_button()
     entries_number = activity_log_page.get_number_of_entries_found()
     self.assertGreater(entries_number, 0, "No entries found in Activity log")
 def _update_submission(self, project_temp_name):
     text_answer_locator = by_css('input[name="/' + project_temp_name +
                                  '/text_widgets/my_string"]')
     advanced_web_submission_page = AdvancedWebSubmissionPage(
         self.driver).update_text_input(text_answer_locator,
                                        '-edited').submit()
     return advanced_web_submission_page
Exemplo n.º 15
0
 def select_questionnaires(self, no_of_questionnaires=0, from_index=0):
     self._uncheck_all_questionnaires()
     for index in range(from_index, (from_index + no_of_questionnaires)):
         self.driver.wait_for_element(
             10,
             by_css(
                 ".questionnaire-list ul li:nth-child(%s) input[type=checkbox]"
                 % (index + 1)), True).click()
     list_of_questionnaires = []
     for index in range(0, no_of_questionnaires):
         element = self.driver.wait_for_element(
             10,
             by_css(".questionnaire-list ul li:nth-child(%s) span" %
                    (index + 1)), True)
         list_of_questionnaires.append(element.text)
     return list_of_questionnaires
Exemplo n.º 16
0
 def get_existing_questions(self):
     questions = []
     questions_divs = self.driver.find_elements_(
         by_css('#qns_list>ol>li>a'))
     for q in questions_divs:
         questions.append(q.text)
     return questions
Exemplo n.º 17
0
 def is_warning_dialog_displayed(self):
     from framework.utils.common_utils import by_css
     try:
         self.driver.find_visible_element(by_css(".ui-dialog-titlebar"))
         return True
     except Exception:
         return False
Exemplo n.º 18
0
    def _create_project(cls, project_data, questionnaire_data):
        global_navigation = GlobalNavigationPage(cls.driver)
        dashboard_page = global_navigation.navigate_to_dashboard_page()
        create_questionnaire_options_page = dashboard_page.navigate_to_create_project_page(
        )
        cls.create_questionnaire_page = create_questionnaire_options_page.select_blank_questionnaire_creation_option(
        )
        cls.create_questionnaire_page.create_questionnaire_with(
            project_data, questionnaire_data)
        questionnaire_code = cls.create_questionnaire_page.get_questionnaire_code(
        )
        overview_page = cls.create_questionnaire_page.save_and_create_project_successfully(
        )

        reminder_setting_page = ProjectOverviewPage(
            cls.driver).navigate_to_reminder_page()
        reminder_setting_page.set_frequency("Week")
        reminder_setting_page.set_week_day("Friday")
        reminder_setting_page.enable_before_deadline_reminder()
        reminder_setting_page.save_reminders()
        cls.driver.wait_for_element(UI_TEST_TIMEOUT,
                                    by_css('.success-message-box'),
                                    want_visible=True)
        automatic_reply_sms_page = reminder_setting_page.navigate_to_automatic_reply_sms_page(
        )
        automatic_reply_sms_page.turn_off_reply_messages()
        cls.questionnaire_tab_page = overview_page.navigate_to_questionnaire_tab(
        )
        cls.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, 'Questionnaire')
        return overview_page.get_project_title(), questionnaire_code
 def test_to_submit_data_on_behalf_of_another_datasender(self):
     datasender = "rep11"
     edited_datsender_to = 'rep10'
     web_submission_page = self.project_overview_page.navigate_to_web_questionnaire_page(
     )
     web_submission_page.select_checkbox_to_submit_on_behalf()
     web_submission_page.change_datasender(datasender)
     web_submission_page.fill_and_submit_answer(VALID_ANSWER)
     submission_log_page = web_submission_page.navigate_to_submission_log()
     submission_log_page.check_submission_by_row_number(1)
     submission_log_page.choose_on_dropdown_action(EDIT_BUTTON)
     edit_submission_page = WebSubmissionPage(self.driver)
     edit_submission_page.click_on_change_ds_link()
     edit_submission_page.change_datasender(edited_datsender_to)
     edit_submission_page.save_change_datasender()
     edit_submission_page.fill_and_submit_answer(EDITED_ANSWERS)
     self.driver.wait_for_element(5,
                                  by_css('.success-message-box'),
                                  want_visible=True)
     submission_log_page = edit_submission_page.navigate_to_submission_log()
     submission_log_page.get_total_number_of_rows()
     datasender_name = submission_log_page.get_cell_value(1, 2)
     edited_value = submission_log_page.get_cell_value(1, 5)
     status = submission_log_page.get_cell_value(1, 4)
     self.assertEquals('stefan rep10', datasender_name)
     self.assertEquals('4.0', edited_value)
     self.assertEquals('Success', status)
Exemplo n.º 20
0
 def get_warning_dialog_message(self):
     from framework.utils.common_utils import by_css
     locator = by_css("#form_changed_warning_dialog p.warning_message")
     wmsg = self.driver.find(locator)
     if wmsg.is_displayed():
         return wmsg.text
     return ""
Exemplo n.º 21
0
    def test_should_delete_submission(self):
        self.driver.go_to(DATA_WINNER_SMS_TESTER_PAGE)
        sms_tester_page = SMSTesterPage(self.driver)
        sms_tester_page.send_valid_sms_with(VALID_DATA_FOR_DELETE)

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

        submission_log_page = self.go_to_submission_log_page()
        submission_log_page.search(unique_text)
        submission_log_page.wait_for_table_data_to_load()

        submission_log_page.check_submission_by_row_number(1)
        submission_log_page.choose_on_dropdown_action(DELETE_BUTTON)
        warning_dialog = WarningDialog(self.driver)
        warning_dialog.confirm()
        time.sleep(1)
        delete_success_text = self.driver.find_visible_element(
            by_css('#message_text')).text
        self.assertEqual(delete_success_text,
                         "The selected records have been deleted")
        submission_log_page.wait_for_table_data_to_load()
        self.assertEquals(
            int(submission_log_page.get_total_number_of_records()), 0)
Exemplo n.º 22
0
 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)
Exemplo n.º 23
0
    def test_send_sms_to_people_should_add_linked_contact_recipients_to_my_data_senders_of_poll(
            self):
        self.poll_questionnaire_page.select_sms_option()
        self.poll_questionnaire_page.enter_sms_text()
        self.poll_questionnaire_page.select_receipient(LINKED_CONTACTS,
                                                       CLINIC_ALL_DS)
        self.poll_questionnaire_page.click_create_poll()
        self.poll_questionnaire_page.select_send_sms()
        self.poll_questionnaire_page.send_sms_to(LINKED_CONTACTS,
                                                 CLINIC_TEST_PROJECT)

        self.poll_questionnaire_page.select_element(DATA_SENDER_TAB)
        self.poll_questionnaire_page.select_element(by_css('.short_code'))
        sleep(3)
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP1, FIRST_ROW, SIXTH_COLUMN))
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP3, SECOND_ROW, SIXTH_COLUMN))
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP5, THIRD_ROW, SIXTH_COLUMN))
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP6, FOURTH_ROW, SIXTH_COLUMN))
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP7, FIFTH_ROW, SIXTH_COLUMN))
        self.assertTrue(
            self.poll_questionnaire_page.isRecipientAssociated(
                REP8, SIXTH_ROW, SIXTH_COLUMN))
 def test_edit_submissions_are_logged(self):
     project_overview = self.global_navigation_page.navigate_to_view_all_project_page().navigate_to_project_overview_page(
         self.project_title)
     web_submission_page = project_overview.navigate_to_web_questionnaire_page()
     web_submission_page.fill_and_submit_answer(VALID_ANSWERS)
     time.sleep(5)
     submission_log_page = web_submission_page.navigate_to_submission_log()
     #self.driver.wait_for_element(UI_TEST_TIMEOUT, by_css(".blockUI"), True)
     #self.driver.wait_until_element_is_not_present(UI_TEST_TIMEOUT, by_css(".blockUI"))
     time.sleep(3)
     submission_log_page.check_submission_by_row_number(1)
     submission_log_page.choose_on_dropdown_action(EDIT_BUTTON)
     edit_submission_page = WebSubmissionPage(self.driver)
     edit_submission_page.fill_and_submit_answer(EDITED_ANSWERS)
     self.driver.wait_for_element(5, by_css('.success-message-box'), want_visible=True)
     activity_log_page = self.navigate_to_activity_log_page()
     activity_log_page.select_filter('Data Submissions', 'Edited Data Submission(s)')
     time.sleep(3)
     self.assertEqual("Edited Data Submission(s)", activity_log_page.get_data_on_cell(row=1, column=2))
     self.assertTrue(activity_log_page.get_data_on_cell(row=1, column=3).startswith("Reporter Activities"))
     details_data = activity_log_page.get_data_on_cell(row=1, column=4)
     self.assertTrue("Submission Received on" in details_data)
     self.assertTrue("Changed Answers" in details_data)
     self.assertFalse("Changed Status" in details_data)
     self.assertTrue('Number of Docs: "5.0" to "4.0"' in details_data)
     self.assertTrue('Date of report: "12.01.2013" to "11.01.2013"' in details_data)
     self.assertTrue('Color of Eyes: "LIGHT RED" to "LIGHT YELLOW"' in details_data)
     self.assertTrue('Clinic admin name: "something" to "nothing"' in details_data)
     self.assertTrue('Bacterias in water: "Bacteroids" to "Aquificae, Bacteroids, Chlorobia"' in details_data)
     self.assertTrue('Geo points of Clinic: "-1,-1" to "1,1"' in details_data)
Exemplo n.º 25
0
    def test_delete_subject_type(self):
        subject_type = random_string(5)
        subject_type_page = self.page
        response = subject_type_page.add_subject_type(subject_type)
        subject_type_page.refresh()

        subject_page = subject_type_page.select_subject_type(subject_type)
        subject_page.wait_for_processing()
        add_subjects_page = subject_page.navigate_to_register_subject_page()
        add_subjects_page.add_subject_with(SUBJECT_DATA_WITHOUT_UNIQUE_ID)
        add_subjects_page.submit_subject()
        add_subjects_page.navigate_to_all_subjects()

        subject_type_page.click_subject_type(subject_type)
        subject_type_page.select_delete_action(confirm=True)
        self.driver.wait_until_element_is_not_present(
            5, by_css("#type_message .ajax_loader_small"))
        message = subject_type_page.get_message()
        self.assertEqual(message, SUCCESSFULLY_DELETED_SUBJECT_TYPE_MSG)

        self.assertNotIn(subject_type, self.get_all_subjects_types())
        self._verify_entity_action(subject_type)
        response = subject_type_page.add_subject_type(subject_type)
        subject_type_page.refresh()
        subject_page = subject_type_page.select_subject_type(subject_type)
        subject_page.wait_for_processing()
        self.assertTrue(subject_page.empty_table_text_visible())
Exemplo n.º 26
0
    def has_DS_received_sms(self, recipent, row, column, debug=False):
        try:
            sms_table_element = self.driver.find(by_id("poll_sms_table"))
        except Exception as e:
            sms_table_element = None

        if not sms_table_element or not sms_table_element.is_displayed():
            self.select_element(POLL_TAB)
            time.sleep(3)
            self.select_element(POLL_SMS_ACCORDIAN)
            self.driver.wait_for_element(UI_TEST_TIMEOUT,
                                         by_css("#poll_sms_table"), True)
            self.driver.wait_until_modal_dismissed()

        try:
            elements = self.driver.find_elements_by_css_selector(
                '#poll_sms_table>tbody>tr:nth-of-type(%s)>td:nth-of-type(%s)>span.small_grey'
                % (row, column))
            recipient_name = [element.text for element in elements]

            for rep_id in recipent:
                if rep_id not in recipient_name:
                    if debug:
                        self.driver.create_screenshot(
                            "debug-ft-ds-didn-receive-poll-sms")
                        raise Exception("%s not in [%s]" %
                                        (rep_id, ", ".join(recipient_name)))
                    return False
            return True

        except Exception as e:
            self.driver.create_screenshot(
                "debug-ft-has-ds-received-sms-element-not-found")
            raise e
Exemplo n.º 27
0
    def get_success_message(self):
        """
        Function to fetch the success message from label of the questionnaire page

        Return success message
        """
        success_message = self.driver.wait_for_element(UI_TEST_TIMEOUT, by_css("#message-label .success"))
        return self.driver.execute_script("return arguments[0].innerHTML", success_message)
Exemplo n.º 28
0
    def get_error_message(self):
        """
        Function to fetch the success message from label of the questionnaire page

        Return success message
        """
        error_msg = self.driver.wait_for_element(UI_TEST_TIMEOUT, by_css("#questionnaire_code_validation_message"))
        return error_msg.text
Exemplo n.º 29
0
 def get_entry_for_row_number(self, row_number):
     locator = "#failedsubmissions_table tbody tr:nth-child(%d) td:nth-child(%d)"
     questionnaire_code = self.driver.find(
         by_css(locator % (row_number + 1, 4))).text
     from_number = self.driver.find(by_css(locator %
                                           (row_number + 1, 2))).text
     to_number = self.driver.find(by_css(locator %
                                         (row_number + 1, 3))).text
     message = self.driver.find(by_css(locator % (row_number + 1, 5))).text
     error = self.driver.find(by_css(locator % (row_number + 1, 6))).text
     return {
         'questionnaire_code': questionnaire_code,
         'from_number': from_number,
         'to_number': to_number,
         'message': message,
         'error': error
     }
 def turn_off_reply_messages(self):
     try:
         on_off_switch = self.driver.find_visible_element(
             by_css('.onoffswitch-checked'))
         on_off_switch.click()
     except Exception:
         pass
     self.save_changes()
Exemplo n.º 31
0
from framework.utils.common_utils import by_css, CommonUtilities

LOCATOR = "locator"
BY = "by"

CLICK_ADD_NEW_PROGRAMMER_BUTTON_SCRIPT = '$("input#add_new_programmer").click()'
ADD_NEW_PROGRAMMER_INPUT = by_css('input#new_programmer_name')
ERROR_MESSAGE_LABEL = by_css('.message.error')
SUCCESS_MESSAGE_LABEL = by_css('.message.success')
PROGRAMMER_NAMES = by_css('.title-name')
CLICK_DELETE_BUTTON_SCRIPT = '$(".%s.delete").click()'
DELETE_ALL_PROGRAMMER_SCRIPT = '$(".delete").click()'
CLICK_DO_PAIR_SCRIPT = '$(".%s.%s.pair_time").click()'
PAIR_TIME = '.%s.%s.pair_time'

from pages.page import Page

class PairStairPage(Page):
    
    def get_add_button(self):
        return self.driver.find(ADD_NEW_PROGRAMMER_BUTTON)
    
    def _get_programmer_name_input(self):
        return self.driver.find_text_box(ADD_NEW_PROGRAMMER_INPUT)

    def add_programmer_with_name(self,programmer_name):
        self._get_programmer_name_input().enter_text(programmer_name)
        self.driver.execute_script(CLICK_ADD_NEW_PROGRAMMER_BUTTON_SCRIPT)
        
    def get_error_message(self):
        return self.driver.find(ERROR_MESSAGE_LABEL)
Exemplo n.º 32
0
 def get_pair_time(self, programmer_0_name, programmer_1_name):
     return self.driver.find(by_css(PAIR_TIME % (programmer_0_name, programmer_1_name))).text