tijao
This commit is contained in:
parent
bade76709f
commit
01f8a929be
|
@ -0,0 +1,17 @@
|
||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource Element.robot
|
||||||
|
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
点击按钮
|
||||||
|
[Arguments] ${button}
|
||||||
|
Set Focus To Element ${button}
|
||||||
|
Click Element ${button}
|
||||||
|
sleep 1s
|
||||||
|
|
||||||
|
输入文本
|
||||||
|
[Arguments] ${path} ${Text}
|
||||||
|
Set Focus To Element ${path}
|
||||||
|
Input Text ${path} ${Text}
|
||||||
|
sleep 1s
|
|
@ -0,0 +1,12 @@
|
||||||
|
*** Settings ***
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${driver} Firefox # 浏览器类型
|
||||||
|
${unbackup} https://10.10.13.197 # 黑方的地址
|
||||||
|
${username} sys_admin # 用户名
|
||||||
|
${passwd} test@2008 # 密码
|
||||||
|
${hostname} Oracle # 主机名
|
||||||
|
${Oracle_SID} orcldb # Oracle实例名
|
||||||
|
${task_select_xpath} xpath=(//span[@class='total ng-binding'])[5][text()] # 作业个数
|
||||||
|
${task_status} xpath=//div[@id="worktable"]/following::tr[@data-index="0"]/td[last()-1]/div[text()] # 作业状态
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
*** 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
|
||||||
|
# 备份集存储
|
||||||
|
点击按钮 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
|
||||||
|
Element Text Should Be xpath=(//td[@align='left'])[2][text()] ${PolicyName}
|
||||||
|
点击按钮 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}
|
||||||
|
Should Be Equal ${backupSetPolicyName} ${PolicyName}
|
||||||
|
Log 查询到的备份集的策略和预期相符
|
||||||
|
${backupSetstatus} Get Text xpath=//div[@id="backupSetTable"]//tr[@class=' ev_dhx_web']/td[last()-1][text()]
|
||||||
|
Log 查询到的备份集的状态为:${backupSetstatus}
|
||||||
|
Should Be Equal ${backupSetstatus} 已完成
|
||||||
|
Log 已产生完全的备份集
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
|
@ -0,0 +1,15 @@
|
||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
||||||
|
Resource ../Resources/KeyWord.robot
|
||||||
|
Resource ../Resources/Element.robot
|
||||||
|
Resource ../Resources/Common.robot
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
Oracle备份
|
||||||
|
登录黑方
|
||||||
|
创建oracle备份策略
|
||||||
|
确定该策略执行成功
|
||||||
|
确认产生完全备份集
|
||||||
|
|
||||||
|
|
||||||
|
[Teardown] Close Browser # Close Browser
|
|
@ -0,0 +1,2 @@
|
||||||
|
*** Settings ***
|
||||||
|
Library Selenium2Library
|
|
@ -0,0 +1,6 @@
|
||||||
|
# encoding=utf-8
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
actime_time = datetime.now().strftime('%Y%m%d%H%M%S')
|
||||||
|
|
||||||
|
PolicyName = "AutoTest-Oracle-Backup-" + actime_time
|
Loading…
Reference in New Issue