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")
 def _expect_empty_questionnaire_dialog_to_be_shown(self):
     warning_dialog = WarningDialog(
         self.driver,
         confirm_link=by_xpath(".//*[@id='no_questions_exists']/div/a"))
     message = warning_dialog.get_message()
     self.assertEqual(message, EMPTY_QUESTIONNAIRE_MSG)
     warning_dialog.confirm()
예제 #3
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)
 def _expect_delete_question_dialog_to_be_shown(self, proceed=False):
     warning_dialog = WarningDialog(self.driver)
     message = warning_dialog.get_message()
     self.assertEqual(message, DELETE_QUESTION_MSG)
     if proceed:
         warning_dialog.confirm()
     else:
         warning_dialog.cancel()
 def expect_redistribute_dialog_to_be_shown(self, create_questionnaire_page):
     create_questionnaire_page.save_and_create_project(click_ok=False)
     warning_dialog = WarningDialog(self.driver)
     message = warning_dialog.get_message()
     self.assertEqual(message, REDISTRIBUTE_QUESTIONNAIRE_MSG)
     warning_dialog.confirm()
     self.driver.wait_for_page_with_title(20, 'Projects - Overview')
     return ProjectOverviewPage(self.driver)
예제 #6
0
 def delete_submission(self):
     analysis_page = self.project_overview_page.navigate_to_data_page()
     submission_log_page = analysis_page.navigate_to_all_data_record_page()
     self.driver.wait_until_element_is_not_present(20, by_css("loading"))  # wait for table to load
     self.driver.find(by_xpath("//table[@class='submission_table']//td[text()='admin1']/../td/input")).click()
     # 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()
예제 #7
0
 def delete_submission(self):
     analysis_page = self.project_overview_page.navigate_to_data_page()
     submission_log_page = analysis_page.navigate_to_all_data_record_page()
     self.driver.wait_until_element_is_not_present(
         20, by_css("loading"))  #wait for table to load
     submission_log_page.check_submission_by_row_number(1)
     self._create_screenshot("api_test_row_to_be_deleted.png")
     submission_log_page.choose_on_dropdown_action(DELETE_BUTTON)
     warning_dialog = WarningDialog(self.driver)
     warning_dialog.confirm()
    def admin_edit_delete_submissions(self):
        submission_log_page = SubmissionLogPage(self.driver)
        submission_log_page.check_submission_by_row_number(1)
        submission_log_page.choose_on_dropdown_action(EDIT_BUTTON)

        submission_page = WebSubmissionPage(self.driver)
        submission_page.fill_and_submit_answer(EDITED_WEB_ANSWERS)
        self.verify_submission(EDITED_WEB_ANSWER_LOG, self.project_name)

        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()
        submission_log_page.wait_for_table_data_to_load()
        self.assertTrue(submission_log_page.empty_help_text())
    def test_should_delete_submission(self):
        send_valid_sms_with(VALID_DATA_FOR_DELETE)

        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()
        self.driver.wait_for_element(UI_TEST_TIMEOUT,
                                     by_css('#message_text .success-box'))
        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)
 def confirm_warning_dialog(self, element_id):
     confirm_locator = by_id(element_id)
     warning_dialog = WarningDialog(self.driver,
                                    confirm_link=confirm_locator)
     warning_dialog.confirm()