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_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()