blob: d59fefa8c3f40154c4066fff4beb578047e01c90 [file] [log] [blame]
Stanislav Chlebec050ef542018-10-03 08:45:16 +02001*** Settings ***
2Library Selenium2Library
3Library OperatingSystem
4Library DateTime
5Library String
6Library Collections
7
8
9*** Keywords ***
10Get 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