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

增加测试数据和测试报告截图输出。

上级 b789fc6f
<changelist name="在进行更新之前于_2024_12_25_15_22_取消提交了更改_[更改]" date="1735111481056" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/在进行更新之前于_2024_12_25_15_22_取消提交了更改_[更改]/shelved.patch" />
<option name="DESCRIPTION" value="在进行更新之前于 2024/12/25 15:22 取消提交了更改 [更改]" />
</changelist>
\ No newline at end of file
<changelist name="在进行更新之前于_2024_12_25_15_28_取消提交了更改_[更改]" date="1735111722258" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/在进行更新之前于_2024_12_25_15_28_取消提交了更改_[更改]/shelved.patch" />
<option name="DESCRIPTION" value="在进行更新之前于 2024/12/25 15:28 取消提交了更改 [更改]" />
</changelist>
\ No newline at end of file
Index: .idea/workspace.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project version=\"4\">\r\n <component name=\"AutoImportSettings\">\r\n <option name=\"autoReloadType\" value=\"SELECTIVE\" />\r\n </component>\r\n <component name=\"ChangeListManager\">\r\n <list default=\"true\" id=\"7af2ddda-4337-4bd9-adfd-87ab868c08f9\" name=\"更改\" comment=\"重新提交运维相关脚本代码\">\r\n <change beforePath=\"$PROJECT_DIR$/.idea/misc.xml\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/.idea/misc.xml\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/.idea/workspace.xml\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/.idea/workspace.xml\" afterDir=\"false\" />\r\n </list>\r\n <option name=\"SHOW_DIALOG\" value=\"false\" />\r\n <option name=\"HIGHLIGHT_CONFLICTS\" value=\"true\" />\r\n <option name=\"HIGHLIGHT_NON_ACTIVE_CHANGELIST\" value=\"false\" />\r\n <option name=\"LAST_RESOLUTION\" value=\"IGNORE\" />\r\n </component>\r\n <component name=\"Git.Settings\">\r\n <option name=\"RECENT_GIT_ROOT_PATH\" value=\"$PROJECT_DIR$\" />\r\n <option name=\"UPDATE_TYPE\" value=\"REBASE\" />\r\n </component>\r\n <component name=\"ProjectColorInfo\">{\r\n &quot;associatedIndex&quot;: 6\r\n}</component>\r\n <component name=\"ProjectId\" id=\"2qefK5jFULEB70ZGZl73iacPsCN\" />\r\n <component name=\"ProjectViewState\">\r\n <option name=\"hideEmptyMiddlePackages\" value=\"true\" />\r\n <option name=\"showLibraryContents\" value=\"true\" />\r\n </component>\r\n <component name=\"PropertiesComponent\">{\r\n &quot;keyToString&quot;: {\r\n &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,\r\n &quot;git-widget-placeholder&quot;: &quot;develop&quot;,\r\n &quot;last_opened_file_path&quot;: &quot;C:/Users/EDY/Desktop/git/ubains-module-test/ubains-module-test&quot;\r\n }\r\n}</component>\r\n <component name=\"SharedIndexes\">\r\n <attachedChunks>\r\n <set>\r\n <option value=\"bundled-python-sdk-6a3326d57233-c546a90a8094-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-242.24807.21\" />\r\n </set>\r\n </attachedChunks>\r\n </component>\r\n <component name=\"SpellCheckerSettings\" RuntimeDictionaries=\"0\" Folders=\"0\" CustomDictionaries=\"0\" DefaultDictionary=\"应用程序级\" UseSingleDictionary=\"true\" transferred=\"true\" />\r\n <component name=\"TaskManager\">\r\n <task active=\"true\" id=\"Default\" summary=\"默认任务\">\r\n <changelist id=\"7af2ddda-4337-4bd9-adfd-87ab868c08f9\" name=\"更改\" comment=\"\" />\r\n <created>1735027895112</created>\r\n <option name=\"number\" value=\"Default\" />\r\n <option name=\"presentableId\" value=\"Default\" />\r\n <updated>1735027895112</updated>\r\n </task>\r\n <task id=\"LOCAL-00001\" summary=\"重新提交运维相关脚本代码\">\r\n <option name=\"closed\" value=\"true\" />\r\n <created>1735028100490</created>\r\n <option name=\"number\" value=\"00001\" />\r\n <option name=\"presentableId\" value=\"LOCAL-00001\" />\r\n <option name=\"project\" value=\"LOCAL\" />\r\n <updated>1735028100490</updated>\r\n </task>\r\n <option name=\"localTasksCounter\" value=\"2\" />\r\n <servers />\r\n </component>\r\n <component name=\"Vcs.Log.Tabs.Properties\">\r\n <option name=\"TAB_STATES\">\r\n <map>\r\n <entry key=\"MAIN\">\r\n <value>\r\n <State>\r\n <option name=\"FILTERS\">\r\n <map>\r\n <entry key=\"branch\">\r\n <value>\r\n <list>\r\n <option value=\"develop\" />\r\n </list>\r\n </value>\r\n </entry>\r\n </map>\r\n </option>\r\n </State>\r\n </value>\r\n </entry>\r\n </map>\r\n </option>\r\n </component>\r\n <component name=\"VcsManagerConfiguration\">\r\n <MESSAGE value=\"重新提交运维相关脚本代码\" />\r\n <option name=\"LAST_COMMIT_MESSAGE\" value=\"重新提交运维相关脚本代码\" />\r\n </component>\r\n</project>
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
--- a/.idea/workspace.xml (revision b57d56b8584255c28e848a0ed183e36a51541a57)
+++ b/.idea/workspace.xml (date 1735111282242)
@@ -4,11 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="7af2ddda-4337-4bd9-adfd-87ab868c08f9" name="更改" comment="重新提交运维相关脚本代码">
- <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py" beforeDir="false" afterPath="$PROJECT_DIR$/运维集控/项目测试/运维标准版/cases/05区域功能/01新增区域功能.py" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/.idea/workspace.xml" afterDir="false" />
- </list>
+ <list default="true" id="7af2ddda-4337-4bd9-adfd-87ab868c08f9" name="更改" comment="修正提交" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -16,12 +12,14 @@
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
- <option name="UPDATE_TYPE" value="REBASE" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2qefK5jFULEB70ZGZl73iacPsCN" />
+ <component name="ProjectLevelVcsManager">
+ <OptionsSetting value="false" id="Update" />
+ </component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
@@ -57,7 +55,15 @@
<option name="project" value="LOCAL" />
<updated>1735028100490</updated>
</task>
- <option name="localTasksCounter" value="2" />
+ <task id="LOCAL-00002" summary="修正提交">
+ <option name="closed" value="true" />
+ <created>1735111241853</created>
+ <option name="number" value="00002" />
+ <option name="presentableId" value="LOCAL-00002" />
+ <option name="project" value="LOCAL" />
+ <updated>1735111241853</updated>
+ </task>
+ <option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@@ -85,6 +91,7 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="重新提交运维相关脚本代码" />
- <option name="LAST_COMMIT_MESSAGE" value="重新提交运维相关脚本代码" />
+ <MESSAGE value="修正提交" />
+ <option name="LAST_COMMIT_MESSAGE" value="修正提交" />
</component>
</project>
\ No newline at end of file
Index: .idea/workspace.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project version=\"4\">\r\n <component name=\"AutoImportSettings\">\r\n <option name=\"autoReloadType\" value=\"SELECTIVE\" />\r\n </component>\r\n <component name=\"ChangeListManager\">\r\n <list default=\"true\" id=\"923e4366-b26b-44a4-9a8e-7655702750f8\" name=\"更改\" comment=\"\">\r\n <change beforePath=\"$PROJECT_DIR$/.idea/workspace.xml\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/.idea/workspace.xml\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/README.md\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/README.md\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/cases/会议历史记录/01历史记录筛选.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/cases/会议历史记录/01历史记录筛选.py\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/cases/会议历史记录/02历史记录再次预定.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/cases/会议历史记录/02历史记录再次预定.py\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/cases/会议审批/01审批会议创建.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/cases/会议审批/01审批会议创建.py\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/cases/会议模板/01会议模板查询.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/cases/会议模板/01会议模板查询.py\" afterDir=\"false\" />\r\n <change beforePath=\"$PROJECT_DIR$/预定系统/cases/会议模板/02会议模板再次预定.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/预定系统/cases/会议模板/02会议模板再次预定.py\" afterDir=\"false\" />\r\n </list>\r\n <option name=\"SHOW_DIALOG\" value=\"false\" />\r\n <option name=\"HIGHLIGHT_CONFLICTS\" value=\"true\" />\r\n <option name=\"HIGHLIGHT_NON_ACTIVE_CHANGELIST\" value=\"false\" />\r\n <option name=\"LAST_RESOLUTION\" value=\"IGNORE\" />\r\n </component>\r\n <component name=\"FileTemplateManagerImpl\">\r\n <option name=\"RECENT_TEMPLATES\">\r\n <list>\r\n <option value=\"Python Script\" />\r\n </list>\r\n </option>\r\n </component>\r\n <component name=\"Git.Settings\">\r\n <option name=\"RECENT_GIT_ROOT_PATH\" value=\"$PROJECT_DIR$\" />\r\n </component>\r\n <component name=\"ProjectColorInfo\"><![CDATA[{\r\n \"customColor\": \"\",\r\n \"associatedIndex\": 0\r\n}]]></component>\r\n <component name=\"ProjectId\" id=\"2qel6dw2JSIg22RV44sfGJ83Ng2\" />\r\n <component name=\"PropertiesComponent\"><![CDATA[{\r\n \"keyToString\": {\r\n \"Python.安卓信息-消息监听.executor\": \"Run\",\r\n \"git-widget-placeholder\": \"develop\",\r\n \"last_opened_file_path\": \"D:/GithubData/自动化/ubains-module-test/预定系统/cases/会议审批\",\r\n \"node.js.detected.package.eslint\": \"true\",\r\n \"node.js.detected.package.tslint\": \"true\",\r\n \"node.js.selected.package.eslint\": \"(autodetect)\",\r\n \"node.js.selected.package.tslint\": \"(autodetect)\"\r\n }\r\n}]]></component>\r\n <component name=\"RecentsManager\">\r\n <key name=\"CopyFile.RECENT_KEYS\">\r\n <recent name=\"D:\\GithubData\\自动化\\ubains-module-test\\预定系统\\cases\\会议审批\" />\r\n <recent name=\"D:\\GithubData\\自动化\\ubains-module-test\\预定系统\\测试数据\\会议模板\" />\r\n <recent name=\"D:\\GithubData\\自动化\\ubains-module-test\\预定系统\\测试数据\\会议历史记录\" />\r\n </key>\r\n </component>\r\n <component name=\"RunManager\">\r\n <configuration name=\"安卓信息-消息监听\" type=\"PythonConfigurationType\" factoryName=\"Python\" temporary=\"true\" nameIsGenerated=\"true\">\r\n <module name=\"ubains-module-test\" />\r\n <option name=\"ENV_FILES\" value=\"\" />\r\n <option name=\"INTERPRETER_OPTIONS\" value=\"\" />\r\n <option name=\"PARENT_ENVS\" value=\"true\" />\r\n <envs>\r\n <env name=\"PYTHONUNBUFFERED\" value=\"1\" />\r\n </envs>\r\n <option name=\"SDK_HOME\" value=\"\" />\r\n <option name=\"WORKING_DIRECTORY\" value=\"$PROJECT_DIR$/预定系统/cases/设备管理\" />\r\n <option name=\"IS_MODULE_SDK\" value=\"true\" />\r\n <option name=\"ADD_CONTENT_ROOTS\" value=\"true\" />\r\n <option name=\"ADD_SOURCE_ROOTS\" value=\"true\" />\r\n <EXTENSION ID=\"PythonCoverageRunConfigurationExtension\" runner=\"coverage.py\" />\r\n <option name=\"SCRIPT_NAME\" value=\"$PROJECT_DIR$/预定系统/cases/设备管理/安卓信息-消息监听.py\" />\r\n <option name=\"PARAMETERS\" value=\"\" />\r\n <option name=\"SHOW_COMMAND_LINE\" value=\"false\" />\r\n <option name=\"EMULATE_TERMINAL\" value=\"false\" />\r\n <option name=\"MODULE_MODE\" value=\"false\" />\r\n <option name=\"REDIRECT_INPUT\" value=\"false\" />\r\n <option name=\"INPUT_FILE\" value=\"\" />\r\n <method v=\"2\" />\r\n </configuration>\r\n <recent_temporary>\r\n <list>\r\n <item itemvalue=\"Python.安卓信息-消息监听\" />\r\n </list>\r\n </recent_temporary>\r\n </component>\r\n <component name=\"TaskManager\">\r\n <servers />\r\n </component>\r\n <component name=\"com.intellij.coverage.CoverageDataManagerImpl\">\r\n <SUITE FILE_PATH=\"coverage/ubains_module_test$_.coverage\" NAME=\"安卓信息-消息监听 覆盖结果\" MODIFIED=\"1735034725544\" SOURCE_PROVIDER=\"com.intellij.coverage.DefaultCoverageFileProvider\" RUNNER=\"coverage.py\" COVERAGE_BY_TEST_ENABLED=\"false\" COVERAGE_TRACING_ENABLED=\"false\" WORKING_DIRECTORY=\"$PROJECT_DIR$/预定系统/cases/设备管理\" />\r\n </component>\r\n</project>
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
--- a/.idea/workspace.xml (revision a74bfa17dd939dc6790e420e64b1e73aba2262d4)
+++ b/.idea/workspace.xml (date 1735111706578)
@@ -4,15 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="923e4366-b26b-44a4-9a8e-7655702750f8" name="更改" comment="">
- <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/README.md" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/cases/会议历史记录/01历史记录筛选.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/会议历史记录/01历史记录筛选.py" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/cases/会议历史记录/02历史记录再次预定.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/会议历史记录/02历史记录再次预定.py" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/cases/会议审批/01审批会议创建.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/会议审批/01审批会议创建.py" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/cases/会议模板/01会议模板查询.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/会议模板/01会议模板查询.py" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/预定系统/cases/会议模板/02会议模板再次预定.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/会议模板/02会议模板再次预定.py" afterDir="false" />
- </list>
+ <list default="true" id="923e4366-b26b-44a4-9a8e-7655702750f8" name="更改" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/测试数据/登录用户数据.csv" charset="GBK" />
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="W292" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N812" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/运维标准版.iml" filepath="$PROJECT_DIR$/.idea/运维标准版.iml" />
</modules>
</component>
</project>
\ No newline at end of file
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
#构建当前项目路径
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
# 构建 CSV 文件的绝对路径
csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '01登录模块', '登录信息.csv'))
class User_Login:
tags = ['用户登录','管理员登录']
#构建框架的数据集格式
ddt_cases = read_csv_data(csv_path)
class user_login_001:
name = 'login_test_01'
def teststeps(self): def teststeps(self):
# 获取 WebDriver 实例
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取 CSV 文件 #从self.para中解构出数据
csv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '01登录模块', '登录信息.csv')) name = self.name
username, password, captcha, info= self.para
with open(csv_path, newline='', encoding='utf-8') as csvfile: # 记录当前测试步骤:用户登录
reader = csv.DictReader(csvfile) STEP(1, f'{username} 用户登录测试')
for row in reader: # 使用从 CSV 读取的数据进行登录
username = row['username']
password = row['password']
captcha = row['captcha']
STEP(1, f'用户 {username} 登录')
user_login(username, password, captcha) user_login(username, password, captcha)
STEP(2, '验证是否登录成功') #记录当前测试步骤:输出提示内容
try: STEP(2, f'预期提示内容为:{info}')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) # 记录当前测试步骤:验证是否登录成功
STEP(3, '获取登录提示内容')
# 等待系统首页的特定元素(如图片)可见
get_menu = WebDriverWait(wd, 5).until(
EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']"))
) )
get_menu1 = get_menu.text get_text = get_menu.text
CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
except Exception as e: # 检查点:验证是否跟预定结果一致
print(f"登录失败,原因是: {get_menu1}") CHECK_POINT('校验提示内容是否跟预定结果一致', get_text == info)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
#构建当前项目路径
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
# 构建 CSV 文件的绝对路径
csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '02用户管理', '新增用户.csv'))
class UserAdd:
tags = ['新增用户']
#构建框架的数据集格式
ddt_cases = read_csv_data(csv_path)
class UserAdd001:
name = 'user_add_001'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
#从self.para中解构出数据
name = self.name
account, user_name, new_passwd, comfire_passwd, authority, user_number, phone, email, remark, info= self.para
STEP(1, '点击新增按钮') STEP(1, '点击新增按钮')
user_add = WebDriverWait(wd, 10).until( user_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]")) EC.element_to_be_clickable(
(By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
) )
user_add.click() user_add.click()
sleep(2) sleep(2)
STEP(2, '填写登录名') STEP(2, f'填写登录名: {account}')
account_input = WebDriverWait(wd, 10).until( account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='登录名以字母开头,长度在5-18之间,只能包含字母、数字和下划线、@']")) EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='登录名以字母开头,长度在5-18之间,只能包含字母、数字和下划线、@']"))
) )
account_input.clear() account_input.clear()
account_input.send_keys("admin@test1") account_input.send_keys(account)
STEP(3, '填写用户名称') STEP(3, f'填写用户名称: {user_name}')
account_name_input = WebDriverWait(wd, 10).until( user_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']")) EC.presence_of_element_located(
(By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']"))
) )
account_name_input.clear() user_name_input.clear()
account_name_input.send_keys("admin@test1") user_name_input.send_keys(user_name)
STEP(4, '填写新密码') STEP(4, f'填写新的密码: {new_passwd}')
passwd_input = WebDriverWait(wd, 10).until( new_passwd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']")) (By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']"))
) )
passwd_input.clear() new_passwd_input.clear()
passwd_input.send_keys("ub@123456") new_passwd_input.send_keys(new_passwd)
STEP(5, '填写确认密码') STEP(5, f'填写确认密码: {comfire_passwd}')
sepasswd_input = WebDriverWait(wd, 10).until( comfire_passwd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请确认密码']")) (By.XPATH, "//input[@placeholder='请确认密码']"))
) )
sepasswd_input.clear() comfire_passwd_input.clear()
sepasswd_input.send_keys("ub@123456") comfire_passwd_input.send_keys(comfire_passwd)
STEP(6, f'选择权限: {authority}')
authority_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//span[@class='el-radio__label'][contains(text(),'普通用户')]"))
)
authority_select.click()
STEP(7, f'填写用户工号: {user_number}')
user_number_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请输入工号']"))
)
user_number_input.clear()
user_number_input.send_keys(user_number)
STEP(6, '点击确认') STEP(8, f'填写手机号: {phone}')
phone_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请输入手机号码']"))
)
phone_input.clear()
phone_input.send_keys(phone)
STEP(9, f'填写邮箱: {email}')
email_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请输入邮箱']"))
)
email_input.clear()
email_input.send_keys(email)
STEP(10, f'填写备注: {remark}')
remark_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='备注']"))
)
remark_input.clear()
remark_input.send_keys(remark)
STEP(11, '点击“确认”按钮')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]")) EC.element_to_be_clickable(
(By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]"))
) )
commit.click() commit.click()
STEP(7, '验证是否新增成功') STEP(12, f'预期提示内容为:{info}')
STEP(13, '获取页面实际提示内容')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']")) EC.visibility_of_element_located(
(By.XPATH, "//p[@class='el-message__content']"))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
INFO(get_menu1)
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
# class UserAdd002: CHECK_POINT('校验实际提示内容和预期提示内容是否一致', get_menu1 == info)
# name = 'user_add_002' # 截图并保存
# def teststeps(self): SELENIUM_LOG_SCREEN(wd, "50%")
# wd = GSTORE['wd'] wd.refresh()
# \ No newline at end of file
# STEP(1, '点击新增按钮')
# user_add = WebDriverWait(wd, 10).until(
# EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
# )
# user_add.click()
# sleep(2)
#
# STEP(2, '填写登录名')
# account_input = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located((By.XPATH, "//input[@placeholder='登录名以字母开头,长度在5-18之间,只能包含字母、数字和下划线、@']"))
# )
# account_input.clear()
# account_input.send_keys("admin@test1")
#
# STEP(3, '填写用户名称')
# account_name_input = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']"))
# )
# account_name_input.clear()
# account_name_input.send_keys("测试用户2")
#
# STEP(4, '填写新密码')
# passwd_input = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located(
# (By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']"))
# )
# passwd_input.clear()
# passwd_input.send_keys("ub@123456")
#
# STEP(5, '填写确认密码')
# sepasswd_input = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located(
# (By.XPATH, "//input[@placeholder='请确认密码']"))
# )
# sepasswd_input.clear()
# sepasswd_input.send_keys("ub@123456")
#
# STEP(6, '点击确认')
# commit = WebDriverWait(wd, 10).until(
# EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]"))
# )
# commit.click()
#
# STEP(7, '验证是否正常提示')
# get_menu = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
# )
# get_menu1 = get_menu.text
# # CHECK_POINT('检查是否出现错误提示弹窗', get_menu1 == "登录名已存在,请重新输入")
# CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
# sleep(2)
...@@ -4,8 +4,8 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '. ...@@ -4,8 +4,8 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '.
from 运维集控.项目测试.运维标准版.lib.base import * from 运维集控.项目测试.运维标准版.lib.base import *
class Userquery001: class Userquery:
name = 'user_query_001' name = 'user_query'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
...@@ -14,23 +14,21 @@ class Userquery001: ...@@ -14,23 +14,21 @@ class Userquery001:
EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']")) EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']"))
) )
user_query.click() user_query.click()
sleep(2)
STEP(2, '填写登录名') STEP(2, '填写登录名')
account_input = WebDriverWait(wd, 10).until( account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入用户名称']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入用户名称']"))
) )
account_input.clear() account_input.clear()
account_input.send_keys("admin@test1") account_input.send_keys("test_user1")
STEP(3, '校验是否成功检索用户') STEP(3, '校验是否成功检索用户')
get_user = WebDriverWait(wd, 10).until( get_user = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[normalize-space()='admin@test1']")) EC.presence_of_element_located((By.XPATH, "//div[normalize-space()='test_user1']"))
) )
get_username = get_user.text get_username = get_user.text
CHECK_POINT('校验是否成功检索用户', get_username == "admin@test1") CHECK_POINT('校验是否成功检索用户', get_username == "test_user1")
sleep(2)
# 截图并保存
# 调用钉钉输出测试报告 SELENIUM_LOG_SCREEN(wd, "50%")
# get_reportfile_send_dingding("123213_测试报告", "http://192.168.1.251") wd.refresh()
\ No newline at end of file
...@@ -13,40 +13,31 @@ class UserModify001: ...@@ -13,40 +13,31 @@ class UserModify001:
user_query = WebDriverWait(wd, 10).until( user_query = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']")) EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']"))
) )
user_query.click() user_query.clear()
sleep(2) user_query.send_keys("test_user1")
STEP(2, '填写登录名')
account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入用户名称']"))
)
account_input.clear()
account_input.send_keys("admin@test1")
STEP(3, '勾选用户') STEP(2, '勾选用户')
select_click= WebDriverWait(wd, 10).until( select_click= WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//tbody//tr//td//div//label//span//span")) EC.presence_of_element_located((By.XPATH, "//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"))
) )
select_click.click() select_click.click()
sleep(2)
STEP(4, '点击编辑按钮') STEP(3, '点击编辑按钮')
user_update = WebDriverWait(wd, 10).until( user_update = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[contains(@class,'company-edmit-right')]//span[contains(text(),'编辑')]")) EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'编辑')]"))
) )
user_update.click() user_update.click()
sleep(2)
STEP(5, '填写用户名称') STEP(4, '修改用户名称')
account_name_input = WebDriverWait(wd, 10).until( account_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']")) EC.presence_of_element_located((By.XPATH, "//div[contains(@class,'dialog-input')]//input[contains(@placeholder,'请输入用户名称')]"))
) )
account_name_input.clear() account_name_input.clear()
account_name_input.send_keys("admin@update") account_name_input.send_keys("test_update")
STEP(6, '勾选修改密码按钮') STEP(5, '勾选修改密码按钮')
user_passwd_click = WebDriverWait(wd, 10).until( user_passwd_click = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[contains(@class,'dialog-input')]//span[contains(@class,'el-checkbox__inner')]")) EC.element_to_be_clickable((By.XPATH, "//span[@class='el-checkbox__label']"))
) )
user_passwd_click.click() user_passwd_click.click()
sleep(2) sleep(2)
...@@ -54,7 +45,7 @@ class UserModify001: ...@@ -54,7 +45,7 @@ class UserModify001:
STEP(6, '填写当前用户密码') STEP(6, '填写当前用户密码')
current_passwd = WebDriverWait(wd, 10).until( current_passwd = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[contains(@placeholder,'请输当前登录用户的密码')]")) (By.XPATH, "//input[@placeholder='请输当前登录用户的密码']"))
) )
current_passwd.clear() current_passwd.clear()
current_passwd.send_keys("ub@123456") current_passwd.send_keys("ub@123456")
...@@ -62,7 +53,7 @@ class UserModify001: ...@@ -62,7 +53,7 @@ class UserModify001:
STEP(7, '填写新密码') STEP(7, '填写新密码')
newpasswd = WebDriverWait(wd, 10).until( newpasswd = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[contains(@placeholder,'必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符')]")) (By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']"))
) )
newpasswd.clear() newpasswd.clear()
newpasswd.send_keys("ub@12345678") newpasswd.send_keys("ub@12345678")
...@@ -109,14 +100,17 @@ class UserModify001: ...@@ -109,14 +100,17 @@ class UserModify001:
STEP(12, '点击确认') STEP(12, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[contains(@aria-label,'编辑')]//span[contains(text(),'确 定')]")) EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='编辑']//span[contains(text(),'确 定')]"))
) )
commit.click() commit.click()
STEP(13, '验证是否编辑成功') STEP(13, '验证是否编辑成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']")) EC.visibility_of_element_located((By.XPATH, "//p[contains(@class,'el-message__content')]"))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh()
\ No newline at end of file
...@@ -12,29 +12,20 @@ class Userdelete001: ...@@ -12,29 +12,20 @@ class Userdelete001:
user_query = WebDriverWait(wd, 10).until( user_query = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']")) EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='请输入用户名称']"))
) )
user_query.click() user_query.clear()
sleep(2) user_query.send_keys("test_user3")
STEP(2, '填写登录名') STEP(2, '勾选用户')
account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='请输入用户名称']"))
)
account_input.clear()
account_input.send_keys("admin@test1")
STEP(3, '勾选用户')
select_click= WebDriverWait(wd, 10).until( select_click= WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//tbody//tr//td//div//label//span//span")) EC.presence_of_element_located((By.XPATH, "//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"))
) )
select_click.click() select_click.click()
sleep(2)
STEP(4, '点击删除按钮') STEP(4, '点击删除按钮')
user_update = WebDriverWait(wd, 10).until( user_update = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'删除')]")) EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'删除')]"))
) )
user_update.click() user_update.click()
sleep(2)
STEP(5, '点击确认') STEP(5, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
...@@ -42,16 +33,13 @@ class Userdelete001: ...@@ -42,16 +33,13 @@ class Userdelete001:
) )
commit.click() commit.click()
STEP(6, '验证是否删除成功') STEP(6, '验证是否删除成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']")) EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']"))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
# 本地启动http微服务 # 截图并保存
# python - m http.server 80 - -directory log SELENIUM_LOG_SCREEN(wd, "50%")
# 输出报告到钉钉 wd.refresh()
get_reportfile_send_dingding("用户管理模块_测试报告", "http://192.168.1.251")
\ No newline at end of file
...@@ -8,10 +8,13 @@ def suite_setup(): ...@@ -8,10 +8,13 @@ def suite_setup():
user_login("admin@pgy", "ub@123456", "csba") user_login("admin@pgy", "ub@123456", "csba")
enter_system() enter_system()
enter_manage() enter_manage()
enter_user_manage() enter_user_manage() # 修正缩进
# def suite_teardown(): def suite_teardown():
# INFO('进行清除操作') wd = GSTORE['wd']
# wd = GSTORE['wd'] wd.quit()
# wd.quit()
# 本地启动http微服务
# python - m http.server 80 - -directory log
# 输出报告到钉钉
# get_reportfile_send_dingding("用户管理模块_测试报告", "http://192.168.1.251")
...@@ -3,39 +3,64 @@ import os ...@@ -3,39 +3,64 @@ import os
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 *
class AreagroupAdd001: #构建当前项目路径
name = 'Areagroup_add_001' sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
# 构建 CSV 文件的绝对路径
csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '03区域分组', '新增区域分组.csv'))
class AreagroupAdd:
tag = ['新增区域分组']
ddt_cases = read_csv_data(csv_path)
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
# 从self.para中解构出数据
name = self.name
area_group, group_name, group_address, remark, info = self.para
STEP(1, '点击新增按钮') STEP(1, '点击新增按钮')
areagroup_add = WebDriverWait(wd, 10).until( areagroup_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]")) EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
) )
areagroup_add.click() areagroup_add.click()
sleep(2)
STEP(2, '填写分组名称') STEP(2, f'查看并选择区域分组:{area_group}')
group_name = WebDriverWait(wd, 10).until( if area_group:
area_group_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "// input[ @ placeholder = '请选择分组']"))
)
area_group_input.clear()
area_group_input.send_keys(area_group)
sleep(1)
#默认选择第一个内容
area_group_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-cascader__suggestion-panel el-scrollbar']//li[1]//span[1]"))
)
area_group_select.click()
else:
print("group_name 为空,不执行选择区域分组的操作")
STEP(3, f'填写分组名称:{group_name}')
group_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='长度1-20个字符']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='长度1-20个字符']"))
) )
group_name.clear() group_name_input.clear()
group_name.send_keys("测试区域1") group_name_input.send_keys(group_name)
STEP(3, '填写分组地址') STEP(4, f'填写分组地址:{group_address}')
group_address = WebDriverWait(wd, 10).until( group_address_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='输入地址不能大于50个字符']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='输入地址不能大于50个字符']"))
) )
group_address.clear() group_address_input.clear()
group_address.send_keys("顺恒利大厦") group_address_input.send_keys(group_address)
STEP(4, '填写分组备注') STEP(5, f'填写分组备注:{remark}')
group_remark = WebDriverWait(wd, 10).until( group_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请输入备注']")) (By.XPATH, "//input[@placeholder='请输入备注']"))
) )
group_remark.clear() group_remark.clear()
group_remark.send_keys("测试分组备注") group_remark.send_keys(remark)
STEP(6, '点击确认') STEP(6, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
...@@ -45,8 +70,13 @@ class AreagroupAdd001: ...@@ -45,8 +70,13 @@ class AreagroupAdd001:
STEP(7, '验证是否新增成功') STEP(7, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']"))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info )
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
...@@ -3,41 +3,36 @@ import os ...@@ -3,41 +3,36 @@ import os
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 *
class AreagroupMod001: class AreagroupMod:
name = 'Areagroup_modify_001' name = 'Areagroup_modify'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
STEP(1, '勾选分组,点击“编辑”按钮') STEP(1, '勾选分组,点击“编辑”按钮')
try: areagroup_select = WebDriverWait(wd, 10).until(
# 等待页面加载,并查找包含文本“测试”的元素旁边的复选框 EC.element_to_be_clickable((By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
checkbox = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//span[contains(text(), '测试区域1')]//span[@class='el-checkbox__inner']"))
) )
areagroup_select = checkbox.find_element(By.XPATH, "./ancestor::span[contains(@class, 'el-checkbox__input')]//input")
# 勾选复选框
if not areagroup_select.is_selected():
areagroup_select.click() areagroup_select.click()
finally:
areagroup_modify = WebDriverWait(wd, 10).until( areagroup_modify = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'编辑')]")) EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'编辑')]"))
) )
areagroup_modify.click() areagroup_modify.click()
sleep(2) sleep(1)
STEP(2, '修改分组名称') STEP(2, '修改分组名称')
group_name = WebDriverWait(wd, 10).until( group_name = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='长度1-20个字符']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='长度1-20个字符']"))
) )
group_name.clear() group_name.clear()
group_name.send_keys("测试区域1-已修改") group_name.send_keys("深圳分组1-已修改")
STEP(3, '修改分组地址') STEP(3, '修改分组地址')
group_address = WebDriverWait(wd, 10).until( group_address = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='输入地址不能大于50个字符']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='输入地址不能大于50个字符']"))
) )
group_address.clear() group_address.clear()
group_address.send_keys("顺恒利大厦-已修改") group_address.send_keys("深圳-已修改")
STEP(4, '修改分组备注') STEP(4, '修改分组备注')
group_remark = WebDriverWait(wd, 10).until( group_remark = WebDriverWait(wd, 10).until(
...@@ -45,7 +40,7 @@ class AreagroupMod001: ...@@ -45,7 +40,7 @@ class AreagroupMod001:
(By.XPATH, "//input[@placeholder='请输入备注']")) (By.XPATH, "//input[@placeholder='请输入备注']"))
) )
group_remark.clear() group_remark.clear()
group_remark.send_keys("修改测试分组") group_remark.send_keys("修改深圳分组")
STEP(5, '点击确认') STEP(5, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
...@@ -55,8 +50,12 @@ class AreagroupMod001: ...@@ -55,8 +50,12 @@ class AreagroupMod001:
STEP(6, '验证是否修改成功') STEP(6, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -3,25 +3,24 @@ import os ...@@ -3,25 +3,24 @@ import os
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 *
class AreagroupDel001: class AreagroupDel:
name = 'Areagroup_delete_001' name = 'Areagroup_delete'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
STEP(1, '勾选分组') STEP(1, '勾选分组')
checkbox = WebDriverWait(wd, 10).until( areagroup_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//span[contains(text(), '测试区域1')]//span[@class='el-checkbox__inner']")) EC.presence_of_element_located((By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
) )
areagroup_select = checkbox.find_element(By.XPATH, "./ancestor::span[contains(@class, 'el-checkbox__input')]//input")
areagroup_select.click() areagroup_select.click()
sleep(2) sleep(1)
STEP(2, '点击“删除”按钮') STEP(2, '点击“删除”按钮')
areagroup_modify = WebDriverWait(wd, 10).until( areagroup_modify = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'删除')]")) EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'删除')]"))
) )
areagroup_modify.click() areagroup_modify.click()
sleep(2) sleep(1)
STEP(3, '点击确认') STEP(3, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
...@@ -31,8 +30,11 @@ class AreagroupDel001: ...@@ -31,8 +30,11 @@ class AreagroupDel001:
STEP(6, '验证是否修改成功') STEP(6, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh()
\ No newline at end of file
...@@ -3,39 +3,49 @@ import os ...@@ -3,39 +3,49 @@ import os
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 *
class AreatypeAdd001: # 构建 CSV 文件的绝对路径
name = 'Areatype_add_001' csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '04区域类型', '新增区域类型.csv'))
class AreatypeAdd:
tag = ['新增区域类型']
ddt_cases = read_csv_data(csv_path)
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
#从self.para中解构出数据
name = self.name
area_type, sort, remark, info= self.para
STEP(1, '点击新增按钮') STEP(1, '点击新增按钮')
areatype_add = WebDriverWait(wd, 10).until( areatype_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]")) EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
) )
areatype_add.click() areatype_add.click()
sleep(2) sleep(1)
STEP(2, '填写区域类型') STEP(2, f'填写区域类型: {area_type}')
type_name = WebDriverWait(wd, 10).until( type_name = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入区域类型']")) EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入区域类型']"))
) )
type_name.clear() type_name.clear()
type_name.send_keys("测试类型1") type_name.send_keys(area_type)
STEP(3, '填写排序') STEP(3, f'填写排序:{sort}')
type_sort = WebDriverWait(wd, 10).until( type_sort = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='排序']")) EC.presence_of_element_located((By.XPATH, "//input[@placeholder='排序']"))
) )
type_sort.clear() type_sort.clear()
type_sort.send_keys("123") type_sort.send_keys(sort)
STEP(4, '填写备注') STEP(4, f'填写备注:{remark}')
type_remark = WebDriverWait(wd, 10).until( type_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='备注']")) (By.XPATH, "//input[@placeholder='备注']"))
) )
type_remark.clear() type_remark.clear()
type_remark.send_keys("类型备注测试") type_remark.send_keys(remark)
STEP(5, '点击确认') STEP(5, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
...@@ -45,8 +55,12 @@ class AreatypeAdd001: ...@@ -45,8 +55,12 @@ class AreatypeAdd001:
STEP(6, '验证是否新增成功') STEP(6, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info)
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -3,7 +3,7 @@ import os ...@@ -3,7 +3,7 @@ import os
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 *
class AreatypeMod001: class AreatypeMod:
name = 'Areatype_mod_001' name = 'Areatype_mod_001'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
...@@ -13,7 +13,7 @@ class AreatypeMod001: ...@@ -13,7 +13,7 @@ class AreatypeMod001:
EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域类型')])[1]")) EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域类型')])[1]"))
) )
areatype_search.clear() areatype_search.clear()
areatype_search.send_keys("测试类型1") areatype_search.send_keys("会议室")
STEP(2, '勾选区域类型') STEP(2, '勾选区域类型')
areatype_select = WebDriverWait(wd, 10).until( areatype_select = WebDriverWait(wd, 10).until(
...@@ -33,7 +33,7 @@ class AreatypeMod001: ...@@ -33,7 +33,7 @@ class AreatypeMod001:
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入区域类型']")) EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入区域类型']"))
) )
type_name.clear() type_name.clear()
type_name.send_keys("修改-测试类型1") type_name.send_keys("修改-会议室")
STEP(5, '修改排序') STEP(5, '修改排序')
type_sort = WebDriverWait(wd, 10).until( type_sort = WebDriverWait(wd, 10).until(
...@@ -58,8 +58,12 @@ class AreatypeMod001: ...@@ -58,8 +58,12 @@ class AreatypeMod001:
STEP(8, '验证是否修改成功') STEP(8, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -3,7 +3,7 @@ import os ...@@ -3,7 +3,7 @@ import os
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 *
class AreatypeDel001: class AreatypeDel:
name = 'Areatype_del_001' name = 'Areatype_del_001'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
...@@ -13,7 +13,7 @@ class AreatypeDel001: ...@@ -13,7 +13,7 @@ class AreatypeDel001:
EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域类型')])[1]")) EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域类型')])[1]"))
) )
areatype_search.clear() areatype_search.clear()
areatype_search.send_keys("修改-测试类型1") areatype_search.send_keys("修改-会议室")
STEP(2, '勾选区域类型') STEP(2, '勾选区域类型')
areatype_select = WebDriverWait(wd, 10).until( areatype_select = WebDriverWait(wd, 10).until(
...@@ -30,14 +30,18 @@ class AreatypeDel001: ...@@ -30,14 +30,18 @@ class AreatypeDel001:
STEP(4, '点击确认') STEP(4, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]")) EC.element_to_be_clickable((By.XPATH, "(//span[contains(text(),'确 定')])[3]"))
) )
commit.click() commit.click()
STEP(5, '验证是否修改成功') STEP(5, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -3,50 +3,68 @@ import os ...@@ -3,50 +3,68 @@ import os
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 *
class AreafuntionAdd001: # 构建 CSV 文件的绝对路径
name = 'Areafuntion_add_001' csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '05区域功能', '新增区域功能.csv'))
class AreafuntionAdd:
tag = ['新增区域功能']
ddt_cases = read_csv_data(csv_path)
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
#从self.para中解构出数据
name = self.name
funtion_name, sort, remark, info= self.para
STEP(1, '点击新增按钮') STEP(1, '点击新增按钮')
areafuntion_add = WebDriverWait(wd, 10).until( areafuntion_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]")) EC.element_to_be_clickable(
(By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
) )
areafuntion_add.click() areafuntion_add.click()
sleep(2) sleep(1)
STEP(2, '填写功能名称') STEP(2, f'填写功能名称:{funtion_name}')
funtion_name = WebDriverWait(wd, 10).until( funtion_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入功能名称']")) EC.presence_of_element_located(
(By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入功能名称']"))
) )
funtion_name.clear() funtion_name_input.clear()
funtion_name.send_keys("测试功能1") funtion_name_input.send_keys(funtion_name)
STEP(3, '填写排序') STEP(3, f'填写排序:{sort}')
funtion_sort = WebDriverWait(wd, 10).until( funtion_sort = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='排序']")) EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='排序']"))
) )
funtion_sort.clear() funtion_sort.clear()
funtion_sort.send_keys("123") funtion_sort.send_keys(sort)
STEP(4, '填写备注') STEP(4, f'填写备注:{remark}')
funtion_remark = WebDriverWait(wd, 10).until( funtion_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located( EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='备注']")) (By.XPATH, "//input[@placeholder='备注']"))
) )
funtion_remark.clear() funtion_remark.clear()
funtion_remark.send_keys("功能备注测试") funtion_remark.send_keys(remark)
STEP(5, '点击确认') STEP(5, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]")) EC.element_to_be_clickable(
(By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]"))
) )
commit.click() commit.click()
STEP(6, '验证是否新增成功') STEP(6, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located(
(By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info)
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -3,41 +3,46 @@ import os ...@@ -3,41 +3,46 @@ import os
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 *
class areafuntionMod001: class areafuntionMod:
name = 'areafuntion_mod_001' name = 'areafuntion_mod'
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
STEP(1, '搜索对应的区域功能') STEP(1, '搜索对应的区域功能')
areafuntion_search= WebDriverWait(wd, 10).until( areafuntion_search= WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域功能')])[1]")) EC.element_to_be_clickable(
(By.XPATH, "//input[@placeholder='请输入功能名称']"))
) )
areafuntion_search.clear() areafuntion_search.clear()
areafuntion_search.send_keys("测试功能1") areafuntion_search.send_keys("语音翻译")
STEP(2, '勾选区域功能') STEP(2, '勾选区域功能')
areafuntion_select = WebDriverWait(wd, 10).until( areafuntion_select = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "(//span[contains(@class,'el-checkbox__inner')])[2]")) EC.element_to_be_clickable(
(By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
) )
areafuntion_select.click() areafuntion_select.click()
STEP(3, '点击编辑按钮') STEP(3, '点击编辑按钮')
areafuntion_mod = WebDriverWait(wd, 10).until( areafuntion_mod = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'编辑')]")) EC.element_to_be_clickable(
(By.XPATH, "//span[contains(text(),'编辑')]"))
) )
areafuntion_mod.click() areafuntion_mod.click()
sleep(2) sleep(1)
STEP(4, '修改区域功能内容') STEP(4, '修改区域功能内容')
funtion_name = WebDriverWait(wd, 10).until( funtion_name = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入区域功能']")) EC.presence_of_element_located(
(By.XPATH, "//div[contains(@class,'dialog-input')]//input[contains(@placeholder,'请输入功能名称')]"))
) )
funtion_name.clear() funtion_name.clear()
funtion_name.send_keys("修改-测试功能1") funtion_name.send_keys("修改-测试功能1")
STEP(5, '修改排序') STEP(5, '修改排序')
funtion_sort = WebDriverWait(wd, 10).until( funtion_sort = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='排序']")) EC.presence_of_element_located(
(By.XPATH, "//input[contains(@placeholder,'排序')]"))
) )
funtion_sort.clear() funtion_sort.clear()
funtion_sort.send_keys("999") funtion_sort.send_keys("999")
...@@ -52,14 +57,20 @@ class areafuntionMod001: ...@@ -52,14 +57,20 @@ class areafuntionMod001:
STEP(7, '点击确认') STEP(7, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]")) EC.element_to_be_clickable(
(By.XPATH, "(//span[contains(text(),'确 定')])[2]"))
) )
commit.click() commit.click()
STEP(8, '验证是否修改成功') STEP(8, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located(
(By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -10,34 +10,43 @@ class areafuntionDel001: ...@@ -10,34 +10,43 @@ class areafuntionDel001:
STEP(1, '搜索对应的区域功能') STEP(1, '搜索对应的区域功能')
areafuntion_search= WebDriverWait(wd, 10).until( areafuntion_search= WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "(//input[contains(@placeholder,'请输入区域功能')])[1]")) EC.element_to_be_clickable(
(By.XPATH, "//input[@placeholder='请输入功能名称']"))
) )
areafuntion_search.clear() areafuntion_search.clear()
areafuntion_search.send_keys("修改-测试功能1") areafuntion_search.send_keys("修改-测试功能1")
STEP(2, '勾选区域功能') STEP(2, '勾选区域功能')
areafuntion_select = WebDriverWait(wd, 10).until( areafuntion_select = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "(//span[contains(@class,'el-checkbox__inner')])[2]")) EC.element_to_be_clickable(
(By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
) )
areafuntion_select.click() areafuntion_select.click()
STEP(3, '点击删除按钮') STEP(3, '点击删除按钮')
areafuntion_mod = WebDriverWait(wd, 10).until( areafuntion_mod = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'删除')]")) EC.element_to_be_clickable(
(By.XPATH, "//span[contains(text(),'删除')]"))
) )
areafuntion_mod.click() areafuntion_mod.click()
sleep(2) sleep(1)
STEP(4, '点击确认') STEP(4, '点击确认')
commit = WebDriverWait(wd, 10).until( commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]")) EC.element_to_be_clickable(
(By.XPATH, "(//span[contains(text(),'确 定')])[3]"))
) )
commit.click() commit.click()
STEP(5, '验证是否修改成功') STEP(5, '验证是否修改成功')
get_menu = WebDriverWait(wd, 10).until( get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content')) EC.visibility_of_element_located(
(By.CSS_SELECTOR, '.el-message__content'))
) )
get_menu1 = get_menu.text get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!") CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
\ No newline at end of file # 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
...@@ -10,8 +10,8 @@ def suite_setup(): ...@@ -10,8 +10,8 @@ def suite_setup():
enter_manage() enter_manage()
enter_areafuntion_manage() enter_areafuntion_manage()
# def suite_teardown(): def suite_teardown():
# INFO('进行清除操作') INFO('进行清除操作')
# wd = GSTORE['wd'] wd = GSTORE['wd']
# wd.quit() wd.quit()
...@@ -24,7 +24,7 @@ from time import sleep ...@@ -24,7 +24,7 @@ from time import sleep
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def open_browser(): def open_browser():
INFO('打开浏览器') INFO('打开默认浏览器')
# wd = webdriver.Chrome() # wd = webdriver.Chrome()
edge_options = Options() edge_options = Options()
edge_options.add_argument('--ignore-certificate-errors') edge_options.add_argument('--ignore-certificate-errors')
...@@ -349,10 +349,8 @@ def get_reportfile_send_dingding(report_title, report_url_prefix): ...@@ -349,10 +349,8 @@ def get_reportfile_send_dingding(report_title, report_url_prefix):
def read_csv_data(csv_file_path): def read_csv_data(csv_file_path):
""" """
读取CSV文件中的数据,并将其转换为一个包含字典的列表,每个字典代表一行测试用例数据。 读取CSV文件中的数据,并将其转换为一个包含字典的列表,每个字典代表一行测试用例数据。
参数: 参数:
csv_file_path (str): CSV文件的路径。 csv_file_path (str): CSV文件的路径。
返回: 返回:
list: 包含字典的列表,每个字典包含测试用例的名称和参数。 list: 包含字典的列表,每个字典包含测试用例的名称和参数。
""" """
......
username,password,captcha num,username,password,captcha,info
test_user1,ub@1234567,csba 用户登录-001-登录账号为空,,ub@1234567,csba,请输入登录账号
test_user2,ub@123,csba 用户登录-002-登录密码为空,test_user3,,csba,请输入登录密码
test_user3,,csba 用户登录-003-验证码为空,test_user4,ub@1234567,,请输入验证码(区分大小写)
test_user4,ub@1234567, 用户登录-004-登录账号不存在,test_user1,ub@1234567,csba,请检则用户名或密码是否正确!
,ub@1234567,csba 用户登录-005-登录密码错误,admin@pgy,ub@1234567,csba,输入的用户或密码不一致,
\ No newline at end of file 用户登录-006-正常登录,admin@pgy,ub@123456,csba,登录成功
\ No newline at end of file
account,user_name,new_passwd,comfire_passwd,limits,user_number,phone,email,remark name,account,user_name,new_passwd,comfire_passwd,authority,user_number,phone,email,remark,info
test_user1,test_user1,Ubains@123,Ubains@123,1,13579,13169678901,test1@qq.com,test1 新增用户-001-登录名为空,,test_user1,Ubains@123,Ubains@123,普通用户,13579,13169678901,test1@qq.com,test1,请输入登录名
test_user2,test_user2,Ubains@123,Ubains@123,1,13580,13169678902,test2@qq.com,test2 新增用户-002-用户名称为空,test_user1,,Ubains@123,Ubains@123,普通用户,13579,13169678901,test1@qq.com,test1,请输入用户名称
test_user3,test_user3,Ubains@123,Ubains@123,1,13581,13169678903,test3@qq.com,test3 新增用户-003-密码为空,test_user1,test_user1,,Ubains@123,普通用户,13579,13169678901,test1@qq.com,test1,密码至少8个字符
test_user4,test_user4,Ubains@123,Ubains@123,3,13582,13169678904,test4@qq.com,test4 新增用户-004-确认密码为空,test_user1,test_user1,Ubains@123,,普通用户,13579,13169678901,test1@qq.com,test1,两次密码不一致
test_user5,test_user5,Ubains@123,Ubains@123,3,13583,13169678905,test5@qq.com,test5 新增用户-005-密码和账号相同,test_user1,test_user1,test_user1,Ubains@123,普通用户,13579,13169678901,test1@qq.com,test1,密码不能和账号相同
test_user6,test_user6,Ubains@123,Ubains@123,3,13584,13169678906,test6@qq.com,test6 新增用户-006-正常创建1,test_user1,test_user1,Ubains@123,Ubains@123,普通用户,13580,13169678902,test2@qq.com,test1,操作成功!
test_user7,test_user7,Ubains@123,Ubains@123,4,13585,13169678907,test7@qq.com,test7 新增用户-007-登录名重复,test_user1,test_user1,Ubains@123,Ubains@123,普通用户,13581,13169678902,test2@qq.com,test1,登录名已存在,请重新输入
test_user8,test_user8,Ubains@123,Ubains@123,4,13586,13169678908,test8@qq.com,test8 新增用户-008-正常创建用户2,test_user2,test_user2,Ubains@123,Ubains@123,普通用户,13582,13169678903,test3@qq.com,test2,操作成功!
test_user9,test_user9,Ubains@123,Ubains@123,4,13587,13169678909,test9@qq.com,test9 新增用户-009-正常创建用户3,test_user3,test_user3,Ubains@123,Ubains@123,普通用户,13583,13169678904,test4@qq.com,test3,操作成功!
\ No newline at end of file \ No newline at end of file
area_group,group_name,group_address,remark name,area_group,group_name,group_address,remark,info
,测试分组1,深圳,第一层级 新增分组-002-创建一级分组-深圳分组1,,深圳分组1,深圳,第一层级,操作成功!
测试分组1,测试分组1-1,深圳,第二层级 新增分组-003-创建二级分组-深圳分组2,深圳分组1,深圳分组2,深圳,第二层级,操作成功!
测试分组1-1,测试分组1-2,深圳,第三层级 新增分组-004-创建三级分组-深圳分组3,深圳分组2,深圳分组3,深圳,第三层级,操作成功!
测试分组1-2,测试分组1-3,深圳,第四层级 新增分组-005-创建四级分组-深圳分组4,深圳分组3,深圳分组4,深圳,第四层级,操作成功!
,测试分组2,广州,第一层级 新增分组-006-创建一级分组-广州分组1,,广州分组1,广州,第一层级,操作成功!
测试分组2,测试分组2-1,广州,第二层级 新增分组-007-创建二级分组-广州分组2,广州分组1,广州分组2,广州,第二层级,操作成功!
测试分组2-1,测试分组2-2,广州,第三层级 新增分组-008-创建三级分组-广州分组3,广州分组2,广州分组3,广州,第三层级,操作成功!
测试分组2-2,测试分组2-3,广州,第四层级 新增分组-009-创建四级分组-广州分组4,广州分组3,广州分组4,广州,第四层级,操作成功!
,测试分组3,上海,第一层级 新增分组-010-创建一级分组-上海分组1,,上海分组1,上海,第一层级,操作成功!
测试分组3,测试分组3-1,上海,第二层级 新增分组-011-创建二级分组-上海分组2,上海分组1,上海分组2,上海,第二层级,操作成功!
测试分组3-1,测试分组3-2,上海,第三层级 新增分组-012-创建三级分组-上海分组3,上海分组2,上海分组3,上海,第三层级,操作成功!
测试分组3-2,测试分组3-3,上海,第四层级 新增分组-013-创建四级分组-上海分组4,上海分组3,上海分组4,上海,第四层级,操作成功!
\ No newline at end of file \ No newline at end of file
area_type,sort,remark name,area_type,sort,remark,info
办公室,1,办公室 新增区域类型-001-名称为空,,1,会议室,请输入类型名称
大会议室,2,大会议室 新增区域类型-002-排序为空,会议室,,会议室,请输入排序
小会议室,3,小会议室 新增区域类型-003-会议室,会议室,1,会议室,操作成功!
培训室,4,培训室 新增区域类型-004-大会议室,大会议室,2,大会议室,操作成功!
展览室,5,展览室 新增区域类型-005-小会议室,小会议室,3,小会议室,操作成功!
\ No newline at end of file 新增区域类型-006-培训室,培训室,4,培训室,操作成功!
新增区域类型-007-展览室,展览室,5,展览室,操作成功!
\ No newline at end of file
funtion_name,sort,remark name,funtion_name,sort,remark,info
摄像头,1,摄像头 新增区域功能-001-名称为空,,1,摄像头,请输入类型名称
ideahub,2,IdeaHub 新增区域功能-002-排序为空,摄像头,,摄像头,请输入排序
语音转录,3,语音转录 新增区域功能-003-摄像头,摄像头,1,摄像头,操作成功!
语音识别,4,语音识别 新增区域功能-004-ideahub,ideahub,2,IdeaHub,操作成功!
语音翻译,5,语音翻译 新增区域功能-005-语音转录,语音转录,3,语音转录,操作成功!
语音合成,6,语音合成 新增区域功能-006-语音识别,语音识别,4,语音识别,操作成功!
新增区域功能-007-语音翻译,语音翻译,5,语音翻译,操作成功!
新增区域功能-008-语音合成,语音合成,6,语音合成,操作成功!
area_group,area_type,area_name,area_ip,remark name,area_group,area_type,area_name,area_ip,remark,info
测试分组1,办公室,测试区域1,192.168.1.1,测试区域1 新增区域-001-区域分组为空,,办公室,测试区域0,192.168.1.0,测试区域0,请选择分组
测试分组1-1,大会议室,测试区域2,192.168.1.2,测试区域2 新增区域-002-区域类型为空,深圳分组1,,测试区域0,192.168.1.0,测试区域0,请选择区域类型
测试分组1-2,小会议室,测试区域3,192.168.1.3,测试区域3 新增区域-003-区域名称为空,深圳分组1,办公室,,192.168.1.0,测试区域0,请输入区域名称
测试分组1-3,培训室,测试区域4,192.168.1.4,测试区域4 新增区域-004-测试区域1,深圳分组1,办公室,测试区域1,192.168.1.1,测试区域1,操作成功!
测试分组2,办公室,测试区域5,192.168.1.5,测试区域5 新增区域-005-测试区域2,深圳分组2,大会议室,测试区域2,192.168.1.2,测试区域2,操作成功!
测试分组2-1,大会议室,测试区域6,192.168.1.6,测试区域6 新增区域-006-测试区域3,深圳分组3,小会议室,测试区域3,192.168.1.3,测试区域3,操作成功!
测试分组2-2,小会议室,测试区域7,192.168.1.7,测试区域7 新增区域-007-测试区域4,深圳分组4,培训室,测试区域4,192.168.1.4,测试区域4,操作成功!
测试分组2-3,培训室,测试区域8,192.168.1.8,测试区域8 新增区域-008-测试区域5,广州分组1,办公室,测试区域5,192.168.1.5,测试区域5,操作成功!
测试分组3,办公室,测试区域9,192.168.1.9,测试区域9 新增区域-009-测试区域6,广州分组2,大会议室,测试区域6,192.168.1.6,测试区域6,操作成功!
测试分组3-1,大会议室,测试区域10,192.168.1.10,测试区域10 新增区域-010-测试区域7,广州分组3,小会议室,测试区域7,192.168.1.7,测试区域7,操作成功!
测试分组3-2,小会议室,测试区域11,192.168.1.11,测试区域11 新增区域-011-测试区域8,广州分组4,培训室,测试区域8,192.168.1.8,测试区域8,操作成功!
测试分组3-3,培训室,测试区域12,192.168.1.12,测试区域12 新增区域-012-测试区域9,上海分组1,办公室,测试区域9,192.168.1.9,测试区域9,操作成功!
新增区域-013-测试区域10,上海分组2,大会议室,测试区域10,192.168.1.10,测试区域10,操作成功!
新增区域-014-测试区域11,上海分组3,小会议室,测试区域11,192.168.1.11,测试区域11,操作成功!
新增区域-015-测试区域12,上海分组4,培训室,测试区域12,192.168.1.12,测试区域12,操作成功!
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论