from time import sleep from hytest import * # 获取当前脚本的绝对路径 current_dir = os.path.dirname(os.path.abspath(__file__)) # 构建预定系统的绝对路径 预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..')) # 添加路径 sys.path.append(预定系统_path) # 导入模块 try: from 预定系统.Base.base import * except ModuleNotFoundError as e: print(f"ModuleNotFoundError: {e}") print("尝试使用绝对路径导入") from 预定系统.Base.base import * # 获取当前脚本所在的目录 current_dir = os.path.dirname(os.path.abspath(__file__)) # 构建CSV文件的绝对路径 csv_file_path = os.path.join(current_dir, '../../测试数据/系统设置模块/系统设置.csv') class System_Setting_000x: tags = ['系统设置功能'] """ 执行指令: 1.cd 预定系统 2.hytest --report_title 系统设置测试报告 --test 系统设置_001 """ ddt_cases = read_csv_data(csv_file_path) def teststeps(self): """ 执行测试步骤以用户新增功能。 本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。 """ # 初始化通知文本为空字符串 notify_fastdfs_text = "" notify_mysql_text = "" notify_redis_text = "" version_qianduan_text = "" version_houdaun_text = "" # 从全局存储中获取webdriver实例 wd = GSTORE['wd'] name = self.name check_text = self.para STEP(1, "检查fastDFS服务运行是否正常") sleep(3) notify_fastdfs_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[1]"), wd) notify_mysql_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[2]"),wd) notify_redis_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[3]"),wd) INFO(f"fastDFS状态:{notify_fastdfs_text},mysql状态:{notify_mysql_text},redis状态:{notify_redis_text}") version_qianduan_text = elment_get_text((By.XPATH,"/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[4]/div[1]/div/div"), wd) version_houdaun_text = elment_get_text((By.XPATH,"/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[5]/div[1]/div/div"), wd) INFO(f"前端版本:{version_qianduan_text},后端版本:{version_houdaun_text}") CHECK_POINT("检查fastDFS服务运行", check_text in notify_fastdfs_text) CHECK_POINT("检查mysql服务运行", check_text in notify_mysql_text) CHECK_POINT("检查redis服务运行", check_text in notify_redis_text)