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 |
Jerry Flood | edbeafb | 2017-06-01 17:05:42 -0400 | [diff] [blame^] | 13 | ${VID_LOGIN_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/login.htm |
Jerry Flood | 5db693b | 2017-05-24 08:52:39 -0400 | [diff] [blame] | 14 | ${VID_HEALTHCHECK_PATH} ${VID_ENV}/api/v2/users |
Jerry Flood | edbeafb | 2017-06-01 17:05:42 -0400 | [diff] [blame^] | 15 | ${VID_HOME_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/welcome.htm |
| 16 | ${VID_SERVICE_MODELS_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/serviceModels.htm#/models/services |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 17 | |
| 18 | *** Keywords *** |
| 19 | Run VID Health Check |
| 20 | [Documentation] Logs in to VID GUI |
| 21 | ${resp}= Run VID Get Request ${VID_HEALTHCHECK_PATH} |
| 22 | Should Be Equal As Strings ${resp.status_code} 200 |
| 23 | Should Be String ${resp.json()[0]['loginId']} |
| 24 | |
| 25 | Run VID Get Request |
| 26 | [Documentation] Runs an VID get request |
| 27 | [Arguments] ${data_path} |
| 28 | ${auth}= Create List ${GLOBAL_VID_HEALTH_USERNAME} ${GLOBAL_VID_HEALTH_PASSWORD} |
| 29 | Log Creating session ${GLOBAL_VID_SERVER} |
| 30 | ${session}= Create Session vid ${GLOBAL_VID_SERVER} auth=${auth} |
| 31 | ${uuid}= Generate UUID |
| 32 | ${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} |
| 33 | ${resp}= Get Request vid ${data_path} headers=${headers} |
| 34 | Log Received response from vid ${resp.text} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 35 | [Return] ${resp} |
| 36 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 37 | Login To VID GUI |
| 38 | [Documentation] Logs in to VID GUI |
| 39 | # Setup Browser Now being managed by test case |
| 40 | ##Setup Browser |
| 41 | Go To ${VID_LOGIN_URL} |
| 42 | Maximize Browser Window |
| 43 | Set Selenium Speed ${GLOBAL_SELENIUM_DELAY} |
| 44 | Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} |
| 45 | Log Logging in to ${GLOBAL_VID_SERVER}${VID_ENV} |
| 46 | Handle Proxy Warning |
Jerry Flood | edbeafb | 2017-06-01 17:05:42 -0400 | [diff] [blame^] | 47 | Title Should Be Login |
| 48 | Input Text xpath=//input[@id='loginId'] ${GLOBAL_VID_USERNAME} |
| 49 | Input Password xpath=//input[@id='password'] ${GLOBAL_VID_PASSWORD} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 50 | Click Button xpath=//input[@id='loginBtn'] |
Jerry Flood | edbeafb | 2017-06-01 17:05:42 -0400 | [diff] [blame^] | 51 | Wait Until Page Contains Welcome to VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 52 | Log Logged in to ${GLOBAL_VID_SERVER}${VID_ENV} |
| 53 | |
| 54 | Go To VID HOME |
| 55 | [Documentation] Naviage to VID Home |
| 56 | Go To ${VID_HOME_URL} |
Jerry Flood | edbeafb | 2017-06-01 17:05:42 -0400 | [diff] [blame^] | 57 | Wait Until Page Contains Welcome to VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} |
| 58 | |
| 59 | Go To VID Browse Service Models |
| 60 | [Documentation] Naviage to VID Browse Service Models |
| 61 | Go To ${VID_SERVICE_MODELS_URL} |
| 62 | Wait Until Page Contains Browse SDC Service Models ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 63 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 64 | Click On Button When Enabled |
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 Enabled xpath=${xpath} ${timeout} |
| 68 | Click Button xpath=${xpath} |
| 69 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 70 | Click On Element When Visible |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 71 | [Arguments] ${xpath} ${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 Visible xpath=${xpath} ${timeout} |
| 74 | Click Element xpath=${xpath} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 75 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 76 | Select From List When Enabled |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 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} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 80 | Select From List xpath=${xpath} ${value} |
| 81 | |
| 82 | Input Text When Enabled |
| 83 | [Arguments] ${xpath} ${value} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 84 | Wait Until Page Contains Element xpath=${xpath} ${timeout} |
| 85 | Wait Until Element Is Enabled xpath=${xpath} ${timeout} |
| 86 | Input Text xpath=${xpath} ${value} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 87 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 88 | Parse Request Id |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 89 | [Arguments] ${mso_response_text} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 90 | ${request_list}= Split String ${mso_response_text} 202)\n 1 |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 91 | ${clean_string}= Replace String ${request_list[1]} \n ${empty} |
| 92 | ${json}= To Json ${clean_string} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 93 | ${request_id}= Catenate ${json['requestReferences']['requestId']} |
| 94 | [Return] ${request_id} |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 95 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 96 | Parse Instance Id |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 97 | [Arguments] ${mso_response_text} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 98 | ${request_list}= Split String ${mso_response_text} 202)\n 1 |
Jerry Flood | f67ce0e | 2017-03-20 16:59:23 -0400 | [diff] [blame] | 99 | ${json}= To Json ${request_list[1]} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 100 | ${request_id}= Catenate ${json['requestReferences']['instanceId']} |
| 101 | [Return] ${request_id} |