Skip to content

Commit 26ccf88

Browse files
committed
Fixed cookies tests where we needed aprior knowledge of expiry
There were a couple tests when I updated the expiry date to variable based upon today had hard coded expected values. To fix I added another far in the future (from now) date to use for these few tests. This actually might be complicating things too much and instead just stay with anouther cookie and hard code it two years out.
1 parent 6ddfc24 commit 26ccf88

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

atest/acceptance/keywords/cookies.robot

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Get Cookies
1414

1515
Get Cookies As Dict
1616
${cookies}= Get Cookies as_dict=True
17-
${expected_cookies}= Create Dictionary test=seleniumlibrary another=value
17+
${expected_cookies}= Create Dictionary test=seleniumlibrary another=value far_future=timemachine
1818
Dictionaries Should Be Equal ${expected_cookies} ${cookies}
1919

2020
App Sees Cookie Set By Selenium
@@ -50,7 +50,7 @@ Delete Cookie
5050
[Tags] Known Issue Safari
5151
Delete Cookie test
5252
${cookies} = Get Cookies
53-
Should Be Equal ${cookies} another=value
53+
Should Be Equal ${cookies} far_future=timemachine; another=value
5454

5555
Non-existent Cookie
5656
Run Keyword And Expect Error
@@ -72,12 +72,12 @@ Get Cookies As Dict When There Are None
7272

7373
Test Get Cookie Object Expiry
7474
${cookie} = Get Cookie another
75-
Should Be Equal As Integers ${cookie.expiry.year} 2024
76-
Should Be Equal As Integers ${cookie.expiry.month} 10
77-
Should Be Equal As Integers ${cookie.expiry.day} 29
78-
Should Be Equal As Integers ${cookie.expiry.hour} 19
79-
Should Be Equal As Integers ${cookie.expiry.minute} 36
80-
Should Be Equal As Integers ${cookie.expiry.second} 51
75+
Should Be Equal As Integers ${cookie.expiry.year} ${tomorrow_thistime_datetime.year}
76+
Should Be Equal As Integers ${cookie.expiry.month} ${tomorrow_thistime_datetime.month}
77+
Should Be Equal As Integers ${cookie.expiry.day} ${tomorrow_thistime_datetime.day}
78+
Should Be Equal As Integers ${cookie.expiry.hour} ${tomorrow_thistime_datetime.hour}
79+
Should Be Equal As Integers ${cookie.expiry.minute} ${tomorrow_thistime_datetime.minute}
80+
Should Be Equal As Integers ${cookie.expiry.second} ${tomorrow_thistime_datetime.second}
8181
Should Be Equal As Integers ${cookie.expiry.microsecond} 0
8282

8383
Test Get Cookie Object Domain
@@ -113,14 +113,17 @@ Test Get Cookie Keyword Logging
113113
... domain=localhost
114114
... secure=False
115115
... httpOnly=False
116-
... expiry=2024-10-29 19:36:51
116+
... expiry=2026-9-15 11:22:33
117117
... extra={'sameSite': 'Lax'}
118-
${cookie} = Get Cookie another
118+
${cookie} = Get Cookie far_future
119119

120120
*** Keyword ***
121121
Add Cookies
122122
Delete All Cookies
123123
Add Cookie test seleniumlibrary
124124
${now} = Get Current Date
125125
${tomorrow_thistime} = Add Time To Date ${now} 1 day
126+
${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime
127+
Set Suite Variable ${tomorrow_thistime_datetime}
126128
Add Cookie another value expiry=${tomorrow_thistime}
129+
Add Cookie far_future timemachine expiry=1789485753 # 2026-09-15 11:22:33

0 commit comments

Comments
 (0)