Stanislav Chlebec | 050ef54 | 2018-10-03 08:45:16 +0200 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Selenium2Library |
| 3 | Library OperatingSystem |
| 4 | Library DateTime |
| 5 | Library String |
| 6 | Library Collections |
| 7 | |
| 8 | |
| 9 | *** Keywords *** |
| 10 | Get Server time |
| 11 | [Documentation] Getting server time to update the json request |
| 12 | [Arguments] ${RequestFile} |
| 13 | |
| 14 | ${date}= Get Current Date time_zone=local result_format=%Y-%m-%dT%H:%M:%S.%fZ exclude_millis=False |
| 15 | |
| 16 | #updating the request file with the server time |
| 17 | ${file_content}= Get File ${RequestFile} |
| 18 | @{list}= Split to lines ${file_content} |
| 19 | ${data}= Get from list ${list} 5 |
| 20 | @{splitted_string}= Split String ${data} : 1 |
| 21 | ${time}= Get From List ${splitted_string} 1 |
| 22 | Log ${time} |
| 23 | @{splitted_string_time}= Split String ${time} " 2 |
| 24 | ${times1}= Get From List ${splitted_string_time} 1 |
| 25 | Log ${times1} |
| 26 | ${replaced_string}= Replace String ${data} ${times1} ${date} |
| 27 | @{list1}= Split to lines ${file_content} |
| 28 | Remove from list ${list1} 5 |
| 29 | Insert into list ${list1} 5 ${replaced_string} |
| 30 | Remove File ${RequestFile} |
| 31 | :FOR ${line} IN @{list1} |
| 32 | \ Append to File ${RequestFile} ${line} encoding=UTF-8 |
| 33 | \ Append to File ${RequestFile} ${\n} encoding=UTF-8 |