提交 20c15596 authored 作者: 陈泽健's avatar 陈泽健

增加兰州项目定制自动化处理,调试兰州自动化的JSON数据运行。

上级 775f7c8c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyDocumentationSettings"> <component name="PyDocumentationSettings">
......
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"展厅讯飞系统巡检": "http://192.168.5.201:8080/#/login", "展厅讯飞系统巡检": "http://192.168.5.201:8080/#/login",
"长安大学预定测试环境": "https://192.168.5.186/#/login/logindf", "长安大学预定测试环境": "https://192.168.5.186/#/login/logindf",
"工商银行项目生产环境": "https://192.168.52.62:20443/#/login/logindf", "工商银行项目生产环境": "https://192.168.52.62:20443/#/login/logindf",
"统一平台测试环境": "http://192.168.5.164:38083/#/login" "统一平台测试环境": "http://192.168.5.164:38083/#/login",
"兰州中石化项目测试环境": "https://139.159.163.86/#/login/logindf"
} }
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -74,8 +74,12 @@ def browser_init(login_type): ...@@ -74,8 +74,12 @@ def browser_init(login_type):
# service = Service(ChromeDriverManager().install()) # service = Service(ChromeDriverManager().install())
# 手动指定ChromeDriver的路径 # 手动指定ChromeDriver的路径
# 自动化运行服务器的chromedriver路径: # 自动化运行服务器的chromedriver路径:
service = Service(r'C:\Users\29194\AppData\Local\Programs\Python\Python310\Scripts\chromedriver.exe') # 拯救者电脑
# service = Service(r'C:\Users\29194\AppData\Local\Programs\Python\Python310\Scripts\chromedriver.exe')
# EDY电脑
# service = Service(r'C:\Program Files\Python310\Scripts\chromedriver.exe') # service = Service(r'C:\Program Files\Python310\Scripts\chromedriver.exe')
# 云电脑
service = Service(r'E:\Python\Scripts\chromedriver.exe')
# 尝试创建WebDriver实例并执行初始化操作 # 尝试创建WebDriver实例并执行初始化操作
try: try:
# 创建WebDriver实例 # 创建WebDriver实例
......
...@@ -295,8 +295,10 @@ ...@@ -295,8 +295,10 @@
- 优化get_remote_log_with_paramiko函数,增加filter_word过滤词打印日志。 - 优化get_remote_log_with_paramiko函数,增加filter_word过滤词打印日志。
83. 2025-04-27 83. 2025-04-27
- 增加LogCollector类实现从服务器获取日志,在测试步骤开始前进行获取,到步骤测试结束后获取结束,输出为日志文本文件。 - 增加LogCollector类实现从服务器获取日志,在测试步骤开始前进行获取,到步骤测试结束后获取结束,输出为日志文本文件。
84. 2025-04-28 84. 2025-05-21
- 展厅预定系统更新了前后台分离,代码处理切换窗口操作。 - 展厅预定系统更新了前后台分离,代码处理切换窗口操作。
85. 2025-04-29 85. 2025-05-22
- 解决展厅桌牌系统定位错误问题,config.json文件增加展厅预定系统后台登录链接,优化桌牌的系统登录跳转。 - 解决展厅桌牌系统定位错误问题,config.json文件增加展厅预定系统后台登录链接,优化桌牌的系统登录跳转。
- 排查展厅门口的中控屏没有巡检截图的问题,排查后发现中控屏的软件包名与类名因为更新程序后不一样了,调整展厅中控屏初始化新的软件包名与类名。1 - 排查展厅门口的中控屏没有巡检截图的问题,排查后发现中控屏的软件包名与类名因为更新程序后不一样了,调整展厅中控屏初始化新的软件包名与类名。1
86. 2025-05-25:
- 增加兰州项目定制自动化处理,调试兰州自动化的JSON数据运行。
\ 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
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
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
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
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
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
No preview for this file type
No preview for this file type
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("兰州中石化项目测试环境")
user_login("admin", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
sleep(1)
def suite_teardown():
wd = GSTORE['wd']
wd.quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..' , '..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(预定系统_path, '测试数据', '兰州中石化项目测试用例.xlsx')
class ConferenceDeclaration:
tags = ['兰州中石化项目会议申报']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 兰州中石化项目会议申报测试报告 --report_url_prefix https://192.168.1.67 --tag 兰州中石化项目会议申报
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议申报',case_type="兰州中石化项目25-05-24")
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
# clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议创建', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行信息统计模块功能测试操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
name = self.name
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
INFO(f"页面: {page_type}、元素定位类型: {locator_type}、元素定位值: {locator_value}、元素类型: {element_type}、元素值: {element_value}、预期结果: {expented_result}")
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value))
INFO(f"获取到的提示信息为:{notify_text}")
sleep(2)
CHECK_POINT(f"获取到的提示信息为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "getText":
text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取到的文本信息为:{text}")
CHECK_POINT(f"获取到的文本信息为:{text}", expented_result in text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
No preview for this file type
File added
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论