spec/watirspec/cookies_spec.rb in watir-6.8.4 vs spec/watirspec/cookies_spec.rb in watir-6.9.0
- old
+ new
@@ -47,10 +47,22 @@
verify_cookies_count 1
browser.cookies.add 'foo', 'bar'
verify_cookies_count 2
end
+
+ it 'adds a cookie with a string expires value' do
+ browser.goto set_cookie_url
+ verify_cookies_count 1
+
+ expire_time = Time.now + 10000
+
+ browser.cookies.add 'foo', 'bar', {expires: expire_time.to_s}
+
+ cookie = browser.cookies[:foo]
+ expect(cookie[:expires]).to be_kind_of(Time)
+ end
end
# TODO - Split this up into multiple tests or figure out which parts are not compliant
not_compliant_on :chrome, :internet_explorer, :safari, :firefox do
it 'adds a cookie with options' do
@@ -110,21 +122,23 @@
it 'saves cookies to file' do
expect(IO.read(file)).to eq(browser.cookies.to_a.to_yaml)
end
end
- describe '#load' do
- it 'loads cookies from file' do
- browser.cookies.clear
- browser.cookies.load file
- expected = browser.cookies.to_a
- actual = YAML.load(IO.read(file))
+ bug "https://github.com/mozilla/geckodriver/issues/1000", :firefox do
+ describe '#load' do
+ it 'loads cookies from file' do
+ browser.cookies.clear
+ browser.cookies.load file
+ expected = browser.cookies.to_a
+ actual = YAML.load(IO.read(file))
- # https://code.google.com/p/selenium/issues/detail?id=6834
- expected.each { |cookie| cookie.delete(:expires) }
- actual.each { |cookie| cookie.delete(:expires) }
+ # https://code.google.com/p/selenium/issues/detail?id=6834
+ expected.each { |cookie| cookie.delete(:expires) }
+ actual.each { |cookie| cookie.delete(:expires) }
- expect(actual).to eq(expected)
+ expect(actual).to eq(expected)
+ end
end
end
end
def set_cookie_url