Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | # CDT Regression Testing # Set the MAINURL via the command line |
| 2 | # run as: |
| 3 | # 1) execute a .profile that sets and exports DEV2 and DEV4 |
| 4 | # 2) robot --variable MAINURL:$DEV# filename.robot |
| 5 | |
| 6 | |
| 7 | *** Variables *** |
| 8 | |
| 9 | # ${MAINURL} is now set from the command line per above |
| 10 | | ${BROWSER} | chrome |
| 11 | | ${SHORTTIME} | 5s |
| 12 | | ${LONGTIME} | 90s |
| 13 | | ${TENMINUTES} | 600s |
| 14 | #| ${FFPROFILE_DIR} | /home/dvz/.mozilla/firefox/s87c07vn.AppCZoomed50 |
| 15 | | ${MAINURL} | http://localhost:8080/index.html |
| 16 | | ${USER_ID} | csituser |
| 17 | |
| 18 | *** Keywords *** |
| 19 | | Setup1 | Open browser | ${MAINURL} | ${BROWSER} | | | | | |
| 20 | | Setup2 | SLEEP | 2s |
| 21 | |
| 22 | # Refresh the ${MAINURL} which is used as starting point within each test file |
| 23 | | RefreshMainURL |
| 24 | | | Go To | ${MAINURL} |
| 25 | | | Wait Until Page Contains | WELCOME TO CONTROLLER DESIGN TOOL | ${LONGTIME} |
| 26 | |
| 27 | |
| 28 | # Make sure you can get to APPC server - Wrap in implicit wait then reset |
| 29 | # Want to wait a few seconds to see if Server error appears. |
| 30 | # Can't add an explicit wait to "Page should not contain" |
| 31 | | CheckForServerError |
| 32 | | | [Arguments] | ${WAITTIME} |
| 33 | | | Set Selenium Implicit Wait | ${WAITTIME} |
| 34 | | | Page Should Not Contain | Error in connecting to APPC Server |
| 35 | | | Set Selenium Implicit Wait | 0 |
| 36 | |
| 37 | |
| 38 | | ClickButtonByContent |
| 39 | | | [Arguments] | ${TEXT} |
| 40 | | | ${RETVAL} | Execute Javascript | function clickButtonByTextContent(buttontext) { var buttons = document.querySelectorAll('button'); for (var i=0, l=buttons.length; i<l; i++) { if (buttons[i].firstChild.nodeValue == buttontext) { buttons[i].click(); return 0 } } return 1 }; var retval=clickButtonByTextContent('${TEXT}'); return retval; |
| 41 | | | Return From Keyword | ${RETVAL} |
| 42 | |
| 43 | | ClickButtonByClassName |
| 44 | | | [Arguments] | ${TEXT} |
| 45 | | | ${RETVAL} | Execute Javascript | function clickButtonByClassName(theclass) { var buttons = document.querySelectorAll('button'); for (var i=0, l=buttons.length; i<l; i++) { if (buttons[i].firstChild.nodeValue == theclass) { buttons[i].click(); return 0 } } return 1 }; var retval=clickButtonByClassName(${TEXT}); return retval; |
| 46 | | | Return From Keyword | ${RETVAL} |
| 47 | |
| 48 | | EnterElementByClassName |
| 49 | | | [Arguments] | ${THECLASS} | ${INPUTVALUE} |
| 50 | | | ${RETVAL} | Execute Javascript | function enterElementByClassName(theclass,theinput) { var element = document.querySelector('.'+theclass).value = theinput; return 0 }; var retval=enterElementByClassName(${THECLASS},${INPUTVALUE}); return retval; |
| 51 | | | Return From Keyword | ${RETVAL} |
| 52 | |
| 53 | *** Settings *** |
| 54 | |
| 55 | | Library | ExtendedSelenium2Library |
| 56 | | Library | OperatingSystem |
| 57 | #| Library | Dialogs |
| 58 | | Library | DateTime |
| 59 | |
| 60 | |