spec/capybara_spec.rb in sequenceserver-1.1.0.beta12 vs spec/capybara_spec.rb in sequenceserver-2.0.0.beta1
- old
+ new
@@ -8,11 +8,13 @@
end
describe 'a browser', :js => true do
before do |scenario|
Capybara.app = SequenceServer.init
+ Capybara.server = :webrick
Capybara.javascript_driver = :selenium
+ Capybara.default_max_wait_time = 30
Capybara.register_driver :selenium do |app|
capabilities = {
name: scenario.full_description,
platform: ENV['platform'],
@@ -20,51 +22,51 @@
browserVersion: ENV['browserVersion'],
build: ENV['TRAVIS_BUILD_NUMBER'],
'tunnel-identifier': ENV['TRAVIS_JOB_NUMBER']
}
url = "https://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}" \
- "@ondemand.saucelabs.com:443/wd/hub".strip
+ "@ondemand.saucelabs.com:443/wd/hub".strip
Capybara::Selenium::Driver.new(app, browser: :remote, url: url,
desired_capabilities: capabilities)
end
end
before :each do |scenario|
jobname = scenario.full_description
- Capybara.session_name = "#{jobname} - #{ENV['platform']} - " +
- "#{ENV['browserName']} - #{ENV['browserVersion']}"
+ Capybara.session_name = "#{jobname} - #{ENV['platform']} - " \
+ "#{ENV['browserName']} - #{ENV['browserVersion']}"
- @driver = Capybara.current_session.driver
+ @driver = Capybara.current_session.driver
- # Output sessionId and jobname to std out for Sauce OnDemand Plugin to
- # display embeded results
- @session_id = @driver.browser.session_id
- puts "SauceOnDemandSessionID=#{@session_id} job-name=#{jobname}"
+ # Output sessionId and jobname to std out for Sauce OnDemand Plugin to
+ # display embeded results
+ @session_id = @driver.browser.session_id
+ puts "SauceOnDemandSessionID=#{@session_id} job-name=#{jobname}"
end
it 'properly controls blast button' do
visit '/'
- fill_in('sequence', with: nucleotide_query, wait: 5)
+ fill_in('sequence', with: nucleotide_query)
page.evaluate_script("$('#method').is(':disabled')").should eq(true)
check(nucleotide_databases.first)
page.evaluate_script("$('#method').is(':disabled')").should eq(false)
end
it 'properly controls interaction with database listing' do
visit '/'
- fill_in('sequence', with: nucleotide_query, wait: 5)
+ fill_in('sequence', with: nucleotide_query)
check(nucleotide_databases.first)
page.evaluate_script("$('.protein .database').first().hasClass('disabled')")
.should eq(true)
end
it 'shows a dropdown menu when other blast methods are available' do
visit '/'
- fill_in('sequence', with: nucleotide_query, wait: 5)
+ fill_in('sequence', with: nucleotide_query)
check(nucleotide_databases.first)
page.save_screenshot('screenshot.png')
page.has_css?('button.dropdown-toggle').should eq(true)
end
@@ -109,11 +111,11 @@
def perform_search(query: , databases: , method: nil)
# Load search form.
visit '/'
# Fill in query, select databases, submit form.
- fill_in('sequence', with: query, wait: 5)
+ fill_in('sequence', with: query)
databases.each { |db| check db }
if method == 'tblastx'
find('.dropdown-toggle').click
find('.dropdown-menu li').click
end
@@ -121,10 +123,10 @@
# switch to new window because link opens in new window
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
# Check that results loaded.
- page.should have_content('Query', wait: 10)
+ page.should have_content('Query')
end
def nucleotide_query
File.read File.join __dir__, 'nucleotide_query.fa'
end