def carga_archivo_claro_drive(webdriver_test_ux: webdriver, path_archivo_carga: str, nombre_archivo_sin_ext: str, jsonEval): tiempo_step_inicio = Temporizador.obtener_tiempo_timer() fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() try: carpeta_folder = WebDriverWait(webdriver_test_ux, 20).until( EC.element_to_be_clickable((By.XPATH, '//span[text()="Folder "][@class="name-without-extension"]'))) carpeta_folder.click() WebDriverWait(webdriver_test_ux, 10).until( EC.element_to_be_clickable((By.XPATH, '//span[text()=" Folder "][@class="last"]'))) input_file = WebDriverWait(webdriver_test_ux, 10).until( EC.presence_of_element_located((By.ID, 'file_upload_start'))) input_file.send_keys(path_archivo_carga) ValidacionesHtml.verificar_ventana_archivo_duplicado(webdriver_test_ux) WebDriverWait(webdriver_test_ux, 720).until(EC.presence_of_element_located( (By.XPATH, '//span[@class="name-without-extension"][text()="{} "]'.format(nombre_archivo_sin_ext)))) jsonEval["steps"][1]["output"][0]["status"] = jsonConst.SUCCESS jsonEval["steps"][1]["status"] = jsonConst.SUCCESS jsonEval["steps"][1]["output"][0]["output"] = 'Se realiza correctamente la carga del archivo' except NoSuchElementException: jsonEval["steps"][1]["output"][0]["status"] = jsonConst.FAILED jsonEval["steps"][1]["status"] = jsonConst.FAILED jsonEval["steps"][1]["output"][0]["output"] = 'No fue posible realizar la carga del archivo' except ElementClickInterceptedException: jsonEval["steps"][1]["output"][0]["status"] = jsonConst.FAILED jsonEval["steps"][1]["status"] = jsonConst.FAILED jsonEval["steps"][1]["output"][0]["output"] = 'No fue posible realizar la carga del archivo' except TimeoutException: jsonEval["steps"][1]["output"][0]["status"] = jsonConst.FAILED jsonEval["steps"][1]["status"] = jsonConst.FAILED jsonEval["steps"][1]["output"][0]["output"] = 'No fue posible realizar la carga del archivo' tiempo_step_final = Temporizador.obtener_tiempo_timer() - tiempo_step_inicio fecha_fin = Temporizador.obtener_fecha_tiempo_actual() jsonEval["steps"][1]["time"] = FormatUtils.truncar_float_cadena(tiempo_step_final) jsonEval["steps"][1]["start"] = fecha_inicio jsonEval["steps"][1]["end"] = fecha_fin return jsonEval
def carga_archivo_claro_drive(webdriver_test_ux: WebDriver, path_archivo_carga: str, json_eval): tiempo_step_inicio = Temporizador.obtener_tiempo_timer() fecha_inicio = Temporizador.obtener_fecha_tiempo_actual() # verifica que se haya iniciado sesion correctamente if not UtilsEvaluaciones.se_ingreso_correctamente_a_la_sesion( json_eval): json_eval = UtilsEvaluaciones.generar_json_inicio_de_sesion_incorrecta( json_eval, tiempo_step_inicio, fecha_inicio, 2, const_claro_drive. MSG_OUTPUT_CARGA_ARCHIVO_MSG_ERROR_INICIO_SESION) return json_eval try: boton_crear = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 10, class_name=const_claro_drive. CARGA_ARCHIVO_CLASS_NAME_BTN_CREATE_RESOURCE) HtmlActions.click_html_element( boton_crear, class_name=const_claro_drive. CARGA_ARCHIVO_CLASS_NAME_BTN_CREATE_RESOURCE) HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 20, class_name=const_claro_drive. CARGA_ARCHIVO_CLASS_NAME_FILE_NAME_READER) input_file = HtmlActions.webdriver_wait_presence_of_element_located( webdriver_test_ux, 20, id=const_claro_drive.CARGA_ARCHIVO_ID_INPUT_FILE_START) HtmlActions.enviar_data_keys( input_file, path_archivo_carga, id=const_claro_drive.CARGA_ARCHIVO_ID_INPUT_FILE_START) ValidacionesHtml.verificar_ventana_archivo_duplicado( webdriver_test_ux) UtilsEvaluaciones.esperar_carga_total_de_archivo(webdriver_test_ux) HtmlActions.verificar_display_flex_modal_mensaje_de_exito( webdriver_test_ux) btn_cerrar_div_progreso_carga_archivo = HtmlActions.webdriver_wait_element_to_be_clickable( webdriver_test_ux, 6, class_name=const_claro_drive.CARGA_ARCHIVO_CLASS_NAME_UP_CLOSE) HtmlActions.verificar_display_flex_modal_mensaje_de_exito( webdriver_test_ux) HtmlActions.click_html_element( btn_cerrar_div_progreso_carga_archivo, class_name=const_claro_drive.CARGA_ARCHIVO_CLASS_NAME_UP_CLOSE) json_eval = UtilsEvaluaciones.establecer_output_status_step( json_eval, 2, 0, True, const_claro_drive.MSG_OUTPUT_CARGA_ARCHIVO_EXITOSO) except NoSuchElementException as e: msg_output = const_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 = const_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 = const_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 StaleElementReferenceException as e: msg_output = const_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