diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2017-10-23 15:01:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-10-23 15:01:58 +0000 |
commit | 41a427a8806633f4dd93faa73d9dbe891c91f57b (patch) | |
tree | 084241631f5ee6da31343e77eaaa8fdf4dbe2ea1 /test | |
parent | ea847c9ad34abc8f5541a26f5a46af2a9278d4e0 (diff) | |
parent | 6b311bc3bd5d10d25806519506325faa869fa7a2 (diff) |
Merge "Add CSIT test for VID login API"
Diffstat (limited to 'test')
-rw-r--r-- | test/csit/plans/vid/healthCheck/setup.sh | 2 | ||||
-rw-r--r-- | test/csit/plans/vid/healthCheck/testplan.txt | 1 | ||||
-rw-r--r-- | test/csit/tests/vid/login/__init__.robot | 2 | ||||
-rw-r--r-- | test/csit/tests/vid/login/test1.robot | 78 |
4 files changed, 83 insertions, 0 deletions
diff --git a/test/csit/plans/vid/healthCheck/setup.sh b/test/csit/plans/vid/healthCheck/setup.sh index afe9ea7ba..a117a6c78 100644 --- a/test/csit/plans/vid/healthCheck/setup.sh +++ b/test/csit/plans/vid/healthCheck/setup.sh @@ -18,6 +18,8 @@ # # Place the scripts in run order: +/usr/bin/Xvfb :0 -screen 0 1024x768x24& +export DISPLAY=:0 source ${WORKSPACE}/test/csit/scripts/vid/clone_and_setup_vid_data.sh diff --git a/test/csit/plans/vid/healthCheck/testplan.txt b/test/csit/plans/vid/healthCheck/testplan.txt index ffbb593ca..92d8b0584 100644 --- a/test/csit/plans/vid/healthCheck/testplan.txt +++ b/test/csit/plans/vid/healthCheck/testplan.txt @@ -1,3 +1,4 @@ # Test suites are relative paths under [integration.git]/test/csit/tests/. # Place the suites in run order. vid/healthCheck +vid/login diff --git a/test/csit/tests/vid/login/__init__.robot b/test/csit/tests/vid/login/__init__.robot new file mode 100644 index 000000000..10faf380f --- /dev/null +++ b/test/csit/tests/vid/login/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation VID - Login diff --git a/test/csit/tests/vid/login/test1.robot b/test/csit/tests/vid/login/test1.robot new file mode 100644 index 000000000..12b23b725 --- /dev/null +++ b/test/csit/tests/vid/login/test1.robot @@ -0,0 +1,78 @@ +*** Settings *** +Documentation Logins to VID +Library ExtendedSelenium2Library +Library Collections +Library String +Library RequestsLibrary +#Library OSUtils +Library OperatingSystem + +*** Variables *** +${GLOBAL_APPLICATION_ID} robot-ete +${GLOBAL_SELENIUM_BROWSER} chrome +${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary +${GLOBAL_SELENIUM_DELAY} 0 +${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 +${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 +${VID_ENV} /vid +${VID_ENDPOINT} http://localhost:8080 +${VID_LOGIN_URL} ${VID_ENDPOINT}${VID_ENV}/login.htm +${VID_HEALTHCHECK_PATH} ${VID_ENV}/api/v2/users +${VID_HOME_URL} ${VID_ENDPOINT}${VID_ENV}/welcome.htm +${GLOBAL_VID_USERNAME} demo +${GLOBAL_VID_PASSWORD} Kp8bJ4SXszM0WX + + +*** Test Cases *** +Login To VID GUI + [Documentation] Logs in to VID GUI + # Setup Browser Now being managed by test case + Setup Browser + Go To ${VID_LOGIN_URL} + #Maximize Browser Window + Set Selenium Speed ${GLOBAL_SELENIUM_DELAY} + Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} + Log Logging in to ${VID_ENDPOINT}${VID_ENV} + #Handle Proxy Warning + Title Should Be Login + Input Text xpath=//input[@id='loginId'] ${GLOBAL_VID_USERNAME} + Input Password xpath=//input[@id='password'] ${GLOBAL_VID_PASSWORD} + Click Button xpath=//input[@id='loginBtn'] + Wait Until Page Contains Welcome to VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} + Log Logged in to ${VID_ENDPOINT}${VID_ENV} + + +*** Keywords *** +Setup Browser + [Documentation] Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER} + Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'firefox' Setup Browser Firefox + Run Keyword If '${GLOBAL_SELENIUM_BROWSER}' == 'chrome' Setup Browser Chrome + Log Running with ${GLOBAL_SELENIUM_BROWSER} + +Setup Browser Firefox + ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX sys, selenium.webdriver + Set To Dictionary ${dc} elementScrollBehavior 1 + Create Webdriver Firefox desired_capabilities=${dc} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} + +Setup Browser Chrome + #${os}= Get Normalized Os + #Log Normalized OS=${os} + ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys + Call Method ${chrome options} add_argument no-sandbox + ${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver + Set To Dictionary ${dc} elementScrollBehavior 1 + Create Webdriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc} + Set Global Variable ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} ${dc} + +Handle Proxy Warning + [Documentation] Handle Intermediate Warnings from Proxies + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_TITLE} + Return From Keyword if '${status}' != 'PASS' + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} + Return From Keyword if '${status}' != 'PASS' + Return From Keyword if "${GLOBAL_PROXY_WARNING_TITLE}" == '' + Return From Keyword if "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == '' + ${test} ${value}= Run keyword and ignore error Title Should Be ${GLOBAL_PROXY_WARNING_TITLE} + Run keyword If '${test}' == 'PASS' Click Element xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH} +
\ No newline at end of file |