robotframework-demo/Project/task4/Resource/RE1_Dashboard/KeyWord.robot

179 lines
14 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Resource ElementPath.robot
Resource ../RE3_DPM/ElementPath.robot
Resource ../RE0_Common/KeyWord.robot
*** Keywords ***
新建集群
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
元素点击 ${Host_Manage} 点击展开主机管理 定位主机管理按钮失败
元素点击 ${Create_Colony} 点击创建集群 定位创建集群按钮失败
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
${Colony_Name_1}= Catenate SEPARATOR=_ colony_1 ${date}
Set Global Variable ${Colony_Name_1}
元素输入 ${Input_Colony_Name} ${Colony_Name_1} 定位集群名称输入框失败
元素点击 ${Change_Dir_Colony} 点击更改集群目录 定位集群目录更改按钮失败
Sleep 2s
Click Element xpath=//div[@id="addChooseParentCluster"]//span[text()="${Group_Name_2}"]
元素点击 ${Colony_ChooseParent} 点击确定完成上层目录选择 定位选择上层目录的确定按钮失败
元素点击 ${Add_Colony} 点击创建集群 定位集群添加按钮失败
元素点击 ${Success_Confirm} 点击确定完成集群创建 集群创建失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Colony_Name_1}"] 5s 未展开主机组目录,所以应当无法查看集群
Log 未展开主机目录,所以无法查看子目录下的集群
元素点击 xpath=//span[text()="${Group_Name_2}"]/../../td[1]/div 展开主机组子目录列表 定位主机组子目录列表失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Colony_Name_1}"] 5s 定位新建集群目录失败
Log 新建集群目录成功
新建主机组
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
元素点击 ${Host_Manage} 点击展开主机管理 定位主机管理按钮失败
元素点击 ${Create_HostGroup} 点击新建主机组 定位新建主机组按钮失败
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
${Group_Name_1}= Catenate SEPARATOR=_ group_1 ${date}
${Group_Name_2}= Catenate SEPARATOR=_ group_2 ${date}
Set Global Variable ${Group_Name_1}
Set Global Variable ${Group_Name_2}
元素输入 ${Input_GroupName} ${Group_Name_1} 定位主机组输入框失败
元素点击 ${Add_HostGroup} 点击添加主机组 定位主机组添加按钮失败
元素点击 ${Success_Confirm} 点击确定完成主机创建 主机创建失败
Log 上层目录创建完毕
元素点击 ${Host_Manage} 点击展开主机管理 定位主机管理按钮失败
元素点击 ${Create_HostGroup} 点击新建主机组 定位新建主机组按钮失败
元素输入 ${Input_GroupName} ${Group_Name_2} 定位主机组输入框失败
元素点击 ${Change_Dir_Group} 点击更换目标目录 定位更换目标目录按钮失败
元素点击 xpath=//div[@id="addChooseParentGroup"]//span[text()="${Group_Name_1}"] 点击选择上层目录 定位上层目录失败
元素点击 ${Group_ChooseParent} 点击确定完成上层目录选择 定位选择上层目录的确定按钮失败
元素点击 ${Add_HostGroup} 点击添加主机组 定位主机组添加按钮失败
元素点击 ${Success_Confirm} 点击确定完成主机创建 主机创建失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 定位新建主机组根目录失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 未展开主机根目录,不该查看到子目录
Log 未展开主机目录,所以无法查看子目录
元素点击 xpath=//span[text()="${Group_Name_1}"]/../../td[1]/div 展开主机组根目录列表 定位主机组根目录列表失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 定位新建主机组子目录失败
Log 主机组目录创建成功
移动代理到主机组
[Arguments] ${agent_name}
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
Right Click Element xpath=//span[text()="${agent_name}"]
元素点击 ${MV_Group} 点击移动到主机组 定位移动到主机组选项失败
元素点击 ${Input_MV_Group} 点击展开已创建的主机组 定位主机组输入框失败
元素点击 xpath=//div[text()="${Group_Name_2}"] 点击选择移动的子目录 定位要移动的子目录失败
元素点击 ${MV_Group_Confirm} 点击确定完成主机移动 定位主机组选项弹窗内的确定按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${agent_name} 定位搜索代理输入框失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 定位新建主机组根目录失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 定位新建主机组子目录失败
Log 目录层级可见,移动主机组成功
Right Click Element xpath=//span[text()="${agent_name}"]
元素点击 ${MV_Group} 点击移动到主机组 定位移动到主机组选项失败
元素点击 ${Input_MV_Group} 点击展开已创建的主机组 定位主机组输入框失败
元素点击 ${Root_Dir} 点击选择所有主机选项 定位所有主机选项失败
Log 默认目录为所有主机
元素点击 ${MV_Group_Confirm} 点击确定完成主机移动 定位主机组选项弹窗内的确定按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${agent_name} 定位搜索代理输入框失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 新建主机组根目录可见,移除主机组失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 新建主机组子目录可见,移除主机组失败
Log 目录层级不可见,移出主机组成功
移动代理到集群
[Arguments] ${agent_name} # 代理名称
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
Right Click Element xpath=//span[text()="${agent_name}"]
元素点击 ${MV_Colony} 点击选择移动代理到集群 定位移动到集群选项失败
元素点击 ${Input_MV_Colony} 点击展开集群下拉框选项 定位集群下拉框选项失败
元素点击 xpath=//div[text()="${Colony_Name_1}"] 点击选择要寄宿的集群 定位要寄宿的集群失败
元素点击 ${MV_Group_Confirm} 点击确认完成代理切换集群 定位切换集群的确认按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${agent_name} 定位搜索代理输入框失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 定位新建主机组根目录失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 定位新建主机组子目录失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Colony_Name_1}"] 5s 定位新建集群目录失败
Log 目录层级可见,移动主机组成功
Right Click Element xpath=//span[text()="${agent_name}"]
元素点击 ${MV_Out_Colony} 点击移出集群 定位移出集群选项失败
元素点击 ${Confirm_MV_Colony} 点击确定移出集群 定位二次确认移出集群弹窗下的确认按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${agent_name} 定位搜索代理输入框失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 根目录可见,移出集群目录失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 子目录可见,移出集群目录失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Colony_Name_1}"] 5s 集群目录可见,移出集群目录失败
Log 目录层级不可见,移出集群目录成功
解散主机组
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
${x_status}= Run Keyword And Return Status Wait Until Element Is Visible xpath=//i[text()="×"]
Run Keyword If ${x_status}==True Click Element xpath=//i[text()="×"]
FOR ${n} IN RANGE 5
${Group_Result} Run Keyword And Return Status Wait Until Element Is Visible ${Group_1} 10s
Run Keyword If ${Group_Result}==True 删除主机组 1
... ELSE Exit For Loop
END
FOR ${n} IN RANGE 10
${Group_Result} Run Keyword And Return Status Wait Until Element Is Visible ${Group_2} 10s
Run Keyword If ${Group_Result}==True 删除主机组 2
... ELSE Exit For Loop
END
解散集群
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
${x_status}= Run Keyword And Return Status Wait Until Element Is Visible xpath=//i[text()="×"]
Run Keyword If ${x_status}==True Click Element xpath=//i[text()="×"]
Clear Element Text ${Search_Agent}
FOR ${n} IN RANGE 3
${Colony_Result} Run Keyword And Return Status Wait Until Element Is Visible ${Colony_1}
Run Keyword If ${Colony_Result}==True 删除集群
... ELSE Exit For Loop
END
删除主机组
[Arguments] ${n}
Right Click Element ${Group_${n}}
sleep 2s
FOR ${n} IN RANGE 10
Sleep 5s
Execute Javascript document.evaluate('//tbody/tr[6]//div[text()="解除"]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0).click()
Sleep 5s
${status}= Run Keyword And Return Status Wait Until Element Is Visible ${Confirm_Delete_Group}
Run Keyword If ${status} Exit For Loop
... ELSE Log 点击${n}次
END
元素点击 ${Confirm_Delete_Group} 点击确定完成主机组解除 定位主机组解除按钮失败
元素点击 ${Success_Confirm} 主机组删除成功 定位二次确认弹窗内的确定删除按钮失败
删除集群
Right Click Element ${Colony_1}
sleep 2s
循环点击 ${Delete_Colony} ${Confirm_Delete_Colony}
元素点击 ${Confirm_Delete_Colony} 点击确定完成集群解除 定位集群解除按钮失败
元素点击 ${Success_Confirm} 集群删除成功 定位二次确认弹窗内的确定删除按钮失败
移入当前主机组_集群
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
Right Click Element ${Group_1}
元素点击 ${MV_Current_Group} 点击选择移入至当前主机组 定位移入至当前主机组失败
元素点击 ${Select_MV_Type} 点击选择移入主机的数据源类型 定位移入主机组的数据源下拉框失败
元素点击 ${Option_Colony} 选择将集群移入主机组 定位集群选项失败
元素点击 xpath=//h4[text()="移入至当前主机组"]/../..//span[text()="${Colony_Name_1}"]/../../td[2] 勾选指定的集群 定位要勾选的集群失败
元素点击 ${Add_DataSource} 添加到右侧数据源 定位添加到已选列表按钮失败
元素点击 ${Confirm_MV_Group} 点击确定进行代理移动 定位确定按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${Colony_Name_1} 定位搜索代理输入框失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 定位新建主机组根目录失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 新建主机组子目录可见,移动代理至主机组失败
移入当前主机组_代理
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
Right Click Element ${Group_1}
元素点击 ${MV_Current_Group} 点击选择移入至当前主机组 定位移入至当前主机组失败
元素点击 ${Select_MV_Type} 点击选择移入主机的数据源类型 定位移入主机组的数据源下拉框失败
元素点击 ${Option_Agent} 选择将代理移入主机组 定位代理选项失败
元素点击 xpath=//h4[text()="移入至当前主机组"]/../..//span[text()="${Plantform_BC_Agent}"]/../../td[2] 勾选指定的代理 定位要勾选的代理失败
元素点击 ${Add_DataSource} 添加到右侧数据源 定位添加到已选列表按钮失败
元素点击 ${Confirm_MV_Group} 点击确定进行代理移动 定位确定按钮失败
元素点击 ${Success_Confirm} 主机移动成功 定位二次确认弹窗内的确定按钮失败
元素输入 ${Search_Agent} ${Plantform_BC_Agent} 定位搜索代理输入框失败
Wait Until Element Is Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_1}"] 5s 定位新建主机组根目录失败
Wait Until Element Is Not Visible xpath=//span[@class="standartTreeRow" and text()="${Group_Name_2}"] 5s 新建主机组子目录可见,移动代理至主机组失败