前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >robotframework案例

robotframework案例

作者头像
懿曲折扇情
发布2022-08-24 12:11:36
6760
发布2022-08-24 12:11:36
举报
文章被收录于专栏:建帅技术分享

一、公共方法

common.robot

代码语言:javascript
复制
*** 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

代码语言:javascript
复制
*** 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

代码语言:javascript
复制
*** 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

代码语言:javascript
复制
*** 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 ***
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、公共方法
  • 二、测试套-测试用例
  • 三、资源文件
相关产品与服务
私有网络
私有网络(Virtual Private Cloud,VPC)是基于腾讯云构建的专属云上网络空间,为您在腾讯云上的资源提供网络服务,不同私有网络间完全逻辑隔离。作为您在云上的专属网络空间,您可以通过软件定义网络的方式管理您的私有网络 VPC,实现 IP 地址、子网、路由表、网络 ACL 、流日志等功能的配置管理。私有网络还支持多种方式连接 Internet,如弹性 IP 、NAT 网关等。同时,您也可以通过 VPN 连接或专线接入连通腾讯云与您本地的数据中心,灵活构建混合云。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档