目 录CONTENT

文章目录

robotframework案例

懿曲折扇情
2022-07-17 / 0 评论 / 5 点赞 / 61 阅读 / 904 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-07-17,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
广告 广告

一、公共方法

common.robot

*** Settings ***
Library           Selenium2Library

*** Keywords ***
wait element
    [Arguments]    ${LOCATOR}
    sleep    2
    Wait Until Element Is Visible    ${LOCATOR}
    Wait Until Element Is Enabled    ${LOCATOR}
    Wait Until Page Contains Element    ${LOCATOR}
    SLEEP    2

wait input element
    [Arguments]    ${LOCATOR}    ${INPUT_TEXT}
    wait element    ${LOCATOR}
    Input Text    ${LOCATOR}    ${INPUT_TEXT}

wait click element
    [Arguments]    ${LOCATOR}
    wait element    ${LOCATOR}
    Click Element    ${LOCATOR}

Login_Beijing
    wait input element    css=#userNameId input    gwx613100
    wait input element    css=#pwdId input    Bigdata_2013
    wait click element    css=#loginForm #buttonArea:nth-child(1) #btn_submit
    Wait Until Page Contains    Quick Start Guide
    Sleep    2

Login_retry
    Open Browser    https://console.huaweicloud.com/vpc/?region=cn-north-1&locale=en-us#/vpc/vpcmanager/dashboard    chrome
    Maximize Browser Window
    Set Window Size    1920    1080
    ${winsize}    Get Window Size
    log    ${winsize}
    Wait Until Keyword Succeeds    3x    3s    Login_Beijing

enter dashboard
    sleep    1
    go to    https://console.huaweicloud.com/vpc/?region=cn-north-1&locale=en-us#/vpc/vpcmanager/dashboard
    Wait Until Page Contains    Quick Start Guide
    sleep    2

close new select old
    Close Window
    Select Window

二、测试套-测试用例

Dashborad-All.robot

*** Settings ***
Suite Setup       Login_retry
Suite Teardown    Close Browser
Library           Selenium2Library
Resource          common.txt
Resource          VPC_Resource_Dashbord.txt

*** Test Cases ***
Dashborad-To-VPC
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPC

Dashborad-To-SecurityGroup
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-SecurityGroup

Dashborad-To-Network ACLs
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Network ACLs

Dashborad-To-Eips
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Eips

Dashborad-To-ShareBandwidth
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-ShareBandwidth

Dashborad-To-NAT Gateways
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-NAT Gateways

Dashborad-To-Elastic Load Balance
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Elastic Load Balance

Dashborad-To-Peering Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Peering Connections

Dashborad-To-VPC Endpoints
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPC Endpoints

Dashborad-To-VPN Gateways
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPN Gateways

Dashborad-To-Direct Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Direct Connections

Dashborad-To-Cloud Connection
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Cloud Connection

Dashborad-To-VPN Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPN Connections

三、资源文件

VPC_Resource_Dashbord.robot

*** Settings ***
Library           Selenium2Library
Resource          common.txt

*** Keywords ***
Dashborad-To-VPC
    enter dashboard
    wait click element    css=#_vpc
    wait click element    jquery=button:contains(Create VPC)
    wait input element    css=input[ng-model="$ctrl.vpcNameBox.value"]    vpc-temp01
    Wait Until Page Contains    Basic Information

Dashborad-To-SecurityGroup
    enter dashboard
    wait click element    css=#_securityGroup
    wait click element    jquery=button span:contains(Create Security Group)
    Wait Until Page Contains    Description

Dashborad-To-Network ACLs
    enter dashboard
    wait click element    css=#_firewall
    wait click element    jquery=button span:contains(Create Network ACL)
    Wait Until Page Contains    Description

Dashborad-To-Eips
    enter dashboard
    wait click element    css=#_eip
    wait click element    jquery=button span:contains(Buy EIP)
    Wait Until Page Contains    Billing Mode

Dashborad-To-ShareBandwidth
    enter dashboard
    wait click element    css=#_shareBandwidth
    wait click element    jquery=button span:contains(Buy Shared Bandwidth)
    Wait Until Page Contains    Billing Mode

Dashborad-To-NAT Gateways
    enter dashboard
    wait click element    css=#_nat
    wait click element    jquery=button span:contains(Buy NAT Gateway)
    Wait Until Page Contains    Billing Mode

Dashborad-To-Elastic Load Balance
    enter dashboard
    wait click element    css=#_elb
    wait click element    jquery=button span:contains(Buy Enhanced Load Balancer)
    Wait Until Page Contains    Network Type

Dashborad-To-Peering Connections
    enter dashboard
    wait click element    css=#_peering
    wait click element    jquery=button span:contains(Create VPC Peering Connection)
    Wait Until Page Contains    Local VPC Settings

Dashborad-To-VPC Endpoints
    enter dashboard
    wait click element    css=#_vpcep
    Wait Until Page Contains    Apply for VPC Endpoint OBT
    wait click element    jquery=button:contains(Apply Now)
    Select Window    new
    Wait Until Page Contains    Apply for Open Beta Test
    close new select old

Dashborad-To-VPN Gateways
    enter dashboard
    wait click element    css=#vpngwAll >span
    wait click element    jquery=span:contains(Buy VPN Gateway)
    Wait Until Page Contains    Billing Mode

Dashborad-To-Direct Connections
    enter dashboard
    wait click element    css=#dc_physicalDlines >span
    Wait Until Page Contains    To connect your network to HUAWEI CLOUD, you must first create a connection
    wait click element    css=a[ng-href="#/dc/createPhyDlinePartner"]
    Wait Until Page Contains    Your Equipment Room Address

Dashborad-To-Cloud Connection
    enter dashboard
    wait click element    css=#cloudConnect_cnsAll >span
    wait click element    css=#createCCBtn > span.cti-btn-label.ng-binding.ng-scope
    Wait Until Page Contains    Description

Dashborad-To-VPN Connections
    enter dashboard
    wait click element    css=#vpngwAll >span
    wait click element    jquery=span:contains(Buy VPN Gateway)
    Wait Until Page Contains    Billing Mode

测试用例
Test_Vpcs.robot

*** Settings ***
Suite Setup       Login_retry
Suite Teardown    Close Browser
Library           Selenium2Library
Resource          common.txt

*** Test Cases ***
Create_vpc
    [Tags]    hec
    wait click element    css=#_vpc
    wait click element    jquery=button:contains(Create VPC)
    wait input element    css=input[ng-model="$ctrl.vpcNameBox.value"]    vpc-temp01
    Wait Until Page Contains    Basic Information

*** Keywords ***
5

评论区