Skip to content

Commit 6ae07af

Browse files
authored
Fix html5 date types to support different locale (robotframework#1345)
Fixes robotframework#1344
1 parent 1149692 commit 6ae07af

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ before_script:
7070
- if [ "$JYTHON" == "true" ]; then
7171
$INTERPRETER -m pip install mockito;
7272
$INTERPRETER -m pip install robotstatuschecker;
73+
$INTERPRETER -m pip install python-dateutil;
7374
$INTERPRETER -m pip install -r requirements.txt;
7475
else
7576
$INTERPRETER -m pip install -r requirements-dev.txt;

atest/acceptance/keywords/input_html5.robot renamed to atest/acceptance/keywords/textfields_html5.robot

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
*** Setting ***
22
Test Setup Go To Page "forms/html5_input_types.html"
33
Resource ../resource.robot
4+
Library ../../resources/testlibs/date_parser.py
45

56
*** Test Cases ***
67
Input field type color
7-
Input Text id:color \#72da19
8+
Input Text id:color \#72da19
89
${value} = Get Value id:color
910
Log ${value} # Get value does not return the changed value
1011

1112
Input field type date
12-
Input Text id:date 03/01/2019
13-
${value} = Get Value id:date
14-
Should Be Equal As Strings ${value} 2019-03-01
13+
${date} = Set Variable 11/22/2019
14+
Input Text id:date ${date}
15+
${value} = Get Value id:date
16+
${date} ${value} = Parse Two Dates ${date} ${value}
17+
Should Be Equal ${value} ${date}
1518

1619
Input field type datetime-local
17-
Input Text id:datetime-local 12/24/201909:34AM
18-
${value} = Get Value id:datetime-local
19-
Log ${value} # Get value does not return the value
20+
${date} = Set Variable 04-03-002019 01:45PM
21+
Input Text id:datetime-local ${date}
22+
${value} = Get Value id:datetime-local
23+
${date} ${value} = Parse Two Dates ${date} ${value}
24+
Should Be Equal ${value} ${date}
2025

2126
Input field type email
2227
Input Text id:email [email protected]
@@ -49,16 +54,18 @@ Input field type tel
4954
Should Be Equal As Strings ${value} 123 456 567
5055

5156
Input field type time
52-
Input Text id:time 02:34AM
57+
${time} = Set Variable 02:34PM
58+
Input Text id:time ${time}
5359
${value} = Get Value id:time
54-
Should Be Equal As Strings ${value} 02:34
60+
${time} ${value} = Parse Two Dates ${time} ${value}
61+
Should Be Equal ${value} ${time}
5562

5663
Input field type url
5764
Input Text id:url https://github.com/robotframework/SeleniumLibrary
5865
${value} = Get Value id:url
5966
Should Be Equal As Strings ${value} https://github.com/robotframework/SeleniumLibrary
6067

6168
Input field type week
62-
Input Text id:week 012019
69+
Input Text id:week 452019
6370
${value} = Get Value id:week
64-
Should Be Equal As Strings ${value} 2019-W01
71+
Should Be Equal As Strings ${value} 2019-W45
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from dateutil.parser import parse
2+
3+
4+
def parse_two_dates(date1, date2):
5+
return parse(date1), parse(date2)

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
mockito >= 1.0.0
55
robotstatuschecker
66
approvaltests >= 0.2.4
7+
python-dateutil >= 2.8.0
78

89
# Include normal dependencies from requirements.txt. Makes it possible to use
910
# requirements-dev.txt as a single requirement file in PyCharm and other IDEs.

0 commit comments

Comments
 (0)