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

处理截屏函数的兼容性,优化URL的判断。

上级 88f4e8d0
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
#构建当前项目路径 #构建当前项目路径
...@@ -38,4 +40,4 @@ class User_Login: ...@@ -38,4 +40,4 @@ class User_Login:
# 检查点:验证是否跟预定结果一致 # 检查点:验证是否跟预定结果一致
CHECK_POINT('校验提示内容是否跟预定结果一致', get_text == info) CHECK_POINT('校验提示内容是否跟预定结果一致', get_text == info)
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
#构建当前项目路径 #构建当前项目路径
...@@ -115,5 +117,5 @@ class UserAdd: ...@@ -115,5 +117,5 @@ class UserAdd:
CHECK_POINT('校验实际提示内容和预期提示内容是否一致', get_menu1 == info) CHECK_POINT('校验实际提示内容和预期提示内容是否一致', get_menu1 == info)
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -30,5 +33,5 @@ class Userquery: ...@@ -30,5 +33,5 @@ class Userquery:
CHECK_POINT('校验是否成功检索用户', get_username == "test_user1") CHECK_POINT('校验是否成功检索用户', get_username == "test_user1")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh() wd.refresh()
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -112,5 +115,5 @@ class UserModify001: ...@@ -112,5 +115,5 @@ class UserModify001:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -41,5 +44,5 @@ class Userdelete001: ...@@ -41,5 +44,5 @@ class Userdelete001:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh() wd.refresh()
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -76,7 +79,7 @@ class AreagroupAdd: ...@@ -76,7 +79,7 @@ class AreagroupAdd:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info ) CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info )
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -56,6 +59,6 @@ class AreagroupMod: ...@@ -56,6 +59,6 @@ class AreagroupMod:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -36,5 +39,5 @@ class AreagroupDel: ...@@ -36,5 +39,5 @@ class AreagroupDel:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -61,6 +64,6 @@ class AreatypeAdd: ...@@ -61,6 +64,6 @@ class AreatypeAdd:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info) CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info)
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -64,6 +67,6 @@ class AreatypeMod: ...@@ -64,6 +67,6 @@ class AreatypeMod:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -42,6 +45,6 @@ class AreatypeDel: ...@@ -42,6 +45,6 @@ class AreatypeDel:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -65,6 +68,6 @@ class AreafuntionAdd: ...@@ -65,6 +68,6 @@ class AreafuntionAdd:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info) CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info)
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -71,6 +74,6 @@ class areafuntionMod: ...@@ -71,6 +74,6 @@ class areafuntionMod:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
import sys import sys
import os import os
from hytest.common import DevOps_SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..'))) sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
...@@ -47,6 +50,6 @@ class areafuntionDel001: ...@@ -47,6 +50,6 @@ class areafuntionDel001:
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# 截图并保存 # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%") DevOps_SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1) sleep(1)
wd.refresh() wd.refresh()
\ No newline at end of file
...@@ -20,6 +20,7 @@ logging.basicConfig( ...@@ -20,6 +20,7 @@ logging.basicConfig(
- cd .\运维集控\项目测试\运维标准版\ - cd .\运维集控\项目测试\运维标准版\
- python -m http.server 80 --directory reports - python -m http.server 80 --directory reports
2.打开新终端输入: 2.打开新终端输入:
- cd .\运维集控\
- cd .\运维集控\项目测试\运维标准版\ngrok\ - cd .\运维集控\项目测试\运维标准版\ngrok\
- .\start.bat - .\start.bat
2.再打开一个终端输入: 2.再打开一个终端输入:
...@@ -68,7 +69,7 @@ start_workers(3) ...@@ -68,7 +69,7 @@ start_workers(3)
# 定义每天定时执行的任务 # 定义每天定时执行的任务
# 每天早上07:50执行后台系统设置功能测试 # 每天早上07:50执行后台系统设置功能测试
schedule.every().day.at("17:51").do(run_task, run_automation_test, report_title="运维系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31135", ding_type="标准版巡检") schedule.every().day.at("09:00").do(run_task, run_automation_test, report_title="运维系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31135", ding_type="标准版巡检")
try: try:
# 无限循环,持续检查并执行计划任务 # 无限循环,持续检查并执行计划任务
......
...@@ -80,8 +80,9 @@ def browser_init(login_type): ...@@ -80,8 +80,9 @@ def browser_init(login_type):
# 使用备用的ChromeDriver下载源 # 使用备用的ChromeDriver下载源
# service = Service(ChromeDriverManager().install()) # service = Service(ChromeDriverManager().install())
# 手动指定ChromeDriver的路径 # 手动指定ChromeDriver的路径
# 自动化运行服务器的chromedriver路径:C:\Program Files\Python310\Scripts\chromedriver.exe # 自动化运行服务器的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')
# service = Service(r'C:\Program Files\Python310\Scripts\chromedriver.exe')
# 尝试创建WebDriver实例并执行初始化操作 # 尝试创建WebDriver实例并执行初始化操作
try: try:
# 创建WebDriver实例 # 创建WebDriver实例
......
...@@ -176,4 +176,4 @@ ...@@ -176,4 +176,4 @@
- 调整截图文件的缩放比,实现测试报告点击图片弹窗放大功能。 - 调整截图文件的缩放比,实现测试报告点击图片弹窗放大功能。
42. 2025-01-16 42. 2025-01-16
- 优化browser_init初始化函数的传参方式以及系统环境判断处理。优化ngrok以及定时任务注解。 - 优化browser_init初始化函数的传参方式以及系统环境判断处理。优化ngrok以及定时任务注解。
- 调整优化 - 调整优化。处理截屏函数的兼容性,优化URL的判断。
\ No newline at end of file \ No newline at end of file
...@@ -28,7 +28,7 @@ class Main_User_Manage_000x: ...@@ -28,7 +28,7 @@ class Main_User_Manage_000x:
执行测试步骤以用户管理的主流程功能。 执行测试步骤以用户管理的主流程功能。
本函数根据参数添加用户,并使用新增的用户进行登录的提示信息是否与预期相符。 本函数根据参数添加用户,并使用新增的用户进行登录的提示信息是否与预期相符。
""" """
login_url = 'http://192.168.5.235:443/#/login/logindf' login_url = 'https://192.168.5.235/#/login/logindf'
# 初始化通知文本为空字符串 # 初始化通知文本为空字符串
notify_text = "" notify_text = ""
# 从全局存储中获取webdriver实例 # 从全局存储中获取webdriver实例
......
...@@ -35,7 +35,7 @@ class User_Chanage_Pwd_000x: ...@@ -35,7 +35,7 @@ class User_Chanage_Pwd_000x:
执行测试步骤以用户新增功能。 执行测试步骤以用户新增功能。
本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。 本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。
""" """
login_url = 'http://192.168.5.235:443/#/login/logindf' login_url = 'https://192.168.5.235/#/login/logindf'
# 初始化通知文本为空字符串 # 初始化通知文本为空字符串
notify_text = "" notify_text = ""
# 从全局存储中获取webdriver实例 # 从全局存储中获取webdriver实例
......
...@@ -98,7 +98,7 @@ class Add_User_000x: ...@@ -98,7 +98,7 @@ class Add_User_000x:
sleep(1) sleep(1)
if name == '用户新增_048': if name == '用户新增_048':
login_url = 'http://192.168.5.235:443/#/login/logindf' login_url = 'https://192.168.5.235/#/login/logindf'
# 清除浏览器,再重新打开浏览器 # 清除浏览器,再重新打开浏览器
wd.get(login_url) wd.get(login_url)
# 最大化浏览器窗口 # 最大化浏览器窗口
......
...@@ -96,7 +96,7 @@ class Query_User_000x: ...@@ -96,7 +96,7 @@ class Query_User_000x:
CHECK_POINT("检查搜索结果", query_text in check_text) CHECK_POINT("检查搜索结果", query_text in check_text)
if name == '用户查询_044': if name == '用户查询_044':
login_url = 'http://192.168.5.235:443/#/login/logindf' login_url = 'https://192.168.5.235/#/login/logindf'
# 清除浏览器,再重新打开浏览器 # 清除浏览器,再重新打开浏览器
wd.get(login_url) wd.get(login_url)
# 最大化浏览器窗口 # 最大化浏览器窗口
......
...@@ -123,7 +123,7 @@ class User_Status_000x: ...@@ -123,7 +123,7 @@ class User_Status_000x:
sleep(2) sleep(2)
if name == '用户状态设置_004': if name == '用户状态设置_004':
login_url = 'http://192.168.5.235:443/#/login/logindf' login_url = 'https://192.168.5.235/#/login/logindf'
# 清除浏览器,再重新打开浏览器 # 清除浏览器,再重新打开浏览器
wd.get(login_url) wd.get(login_url)
# 最大化浏览器窗口 # 最大化浏览器窗口
......
...@@ -69,10 +69,10 @@ def start_workers(num_workers): ...@@ -69,10 +69,10 @@ def start_workers(num_workers):
start_workers(3) start_workers(3)
# 定时执行预定系统测试任务 # 定时执行预定系统测试任务
# schedule.every().day.at("09:00").do(run_task, run_automation_test, report_title="预定系统_后台管理功能_测试报告", report_url_prefix="http://nat.ubainsyun.com:31134", test_case="预定系统功能", ding_type="标准版巡检") schedule.every().day.at("10:41").do(run_task, run_automation_test, report_title="预定系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31134", test_case="后台管理功能", ding_type="标准版巡检")
# 定时执行展厅巡检任务 # 定时执行展厅巡检任务
schedule.every().day.at("07:50").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检") # schedule.every().day.at("07:50").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
try: try:
# 无限循环,持续检查并执行计划任务 # 无限循环,持续检查并执行计划任务
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论