提交 05bc8fe3 authored 作者: 陈泽健's avatar 陈泽健

处理展厅巡检会议文件空问题,排查展厅巡检的讯飞系统转录,调试没有问题,正常转录成功。

上级 6ec99032
No preview for this file type
......@@ -1804,4 +1804,98 @@ def write_xlsx_data(xlsx_file_path, sheet_name, function_number, test_result, lo
workbook.save(xlsx_file_path)
logging.info(f"文件 {xlsx_file_path} 已保存,数据已写入功能编号为 {function_number} 的行。")
except Exception as e:
logging.error(f"保存文件时出错: {e}")
\ No newline at end of file
logging.error(f"保存文件时出错: {e}")
# import xlwings as xw
# import os
# import logging
# def write_xlsx_data2(xlsx_file_path, sheet_name, function_number, test_result, log_screenshot):
# """
# 在XLSX文件的指定行中填充测试结果和嵌入日志截图(通过xlwings实现)。
#
# 参数:
# xlsx_file_path (str): XLSX文件的路径。
# sheet_name (str): 工作表的名称。
# function_number (str): 功能编号,用于匹配行。
# test_result (str): 测试结果。
# log_screenshot (str): 日志截图路径。
# """
# if not os.path.exists(xlsx_file_path):
# raise FileNotFoundError(f"文件未找到: {xlsx_file_path}")
#
# try:
# # 打开Excel文件
# wb = xw.Book(xlsx_file_path)
# except Exception as e:
# raise Exception(f"无法打开文件: {e}")
#
# try:
# # 选择工作表
# if sheet_name:
# sheet = wb.sheets[sheet_name]
# else:
# sheet = wb.sheets.active
# except KeyError:
# wb.close()
# raise KeyError(f"工作表 '{sheet_name}' 不存在")
#
# # 读取表头(第三行)
# try:
# headers = sheet.range("3:3").value # 获取第三行所有值
# except Exception as e:
# wb.close()
# raise Exception(f"读取表头失败: {e}")
#
# # 确定列索引(转换为1-based列号)
# try:
# function_number_col = headers.index("功能编号") + 1
# test_result_col = headers.index("测试结果") + 1
# log_screenshot_col = headers.index("日志截图") + 1
# except ValueError as e:
# wb.close()
# raise ValueError(f"表头列缺失: {e}")
#
# # 遍历数据行(从第四行开始)
# last_row = sheet.used_range.last_cell.row
# found = False
# for row_number in range(4, last_row + 1):
# current_value = sheet.range((row_number, function_number_col)).value
# if str(current_value) == str(function_number):
# # 更新测试结果
# sheet.range((row_number, test_result_col)).value = test_result
#
# # 插入图片(如果存在)
# if log_screenshot and os.path.exists(log_screenshot):
# try:
# # 获取目标单元格
# cell = sheet.range((row_number, log_screenshot_col))
#
# # 插入图片并绑定到单元格
# pic = sheet.pictures.add(log_screenshot,
# left=cell.left,
# top=cell.top,
# width=cell.width,
# height=cell.height)
# pic.api.Placement = 3 # 设置为xlMoveAndSize模式
# except Exception as e:
# logging.error(f"插入图片失败: {e}")
# wb.close()
# raise
#
# found = True
# break
#
# if not found:
# wb.close()
# raise ValueError(f"未找到功能编号为 {function_number} 的行")
#
# # 保存并关闭
# try:
# wb.save()
# logging.info(f"文件 {xlsx_file_path} 已保存,数据已写入功能编号为 {function_number} 的行。")
# except Exception as e:
# logging.error(f"保存文件时出错: {e}")
# raise
# finally:
# wb.close()
\ No newline at end of file
......@@ -269,4 +269,6 @@
- 补充write_xlsx_data函数用以将测试结果与日志截图写入到xlsx测试用例文件中。调试write_xlsx_data函数与统一平台的窗口切换关闭。
72. 2025-03-24
- 优化write_xlsx_data函数实现表格自动填充测试结果和日志截图功能。
- 处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。
\ No newline at end of file
- 处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。
73. 2025-03-25
- 处理展厅巡检会议文件空问题,排查展厅巡检的讯飞系统转录,调试没有问题,正常转录成功。
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -146,6 +146,8 @@ class Exhibition_Meeting_Control_0001:
safe_click((By.XPATH, "//span[contains(text(),'提前结束')]"), wd)
sleep(2)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
safe_click((By.XPATH, "//button[@class='el-button el-button--default el-button--small el-button--primary ']//span[contains(text(),'确定')]"), wd)
except Exception as e:
......
......@@ -10,7 +10,7 @@ sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
class XF_Meeting_0001:
class XF_Meeting:
tags = ['展厅巡检','讯飞测试','讯飞转录流程测试']
def teststeps(self):
......@@ -45,7 +45,7 @@ class XF_Meeting_0001:
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "XF_Meeting", "查看讯飞转录界面")
# 获取转录文字
transfer_text = ""
transfer_text = elment_get_text((By.CSS_SELECTOR, ".result.sentences0"), wd)
transfer_text = elment_get_text((By.XPATH, "(//span[@class='result sentences0'])[1]"), wd)
INFO("讯飞语音转录文字:" + transfer_text)
# 判断转录文字是否为空
if transfer_text != "":
......
No preview for this file type
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论