提交 b4b549d4 authored 作者: 彭甘宇's avatar 彭甘宇

实现成都太行其他模块功能的单个用例自动化;

上级 f68da190
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建统一平台的绝对路径
platform_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(platform_path)
# 导入模块
from 统一平台.base.bases import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', 'data', '统一平台PC端测试用例.xlsx')
class Unified_Platform_0001:
#执行指令:
# cd ./统一平台/
# hytest --tag 成都太行
tags = ['个人日程','成都太行']
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name="个人日程&")
def teststeps(self):
wd = GSTORE['wd']
name = self.name
wd.refresh()
for step in self.para:
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
print(f"执行JSON:{step}")
# # 添加刷新页面的判断
# if element_type == "refresh":
# wd.refresh()
if step.get("page") == "PersonalSchedule":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
elif element_type == "getText":
# 获取提示文本
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取弹窗提示内容为:{notify_text}")
CHECK_POINT("判断是否跟预期一致", expented_result == notify_text)
SELENIUM_LOG_SCREEN(wd, "50%")
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建统一平台的绝对路径
platform_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(platform_path)
# 导入模块
from 统一平台.base.bases import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', 'data', '统一平台PC端测试用例.xlsx')
class Unified_Platform_0001:
#执行指令:
# cd ./统一平台/
# hytest --tag 成都太行
tags = ['会议室日历','成都太行']
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name="会议室日历")
def teststeps(self):
wd = GSTORE['wd']
name = self.name
wd.refresh()
for step in self.para:
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
print(f"执行JSON:{step}")
# # 添加刷新页面的判断
# if element_type == "refresh":
# wd.refresh()
if step.get("page") == "MeetingRoomCalendar":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
elif element_type == "getText":
# 获取提示文本
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取弹窗提示内容为:{notify_text}")
CHECK_POINT("判断是否跟预期一致", expented_result == notify_text)
SELENIUM_LOG_SCREEN(wd, "50%")
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建统一平台的绝对路径
platform_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(platform_path)
# 导入模块
from 统一平台.base.bases import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', 'data', '统一平台PC端测试用例.xlsx')
class Unified_Platform_0001:
#执行指令:
# cd ./统一平台/
# hytest --tag 成都太行
tags = ['数据统计','成都太行']
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name="数据统计")
def teststeps(self):
wd = GSTORE['wd']
name = self.name
wd.refresh()
for step in self.para:
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
print(f"执行JSON:{step}")
# # 添加刷新页面的判断
# if element_type == "refresh":
# wd.refresh()
if step.get("page") == "StatisticsModule":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
elif element_type == "getText":
# 获取提示文本
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取弹窗提示内容为:{notify_text}")
CHECK_POINT("判断是否跟预期一致", expented_result == notify_text)
SELENIUM_LOG_SCREEN(wd, "50%")
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建统一平台的绝对路径
platform_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(platform_path)
# 导入模块
from 统一平台.base.bases import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', 'data', '统一平台PC端测试用例.xlsx')
class Unified_Platform_0001:
#执行指令:
# cd ./统一平台/
# hytest --tag 成都太行
tags = ['会议室管理','成都太行']
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name="会议室管理&")
def teststeps(self):
wd = GSTORE['wd']
name = self.name
wd.refresh()
for step in self.para:
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
print(f"执行JSON:{step}")
# # 添加刷新页面的判断
# if element_type == "refresh":
# wd.refresh()
if step.get("page") == "MeetingRoomSetting":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
elif element_type == "getText":
# 获取提示文本
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取弹窗提示内容为:{notify_text}")
CHECK_POINT("判断是否跟预期一致", expented_result == notify_text)
SELENIUM_LOG_SCREEN(wd, "50%")
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建统一平台的绝对路径
platform_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(platform_path)
# 导入模块
from 统一平台.base.bases import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', 'data', '统一平台PC端测试用例.xlsx')
class Unified_Platform_0001:
#执行指令:
# cd ./统一平台/
# hytest --tag 成都太行
tags = ['用户管理','成都太行']
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name="用户管理")
def teststeps(self):
wd = GSTORE['wd']
name = self.name
wd.refresh()
for step in self.para:
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
print(f"执行JSON:{step}")
# # 添加刷新页面的判断
# if element_type == "refresh":
# wd.refresh()
if step.get("page") == "UserManage":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
elif element_type == "getText":
# 获取提示文本
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取弹窗提示内容为:{notify_text}")
CHECK_POINT("判断是否跟预期一致", expented_result == notify_text)
SELENIUM_LOG_SCREEN(wd, "50%")
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论