Skip to content

Commit

Permalink
Made rss-test pass with firefox by increasing the timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Nov 30, 2015
1 parent 922e820 commit 2acde1d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spec/rss_spec.rb
Expand Up @@ -8,10 +8,12 @@

before :all do
@idx = 0
@saved_timeout ||= Watir.default_timeout
waitForOddbToBeReady(@browser, OddbUrl)
end

before :each do
Watir.default_timeout = @saved_timeout
@browser.goto OddbUrl
end

Expand All @@ -35,12 +37,15 @@
@browser.goto OddbUrl
expect(@browser.url).to match OddbUrl
link = @browser.link(:href => /rss\/channel\/#{subject}/)
debug = true
debug = /fachinfo/i.match(subject) ? true : false
expect(link.exists?).to be true
if @browser.driver.browser.eql?(:firefox)
Watir.default_timeout = 60 if /fachinfo/i.match(subject) # reading fachinfo takes a long time
$stdout.puts "#{Time.now}: goto #{link.href} timeout #{Watir.default_timeout}" if debug
@browser.goto(link.href)
# We have problem as the fachinfo size is 26MB and goes back to 2006.
$stdout.puts "#{Time.now}: #{@browser.url} start reading text" if debug
Watir.default_timeout = 600 if /fachinfo/i.match(subject) # reading fachinfo takes a long time
$stdout.puts "#{Time.now}: #{@browser.url} start reading text timeout #{Watir.default_timeout}" if debug
content = @browser.text.clone
File.open(subject + '.rss', 'w+' ) { |f| f.write content }
expect(content).to match /#{test_string}/
Expand All @@ -53,7 +58,8 @@
}

after :all do
$stdout.puts "#{Time.now}: #{__FILE__} after all"
Watir.default_timeout = @saved_timeout
$stdout.puts "#{Time.now}: #{__FILE__} after all. Restored timeout to #{@saved_timeout}"
@browser.close
end
end

0 comments on commit 2acde1d

Please sign in to comment.