OOF SMS CSIT
[integration/csit.git] / tests / vid / login / test1.robot
1 *** Settings ***
2 Documentation     Logins to VID
3 Library             Selenium2Library
4 Library    Collections
5 Library         String
6 Library               RequestsLibrary
7 #Library           OSUtils
8 Library           OperatingSystem
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}        15
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 *** Test Cases ***
27 Login To VID GUI
28     [Documentation]   Logs in to VID GUI
29     # Setup Browser Now being managed by test case
30     Setup Browser
31     Go To    ${VID_LOGIN_URL}
32     #Maximize Browser Window
33     Set Selenium Speed    ${GLOBAL_SELENIUM_DELAY}
34     Set Browser Implicit Wait    ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
35     Log    Logging in to ${VID_ENDPOINT}${VID_ENV}
36     #Handle Proxy Warning
37     Title Should Be    Login
38     Input Text    xpath=//input[@id='loginId']    ${GLOBAL_VID_USERNAME}
39     Input Password    xpath=//input[@id='password']    ${GLOBAL_VID_PASSWORD}
40     Click Button    xpath=//input[@id='loginBtn']
41     Wait Until Page Contains  Welcome to VID    ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
42     Log    Logged in to ${VID_ENDPOINT}${VID_ENV}
43
44         
45 *** Keywords ***
46 Setup Browser
47     [Documentation]   Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER}
48     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'firefox'    Setup Browser Firefox
49     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'chrome'    Setup Browser Chrome
50     Log    Running with ${GLOBAL_SELENIUM_BROWSER}
51     
52 Setup Browser Firefox
53     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX  sys, selenium.webdriver
54     Set To Dictionary   ${dc}   elementScrollBehavior    1 
55     Create Webdriver    Firefox    desired_capabilities=${dc}
56     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
57            
58 Setup Browser Chrome
59     #${os}=   Get Normalized Os 
60     #Log    Normalized OS=${os}
61     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
62     Call Method    ${chrome options}    add_argument    no-sandbox
63     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
64     Set To Dictionary   ${dc}   elementScrollBehavior    1
65     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}  
66     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}       
67
68 Handle Proxy Warning    
69     [Documentation]    Handle Intermediate Warnings from Proxies
70     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_TITLE}           
71     Return From Keyword if    '${status}' != 'PASS'
72     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}          
73     Return From Keyword if    '${status}' != 'PASS'
74     Return From Keyword if    "${GLOBAL_PROXY_WARNING_TITLE}" == ''
75     Return From Keyword if    "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == ''
76     ${test}    ${value}=    Run keyword and ignore error    Title Should Be     ${GLOBAL_PROXY_WARNING_TITLE}
77     Run keyword If    '${test}' == 'PASS'    Click Element    xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
78