2023-12-04 16:56:23 +00:00
|
|
|
|
*** Settings ***
|
|
|
|
|
Library Selenium2Library
|
|
|
|
|
Library ../../../.venv/lib/site-packages/robot/libraries/Collections.py
|
|
|
|
|
Resource Element.robot
|
|
|
|
|
Resource Common.robot
|
|
|
|
|
Variables ../config/myConfig.py
|
|
|
|
|
|
|
|
|
|
*** Keywords ***
|
|
|
|
|
登录黑方
|
|
|
|
|
Open Browser ${unbackup} ${driver}
|
|
|
|
|
Maximize Browser Window
|
|
|
|
|
Wait Until Element Is Visible id=slogan 30s 黑方打开失败
|
|
|
|
|
输入文本 id=userName ${username}
|
|
|
|
|
输入文本 id=passWord ${passwd}
|
|
|
|
|
点击按钮 id=login_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=login_btn 30s 黑方登录失败
|
|
|
|
|
Log 黑方登录成功
|
|
|
|
|
|
|
|
|
|
创建oracle备份策略
|
|
|
|
|
# 点击定时页面,并确认页面也打开
|
|
|
|
|
点击按钮 id=sideNav_dpm
|
|
|
|
|
Wait Until Element Is Visible xpath=//span[text()='所有主机'] 10s
|
|
|
|
|
# 选中Oracle代理机
|
|
|
|
|
输入文本 id=inputSuccess2 ${hostname}
|
|
|
|
|
点击按钮 xpath=//span[text()='Oracle']
|
|
|
|
|
Wait Until Element Is Visible id=dpm_tab_policy_addPolicy1_btn 10s 定时数据保护页面打开异常
|
|
|
|
|
# 新建策略
|
|
|
|
|
点击按钮 id=dpm_tab_policy_addPolicy1_btn
|
|
|
|
|
Wait Until Element Is Visible xpath=//h4[text()='新建方式'] 5s
|
|
|
|
|
Wait Until Element Is Visible xpath=//h4[text()='数据源类型'] 5s
|
|
|
|
|
点击按钮 xpath=//span[text()='数据库(Oracle物理)']
|
|
|
|
|
Wait Until Element Is Visible xpath=//span[text()='连接凭据'] 5s
|
|
|
|
|
# 连接凭据
|
|
|
|
|
输入文本 id=PolicyName ${PolicyName}
|
|
|
|
|
输入文本 id=alone_instance ${Oracle_SID}
|
|
|
|
|
点击按钮 id=dpm_oracle_addPolicy_nextStep2_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=dpm_oracle_addPolicy_nextStep2_btn 30s
|
|
|
|
|
# 目标数据库
|
|
|
|
|
点击按钮 xpath=//span[text()='Oracle数据库']/../../td[2]
|
|
|
|
|
点击按钮 id=dpm_oracle_addPolicy_nextStep3_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=dpm_oracle_addPolicy_nextStep3_btn 30s
|
|
|
|
|
# Oracle选项
|
|
|
|
|
点击按钮 id=dpm_oracle_addpolicy_fw_step_3_button
|
|
|
|
|
Wait Until Element Is Not Visible id=dpm_oracle_addpolicy_fw_step_3_button 30s
|
|
|
|
|
# 任务周期
|
|
|
|
|
点击按钮 id=dialogues_addCycleStorage_step3_2_next_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=dialogues_addCycleStorage_step3_2_next_btn 30s
|
|
|
|
|
# 备份集存储
|
2023-12-05 02:16:25 +00:00
|
|
|
|
点击按钮 xpath=//label[text()[normalize-space()='系统分配']]
|
|
|
|
|
Wait Until Element Is Visible xpath=(//h4[text()='注意:系统检测到您未手动指定介质服务器,重删功能将无法使用'])[1] 5s
|
2023-12-04 16:56:23 +00:00
|
|
|
|
点击按钮 id=dialogues_addCycleStorage_step3_4_nodb2_next_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=dialogues_addCycleStorage_step3_4_nodb2_next_btn 30s
|
|
|
|
|
#备份高级选项
|
|
|
|
|
点击按钮 id=dialogues_backupAdvOptions_stepLastDefine_btn
|
|
|
|
|
Wait Until Element Is Not Visible id=dialogues_backupAdvOptions_stepLastDefine_btn 30s
|
|
|
|
|
# 添加成功
|
|
|
|
|
Wait Until Element Is Visible xpath=//p[text()='添加成功!'] 10s
|
|
|
|
|
点击按钮 id=tipsPop_define_btn
|
|
|
|
|
Log 已经创建备份策略:${PolicyName}
|
|
|
|
|
|
|
|
|
|
确定该策略执行成功
|
|
|
|
|
# 选择上面创建的策略并运行
|
|
|
|
|
输入文本 id=backupNameSearch ${PolicyName}
|
|
|
|
|
# 点击查询
|
|
|
|
|
点击按钮 id=dpm_tab_policy_backContent_search_btn
|
|
|
|
|
Sleep 2s
|
2023-12-05 02:16:25 +00:00
|
|
|
|
Element Text Should Be xpath=(//td[@align='left'])[2][text()] ${PolicyName}
|
2023-12-04 16:56:23 +00:00
|
|
|
|
点击按钮 xpath=//span[text()='立即执行']
|
|
|
|
|
Wait Until Element Is Visible xpath=//h4[text()='立即执行策略'] 5s
|
|
|
|
|
Select From List By Label xpath=//select[@ng-model='selectedSrctype'] 完全备份
|
|
|
|
|
Sleep 2s
|
|
|
|
|
点击按钮 id=dpm_oracle_executePolicyGuide_executePolicyExecute_btn
|
|
|
|
|
Wait Until Element Is Visible xpath=//p[text()='添加成功!'] 10s
|
|
|
|
|
点击按钮 id=tipsPop_define_btn
|
|
|
|
|
# 切换到作业
|
|
|
|
|
点击按钮 xpath=(//span[text()='作业'])[2]
|
|
|
|
|
Wait Until Element Is Not Visible id=dpm_tab_policy_addPolicy1_btn 5s
|
|
|
|
|
# 输入策略查询
|
|
|
|
|
输入文本 id=workPolicyName ${PolicyName}
|
|
|
|
|
点击按钮 id=dpm_tab_work_workPolicyName_search_btn
|
|
|
|
|
# 确认创建成功了
|
|
|
|
|
FOR ${counter} IN RANGE 60
|
|
|
|
|
Log ${counter}
|
|
|
|
|
${select_text} Get Text ${task_select_xpath}
|
|
|
|
|
Log 查询到的作业个数:${select_text}
|
|
|
|
|
Exit For Loop If '${select_text}' == '共1条记录'
|
|
|
|
|
Sleep 2s
|
|
|
|
|
点击按钮 id=dpm_tab_work_workPolicyName_search_btn
|
|
|
|
|
END
|
|
|
|
|
Wait Until Element Is Visible xpath=//div[text()='${PolicyName}'] 10s
|
|
|
|
|
Log 策略创建成功,正在运行中
|
|
|
|
|
# 等待运行完成
|
|
|
|
|
FOR ${index} IN RANGE 300
|
|
|
|
|
Log ${index}
|
|
|
|
|
${task_run} Get Text ${task_status}
|
|
|
|
|
Log 作业状态:${task_run}
|
|
|
|
|
Exit For Loop If '${task_run}' == '本次备份成功'
|
|
|
|
|
Sleep 2s
|
|
|
|
|
点击按钮 id=dpm_tab_work_workPolicyName_search_btn
|
|
|
|
|
END
|
|
|
|
|
Log 策略执行成功
|
|
|
|
|
|
|
|
|
|
确认产生完全备份集
|
|
|
|
|
# 进入备份集页面
|
|
|
|
|
点击按钮 xpath=//span[text()='备份集']
|
|
|
|
|
# 按照策略查询备份集
|
|
|
|
|
输入文本 id=backTabPolicy ${PolicyName}
|
|
|
|
|
点击按钮 id=dpm_tab_backupset_searchFilter_span
|
|
|
|
|
# 确认备份集
|
|
|
|
|
${backupSetPolicyName} Get Text xpath=//div[@id="backupSetTable"]//tr[@class=' ev_dhx_web']/td[4][text()]
|
|
|
|
|
Log 查询到的备份集的策略为:${backupSetPolicyName}
|
2023-12-05 02:16:25 +00:00
|
|
|
|
Should Be Equal ${backupSetPolicyName} ${PolicyName}
|
2023-12-04 16:56:23 +00:00
|
|
|
|
Log 查询到的备份集的策略和预期相符
|
|
|
|
|
${backupSetstatus} Get Text xpath=//div[@id="backupSetTable"]//tr[@class=' ev_dhx_web']/td[last()-1][text()]
|
|
|
|
|
Log 查询到的备份集的状态为:${backupSetstatus}
|
|
|
|
|
Should Be Equal ${backupSetstatus} 已完成
|
|
|
|
|
Log 已产生完全的备份集
|