def ingreso_pagina_principal_dropbox(webdriver_test_ux: WebDriver, json_eval): tiempo_step_inicio = None fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() try: url_pagina_principal = FormatUtils.lector_archivo_ini().get( 'Dropbox_config', 'url_login') webdriver_test_ux.get(url_pagina_principal) tiempo_step_inicio = Temporizador.obtener_tiempo_timer() HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 10, name='login_email') HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 10, name='login_password') json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, True, constantes_evaluaciones_claro_drive. MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_EXITOSO) except ElementNotInteractableException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) except NoSuchElementException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) except TimeoutException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) except ElementClickInterceptedException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) except InvalidArgumentException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) except WebDriverException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_INGRESO_PAGINA_PRINCIPAL_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 0, 0, False, msg_output) json_eval = UtilsEvaluaciones.finalizar_tiempos_en_step( json_eval, 0, tiempo_step_inicio, fecha_inicio) return json_eval
def descargar_archivo_dropbox(webdriver_test_ux: WebDriver, json_eval, nombre_archivo_con_ext): extension_del_archivo = path.splitext(nombre_archivo_con_ext)[1] nombre_del_archivo_sin_extension = Path(nombre_archivo_con_ext).stem tiempo_step_inicio = None fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() try: ValidacionesHtml.verificar_remover_ventana_configuracion( webdriver_test_ux) search_bar = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 20, class_name='search__input') HtmlActions.enviar_data_keys(search_bar, nombre_archivo_con_ext, class_name='search__input') HtmlActions.enviar_data_keys(search_bar, Keys.RETURN, class_name='search__input') archivo_por_descargar = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 20, xpath='//tr[@data-filename="{}"]'.format( nombre_archivo_con_ext)) btn_mas_acciones = HtmlActions.webdriver_wait_element_to_be_clickable( archivo_por_descargar, 20, class_name='browse-overflow-menu') HtmlActions.click_html_element(btn_mas_acciones, class_name='browse-overflow-menu') btn_descargar = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 20, class_name='action-download') HtmlActions.click_html_element(btn_descargar, class_name='action-download') tiempo_step_inicio = Temporizador.obtener_tiempo_timer() UtilsEvaluaciones.verificar_descarga_en_ejecucion( nombre_del_archivo_sin_extension, extension_del_archivo) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, True, constantes_evaluaciones_claro_drive. MSG_OUTPUT_DESCARGA_ARCHIVO_EXITOSO) except ElementNotInteractableException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_DESCARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, False, msg_output) except NoSuchElementException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_DESCARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, False, msg_output) except TimeoutException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_DESCARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, False, msg_output) except ElementClickInterceptedException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_DESCARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, False, msg_output) except StaleElementReferenceException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_DESCARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 3, 0, False, msg_output) json_eval = UtilsEvaluaciones.finalizar_tiempos_en_step( json_eval, 3, tiempo_step_inicio, fecha_inicio) return json_eval
def cargar_archivo_dropbox(webdriver_test_ux: WebDriver, json_eval, json_args, nombre_archivo_sin_ext, nombre_archivo_con_ext): tiempo_step_inicio = None fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() try: ValidacionesHtml.verificar_remover_ventana_configuracion( webdriver_test_ux) ValidacionesHtml.verificar_archivo_ya_existente_en_portal( webdriver_test_ux, nombre_archivo_sin_ext) input_carga_de_archivo = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 10, xpath='//body/div/div/input[1]') HtmlActions.enviar_data_keys(input_carga_de_archivo, data_key=json_args['pathImage'], xpath='//body/div/div/input[1]') HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 12, xpath= '//div[@class="ReactModal__Content ReactModal__Content--after-open ' 'dig-Modal folder-picker-modal"]') btn_cargar = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 12, xpath= '//button[@class="dig-Button dig-Button--primary dig-Button--standard"]' ) HtmlActions.webdriver_wait_until_not_presence_of_element_located( webdriver_test_ux, 12, class_name='folder-picker__empty-message') WebDriverWait(webdriver_test_ux, 12).until( EC.presence_of_element_located( (By.CLASS_NAME, 'folder-picker__empty-message'))) HtmlActions.click_html_element( btn_cargar, xpath='//button[@class="dig-Button dig-Button--primary ' 'dig-Button--standard"]') tiempo_step_inicio = Temporizador.obtener_tiempo_timer() HtmlActions.webdriver_wait_visibility_of_element_located( webdriver_test_ux, 720, xpath= '//span[@class="dig-Snackbar-message "][text()="Se carg\u00F3 {}."]' .format(nombre_archivo_con_ext)) btn_cerrar_progreso_carga = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 10, xpath='//span[@class="dig-Button-content"][text()="Cerrar"]') HtmlActions.click_html_element( btn_cerrar_progreso_carga, xpath='//span[@class="mc-button-content"][text()="Cerrar"]') json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, True, constantes_evaluaciones_claro_drive. MSG_OUTPUT_CARGA_ARCHIVO_EXITOSO) except ElementNotInteractableException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_CARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, False, msg_output) except NoSuchElementException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_CARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, False, msg_output) except TimeoutException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_CARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, False, msg_output) except ElementClickInterceptedException as e: msg_output = constantes_evaluaciones_claro_drive.MSG_OUTPUT_CARGA_ARCHIVO_SIN_EXITO.format( e.msg) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, False, msg_output) json_eval = UtilsEvaluaciones.finalizar_tiempos_en_step( json_eval, 2, tiempo_step_inicio, fecha_inicio) return json_eval