changing simulator and endpoints for change management testing
[integration/csit.git] / tests / vid / resources / keywords / login_vid_keywords.robot
1 *** Settings ***
2 Documentation     Collection of util keywords for logging to VID
3 Library             Selenium2Library
4 Library    Collections
5 Library         String
6 Library               RequestsLibrary
7 Library           OperatingSystem
8 Resource      ../../../common.robot
9
10 *** Variables ***
11 ${GLOBAL_APPLICATION_ID}           robot-ete
12 ${GLOBAL_SELENIUM_BROWSER}        chrome
13 ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}        Create Dictionary
14 ${GLOBAL_SELENIUM_DELAY}          0
15 ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}        5
16 ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}        25
17 ${VID_ENV}            /vid
18 ${VID_ENDPOINT}    http://localhost:8080
19 ${VID_LOGIN_URL}                ${VID_ENDPOINT}${VID_ENV}/login.htm
20 ${VID_HEALTHCHECK_PATH}    ${VID_ENV}/api/v2/users
21 ${VID_HOME_URL}                ${VID_ENDPOINT}${VID_ENV}/welcome.htm
22 ${GLOBAL_VID_USERNAME}        demo
23 ${GLOBAL_VID_PASSWORD}        Kp8bJ4SXszM0WX
24
25
26 *** Keywords ***
27 Setup Browser
28     [Documentation]   Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER}
29     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'firefox'    Setup Browser Firefox
30     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'chrome'    Setup Browser Chrome
31     Log    Running with ${GLOBAL_SELENIUM_BROWSER}
32
33 Setup Browser Firefox
34     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX  sys, selenium.webdriver
35     Set To Dictionary   ${dc}   elementScrollBehavior    1
36     Create Webdriver    Firefox    desired_capabilities=${dc}
37     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
38
39 Setup Browser Chrome
40     #${os}=   Get Normalized Os
41     #Log    Normalized OS=${os}
42     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
43     Call Method    ${chrome options}    add_argument    no-sandbox
44     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
45     Set To Dictionary   ${dc}   elementScrollBehavior    1
46     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}
47     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
48
49 Handle Proxy Warning
50     [Documentation]    Handle Intermediate Warnings from Proxies
51     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_TITLE}
52     Return From Keyword if    '${status}' != 'PASS'
53     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
54     Return From Keyword if    '${status}' != 'PASS'
55     Return From Keyword if    "${GLOBAL_PROXY_WARNING_TITLE}" == ''
56     Return From Keyword if    "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == ''
57     ${test}    ${value}=    Run keyword and ignore error    Title Should Be     ${GLOBAL_PROXY_WARNING_TITLE}
58     Run keyword If    '${test}' == 'PASS'    Click Element    xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}