DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps |
| 3 | Library ExtendedSelenium2Library |
| 4 | Library Collections |
| 5 | Library String |
| 6 | Library RequestsLibrary |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 7 | Library UUID |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 8 | Resource ../global_properties.robot |
| 9 | Resource ../browser_setup.robot |
| 10 | |
| 11 | *** Variables *** |
| 12 | ${VID_ENV} /vid |
| 13 | ${VID_LOGIN_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/login_external.htm |
Jerry Flood | 5db693b | 2017-05-24 08:52:39 -0400 | [diff] [blame] | 14 | ${VID_HEALTHCHECK_PATH} ${VID_ENV}/api/v2/users |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 15 | ${VID_HOME_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/vidhome.htm |
| 16 | |
| 17 | *** Keywords *** |
| 18 | Run VID Health Check |
| 19 | [Documentation] Logs in to VID GUI |
| 20 | ${resp}= Run VID Get Request ${VID_HEALTHCHECK_PATH} |
| 21 | Should Be Equal As Strings ${resp.status_code} 200 |
| 22 | Should Be String ${resp.json()[0]['loginId']} |
| 23 | |
| 24 | Run VID Get Request |
| 25 | [Documentation] Runs an VID get request |
| 26 | [Arguments] ${data_path} |
| 27 | ${auth}= Create List ${GLOBAL_VID_HEALTH_USERNAME} ${GLOBAL_VID_HEALTH_PASSWORD} |
| 28 | Log Creating session ${GLOBAL_VID_SERVER} |
| 29 | ${session}= Create Session vid ${GLOBAL_VID_SERVER} auth=${auth} |
| 30 | ${uuid}= Generate UUID |
| 31 | ${headers}= Create Dictionary username=${GLOBAL_VID_HEALTH_USERNAME} password=${GLOBAL_VID_HEALTH_PASSWORD} Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 32 | ${resp}= Get Request vid ${data_path} headers=${headers} |
| 33 | Log Received response from vid ${resp.text} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 34 | [Return] ${resp} |
| 35 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 36 | Login To VID GUI |
| 37 | [Documentation] Logs in to VID GUI |
| 38 | # Setup Browser Now being managed by test case |
| 39 | ##Setup Browser |
| 40 | Go To ${VID_LOGIN_URL} |
| 41 | Maximize Browser Window |
| 42 | Set Selenium Speed ${GLOBAL_SELENIUM_DELAY} |
| 43 | Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} |
| 44 | Log Logging in to ${GLOBAL_VID_SERVER}${VID_ENV} |
| 45 | Handle Proxy Warning |
| 46 | Title Should Be VID Login |
| 47 | Input Text xpath=//input[@ng-model='loginId'] ${GLOBAL_VID_USERNAME} |
| 48 | Input Password xpath=//input[@ng-model='password'] ${GLOBAL_VID_PASSWORD} |
| 49 | Click Button xpath=//input[@id='loginBtn'] |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 50 | Wait Until Page Contains Element xpath=//div[@class='applicationWindow'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 51 | Log Logged in to ${GLOBAL_VID_SERVER}${VID_ENV} |
| 52 | |
| 53 | Go To VID HOME |
| 54 | [Documentation] Naviage to VID Home |
| 55 | Go To ${VID_HOME_URL} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 56 | Wait Until Page Contains Element xpath=//div[@class='applicationWindow'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} |
| 57 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 58 | Click On Button When Enabled |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 59 | [Arguments] ${xpath} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 60 | Wait Until Page Contains Element xpath=${xpath} ${timeout} |
| 61 | Wait Until Element Is Enabled xpath=${xpath} ${timeout} |
| 62 | Click Button xpath=${xpath} |
| 63 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 64 | Click On Element When Visible |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 65 | [Arguments] ${xpath} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 66 | Wait Until Page Contains Element xpath=${xpath} ${timeout} |
| 67 | Wait Until Element Is Visible xpath=${xpath} ${timeout} |
| 68 | Click Element xpath=${xpath} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 69 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 70 | Select From List When Enabled |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 71 | [Arguments] ${xpath} ${value} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 72 | Wait Until Page Contains Element xpath=${xpath} ${timeout} |
| 73 | Wait Until Element Is Enabled xpath=${xpath} ${timeout} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 74 | Select From List xpath=${xpath} ${value} |
| 75 | |
| 76 | Input Text When Enabled |
| 77 | [Arguments] ${xpath} ${value} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 78 | Wait Until Page Contains Element xpath=${xpath} ${timeout} |
| 79 | Wait Until Element Is Enabled xpath=${xpath} ${timeout} |
| 80 | Input Text xpath=${xpath} ${value} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 81 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 82 | Parse Request Id |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 83 | [Arguments] ${mso_response_text} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 84 | ${request_list}= Split String ${mso_response_text} 202)\n 1 |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 85 | ${clean_string}= Replace String ${request_list[1]} \n ${empty} |
| 86 | ${json}= To Json ${clean_string} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 87 | ${request_id}= Catenate ${json['requestReferences']['requestId']} |
| 88 | [Return] ${request_id} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 89 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 90 | Parse Instance Id |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 91 | [Arguments] ${mso_response_text} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 92 | ${request_list}= Split String ${mso_response_text} 202)\n 1 |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 93 | ${json}= To Json ${request_list[1]} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 94 | ${request_id}= Catenate ${json['requestReferences']['instanceId']} |
| 95 | [Return] ${request_id} |