@@ -36,8 +36,6 @@ suite(function(env) {
36
36
return driver . quit ( ) ;
37
37
} ) ;
38
38
39
- // Cookie handling is broken.
40
- ignore ( env . browsers ( Browser . PHANTOM_JS , Browser . SAFARI ) ) .
41
39
describe ( 'Cookie Management;' , function ( ) {
42
40
43
41
beforeEach ( async function ( ) {
@@ -154,7 +152,6 @@ suite(function(env) {
154
152
ignore ( env . browsers (
155
153
Browser . ANDROID ,
156
154
Browser . FIREFOX ,
157
- 'legacy-' + Browser . FIREFOX ,
158
155
Browser . IE ) ) .
159
156
it ( 'should retain cookie expiry' , async function ( ) {
160
157
let expirationDelay = 5 * 1000 ;
@@ -164,8 +161,27 @@ suite(function(env) {
164
161
await driver . manage ( ) . addCookie ( cookie ) ;
165
162
await driver . manage ( ) . getCookie ( cookie . name ) . then ( function ( actual ) {
166
163
assert . equal ( actual . value , cookie . value ) ;
167
- // expiry times are exchanged in seconds since January 1, 1970 UTC.
168
- assert . equal ( actual . expiry , Math . floor ( expiry . getTime ( ) / 1000 ) ) ;
164
+
165
+ // expiry times should be in seconds since January 1, 1970 UTC
166
+ try {
167
+ assert . equal ( actual . expiry , Math . floor ( expiry . getTime ( ) / 1000 ) ) ;
168
+ assert . notEqual (
169
+ env . browser . name , Browser . SAFARI ,
170
+ 'Safari cookie expiry fixed; update test' ) ;
171
+ } catch ( ex ) {
172
+ if ( env . browser . name !== Browser . SAFARI
173
+ || ! ( ex instanceof assert . AssertionError ) ) {
174
+ throw ex ;
175
+ }
176
+
177
+ // Safari returns milliseconds (and is off by a few seconds...)
178
+ let diff = Math . abs ( actual . expiry - expiry . getTime ( ) ) ;
179
+ if ( diff > 2000 ) {
180
+ assert . fail (
181
+ actual . expiry , expiry . getTime ( ) ,
182
+ 'Expect Safari to return expiry in millis since epoch ± 2s' ) ;
183
+ }
184
+ }
169
185
} ) ;
170
186
171
187
await driver . sleep ( expirationDelay ) ;
0 commit comments