# CDT Regression Testing # Set the MAINURL via the command line
# run as:  
# 1) execute a .profile that sets and exports DEV2 and DEV4
# 2) robot --variable MAINURL:$DEV# filename.robot


*** Variables ***

#  ${MAINURL} is now set from the command line per above
|  ${BROWSER}  |  chrome
|  ${SHORTTIME} | 5s
|  ${LONGTIME} | 180s
|  ${TENMINUTES} | 600s
#|  ${FFPROFILE_DIR} |  /home/dvz/.mozilla/firefox/s87c07vn.AppCZoomed50
|  ${MAINURL} | https://localhost:8080/index.html
|  ${USER_ID} | csituser

*** Keywords ***
|  Setup1  | Open browser | ${MAINURL} | ${BROWSER} | | | | |
|  Setup2  | SLEEP | 2s

# Refresh the ${MAINURL} which is used as starting point within each test file
| RefreshMainURL
| | Go To | ${MAINURL}
| | Wait Until Page Contains | WELCOME TO CONTROLLER DESIGN TOOL | ${LONGTIME}


# Make sure you can get to APPC server - Wrap in implicit wait then reset
# Want to wait a few seconds to see if Server error appears. 
# Can't add an explicit wait to "Page should not contain"
| CheckForServerError 
| | [Arguments] | ${WAITTIME} 
| | Set Selenium Implicit Wait  | ${WAITTIME} 
| | Page Should Not Contain | Error in connecting to APPC Server
| | Set Selenium Implicit Wait  | 0


| ClickButtonByContent
| | [Arguments] |  ${TEXT}
| | ${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;
| | Return From Keyword | ${RETVAL}

| ClickButtonByClassName
| | [Arguments] |  ${TEXT}
| | ${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;
| | Return From Keyword | ${RETVAL}

| EnterElementByClassName
| | [Arguments] |  ${THECLASS} | ${INPUTVALUE}
| | ${RETVAL} | Execute Javascript | function enterElementByClassName(theclass,theinput) { var element  = document.querySelector('.'+theclass).value = theinput; return 0 }; var retval=enterElementByClassName(${THECLASS},${INPUTVALUE}); return retval;
| | Return From Keyword | ${RETVAL}

*** Settings ***

|  Library  |  ExtendedSelenium2Library
|  Library  |  OperatingSystem
#|  Library  |  Dialogs
|  Library  |  DateTime


