Commit 63dc4e6b authored by Mikaël Salson's avatar Mikaël Salson

Update Watir

Use latest Ruby version and Watir instead of watir-webdriver.
This will make it easier to install it on recent OS and it
will also allow us to test on recent Firefox versions.

Some changes in the syntax:
- visible? is deprecated → present?
- wait_until_* are deprecated → wait_until(&: *)
- some way of specifying timeouts

Watir also seems to be quicker thus the need to add
some waits or some sleeps
parent 0921b0ca
require 'rubygems'
gem "minitest"
require 'watir-webdriver'
require 'watir'
require 'test/unit'
require "minitest/autorun"
require 'minitest/ci'
......@@ -65,7 +65,7 @@ class BrowserTest < MiniTest::Test
print "Welcome popup.\n"
# wait for the welcoming popup
$b.div(:class => 'popup_msg').wait_until_present(2)
$b.div(:class => 'popup_msg').wait_until(timeout: 2){ |el| el.present? }
# close the welcoming popup
$b.div(:class => 'popup_msg').button(:text => 'ok').click
......@@ -83,12 +83,12 @@ class BrowserTest < MiniTest::Test
# select data file
print " data: " + data_path + "\n"
$b.div(:id => 'file_menu').file_field(:name,"json").set(data_path)
$b.div(:id => 'file_menu').file_field(name: "json").set(data_path)
# select analysis file
if analysis_path != nil
print " analysis: " + analysis_path + "\n"
$b.div(:id => 'file_menu').file_field(:name, "pref").set(analysis_path)
$b.div(:id => 'file_menu').file_field(name: "pref").set(analysis_path)
end
$b.div(:id => 'file_menu').button(:text => 'start').click
......
......@@ -19,7 +19,7 @@ class ExternalTest < BrowserTest
def test_10_imgt
begin
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_scatterplot('25').click
$b.span(:id => "toIMGT" ).click
......@@ -53,7 +53,7 @@ class ExternalTest < BrowserTest
begin
$b.clone_in_scatterplot('25').click
$b.span(:id => "toIMGTSeg" ).click
$b.segmenter_checkbox_imgt_vdj.wait_until_present
$b.segmenter_checkbox_imgt_vdj.wait_until(&:present?)
clone_info = $b.clone_info_segmenter('25')
productive_title = clone_info[:axis].element(:class => 'productivity-IMGT').title
......@@ -67,8 +67,8 @@ class ExternalTest < BrowserTest
assert (h.style('width').to_i >= 100), "Highlights should have a reasonable width, found to be %s" % h.style('width')
end
Watir::Wait.until(timeout=10) { clone_info[:identity].span.exists? }
clone_info[:identity].element(:text => "NaN%").wait_while_present
Watir::Wait.until(timeout: 10) { clone_info[:identity].span.exists? }
clone_info[:identity].element(:text => "NaN%").wait_while(&:present?)
assert ((clone_info[:identity].text =~ /^[0-9\.]+%$/) == 0 ), "We should have identity rate (found: %s)" % clone_info[:identity].text
$b.unselect
......@@ -78,7 +78,7 @@ class ExternalTest < BrowserTest
def test_11_igBlast
begin
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_scatterplot('25').click
$b.span(:id => "toIgBlast" ).click
......
......@@ -17,8 +17,8 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
$b.button(:id => 'form_submit').click
$b.element(:class => 'imgAjaxLoading').wait_until_present
$b.clone_in_scatterplot('0').wait_until_present
$b.element(:class => 'imgAjaxLoading').wait_until(&:present?)
$b.clone_in_scatterplot('0').wait_until(&:present?)
assert ($b.element(:class => 'segmenter').present?), "Segmenter should be present"
assert ($b.element(:class => 'scatterplot').present?), "Segmenter should be present"
......@@ -27,15 +27,15 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
def test_05_imgt_post
begin
$b.span(:id => "toIMGTSeg" ).click
$b.segmenter_checkbox_imgt_vdj.wait_until_present
Watir::Wait.until(timeout=10) { $b.span(:class => "identityBad").exists? }
$b.segmenter_checkbox_imgt_vdj.wait_until(&:present?)
Watir::Wait.until(timeout: 10) { $b.span(:class => "identityBad").exists? }
clone_info = $b.clone_info_segmenter('0')
clone_info[:identity].element(:text => "NaN%").wait_while_present
clone_info[:identity].element(:text => "NaN%").wait_while(&:present?)
productive_title = clone_info[:axis].element(:class => 'productivity-IMGT').title
assert (productive_title.include? 'productivity'), "IMGT should tell us the productivity of the sequence"
clone_segmenter = $b.clone_in_segmenter('0')
Watir::Wait.until(timeout=10) { $b.execute_script("return typeof model.clone(0).seg.imgt['N-REGION end']") != "undefined" }
Watir::Wait.until(timeout: 10) { $b.execute_script("return typeof model.clone(0).seg.imgt['N-REGION end']") != "undefined" }
$b.segmenter_checkbox_imgt_vdj.click
highlights = clone_segmenter.spans(:class => 'highlight_border')
......
......@@ -12,14 +12,14 @@ class TestSimple < BrowserTest
end
def test_00_graph_hidden
# assert (not $b.clone_in_graph('0').visible?), "Graph lines should not be visible"
# assert (not $b.clone_in_graph('0').present?), "Graph lines should not be visible"
assert (not $b.graph.exists?), "Graph should not exist"
end
def test_00_double_scatterplot
# analysis-example has only one sample, second scatterplot expected
assert ( $b.scatterplot.visible?), "First scatterplot should be found"
assert ( $b.scatterplot(2).visible?), "Second scatterplot should be found"
assert ( $b.scatterplot.present?), "First scatterplot should be found"
assert ( $b.scatterplot(2).present?), "Second scatterplot should be found"
end
def test_01_legend_scatterplot
......@@ -35,12 +35,12 @@ class TestSimple < BrowserTest
def test_02_deactivate_locus
initial_read_nb = $b.info_selected_locus.text
$b.locus_topleft('TRG').click
$b.clone_in_scatterplot('0').wait_while_present
$b.clone_in_scatterplot('0').wait_while(&:present?)
assert ($b.info_selected_locus.text == "no read"), "When unselected we have no reads"
# Reactivate
$b.locus_topleft('TRG').click
$b.clone_in_scatterplot('0').wait_until_present
$b.clone_in_scatterplot('0').wait_until(&:present?)
assert ($b.info_selected_locus.text == initial_read_nb), "Read number should be identical to what we had at first"
end
......
......@@ -7,7 +7,7 @@ class TestLoadingAnalysis < BrowserTest
super
if not defined? $b
set_browser("/doc/analysis-example2.vidjil", "/doc/analysis-example2.analysis")
$b.clone_in_scatterplot('0').wait_until_present
$b.clone_in_scatterplot('0').wait_until(&:present?)
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
......@@ -30,9 +30,9 @@ class TestLoadingAnalysis < BrowserTest
$b.select_tag('0').click
assert (not $b.clone_in_list('0').visible?)
assert (not $b.clone_in_scatterplot('0').visible?)
assert (not $b.clone_in_graph('0').visible?)
assert (not $b.clone_in_list('0').present?)
assert (not $b.clone_in_scatterplot('0').present?)
assert (not $b.clone_in_graph('0').present?)
$b.select_tag('0').click
end
......@@ -61,36 +61,36 @@ class TestLoadingAnalysis < BrowserTest
end
def test_04_hide_clone
assert ($b.clone_in_list('0').visible?)
assert ($b.clone_in_scatterplot('0').visible?)
assert ($b.clone_in_graph('0').visible?)
assert ($b.clone_in_list('0').present?)
assert ($b.clone_in_scatterplot('0').present?)
assert ($b.clone_in_graph('0').present?)
# Hide the clone by affecting it to a hidden tag
$b.clone_info('0')[:star].click
$b.tag_item('4')[:name].click
assert (not $b.clone_in_list('0').visible?)
assert (not $b.clone_in_scatterplot('0').visible?)
assert (not $b.clone_in_graph('0').visible?)
assert (not $b.clone_in_list('0').present?)
assert (not $b.clone_in_scatterplot('0').present?)
assert (not $b.clone_in_graph('0').present?)
# Unhide clone
$b.element(:id => 'fastTag4', :class => 'inactiveTag').click
assert (not $b.element(:id => 'fastTag4', :class => 'inactiveTag').exists?)
assert ($b.clone_in_list('0').visible?)
assert ($b.clone_in_scatterplot('0').visible?)
assert ($b.clone_in_graph('0').visible?)
assert ($b.clone_in_list('0').present?)
assert ($b.clone_in_scatterplot('0').present?)
assert ($b.clone_in_graph('0').present?)
end
def test_05_check_cluster
clustered = $b.clone_info('1')
assert (clustered[:name].text == 'clone2'), "First clone of cluster should be clone2"
assert ($b.clone_in_scatterplot('1').visible?)
assert (not $b.clone_in_scatterplot('2').visible?)
assert ($b.clone_in_scatterplot('1').present?)
assert (not $b.clone_in_scatterplot('2').present?)
clustered[:cluster].click
assert ($b.clone_in_scatterplot('1').visible?)
assert ($b.clone_in_scatterplot('2').visible?)
assert ($b.clone_in_scatterplot('1').present?), "First clone should still be present"
$b.clone_in_scatterplot('2').wait_until(&:present?)
first_in_cluster = $b.clone_in_cluster('1', '1')
second_in_cluster = $b.clone_in_cluster('1', '2')
......@@ -105,12 +105,13 @@ end
def test_06_remove_cluster
clustered = $b.clone_info('1')
clustered[:cluster].click
$b.clone_in_cluster('1', '2')[:delete].wait_until(&:present?)
$b.clone_in_cluster('1', '2')[:delete].click
assert (not $b.clone_cluster('1').visible?)
assert (not $b.clone_cluster('1').present?)
assert ($b.clone_in_scatterplot('1').visible?)
assert ($b.clone_in_scatterplot('2').visible?)
assert ($b.clone_in_scatterplot('1').present?)
assert ($b.clone_in_scatterplot('2').present?)
clone3 = $b.clone_info('2')
assert (clone3[:name].text == "clone3")
......@@ -125,8 +126,8 @@ end
clustered = $b.clone_info('1')
assert (clustered[:name].text == 'clone2')
assert ($b.clone_in_scatterplot('1').visible?)
assert (not $b.clone_in_scatterplot('2').visible?)
assert ($b.clone_in_scatterplot('1').present?)
assert (not $b.clone_in_scatterplot('2').present?)
end
def test_08_select_cluster
......
......@@ -44,7 +44,7 @@ class TestMultilocus < BrowserTest
def test_00_info_point
assert (not $b.div(:id => 'info_timepoint').present?), "Info timepoint should not be present"
$b.info_point.i.click
assert ($b.div(:id => 'info_timepoint').visible?), "After clicking info timepoint should be visible"
assert ($b.div(:id => 'info_timepoint').present?), "After clicking info timepoint should be visible"
table = $b.div(:id => 'info_timepoint').table
assert (table[1][1].text == '786861'), "Incorrect number of reads in infopoint"
......@@ -107,7 +107,7 @@ class TestMultilocus < BrowserTest
begin
$b.unselect
#test hover a clone in the list
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_list('25').hover
check_when_list_or_scatterplot_focused
......@@ -117,7 +117,7 @@ class TestMultilocus < BrowserTest
def test_05_focus_in_scatterplot
begin
$b.unselect
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_scatterplot('25').hover
check_when_list_or_scatterplot_focused
......@@ -140,7 +140,7 @@ class TestMultilocus < BrowserTest
def test_08_click_in_list
#test select a clone in the list
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_info('25')[:name].click()
check_when_list_or_scatterplot_clicked
......@@ -150,7 +150,7 @@ class TestMultilocus < BrowserTest
end
def test_08_click_in_scatterplot
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_scatterplot('25').click
check_when_list_or_scatterplot_clicked
......@@ -161,7 +161,7 @@ class TestMultilocus < BrowserTest
def TODO_test_09_normalize
$b.clone_info('25')[:star].click
$b.tag_selector_edit_normalisation.wait_until_present
$b.tag_selector_edit_normalisation.wait_until(&:present?)
$b.tag_selector_edit_normalisation.set('0.01')
$b.tag_selector_normalisation_validator.click
......@@ -175,7 +175,7 @@ class TestMultilocus < BrowserTest
end
def test_0a_shortcuts_numpad
$b.clone_in_scatterplot('25').wait_until_present
$b.clone_in_scatterplot('25').wait_until(&:present?)
$b.clone_in_scatterplot('25').click
assert ($b.preset_selector.selected? "[0] V/J (genes)"), ">> preset selector badly set"
......@@ -187,9 +187,9 @@ class TestMultilocus < BrowserTest
begin
$b.clone_info('25')[:star].click
name = $b.tag_item('0')[:name]
name.wait_until_present
name.wait_until(&:present?)
name.click
name.wait_while_present
name.wait_while(&:present?)
assert ($b.clone_info('25')[:name].style('color') == 'rgba(220, 50, 47, 1)' ) , ">> fail tag : clone color hasn't changed"
end
......@@ -258,11 +258,11 @@ class TestMultilocus < BrowserTest
assert (smaller.text.include?("smaller clones")), "We should have smaller clones at index %d of the list, instead we have %s " % [i, smaller.text]
assert (smaller.visible?), "Smaller clones #%d should be visible, it is not" % [i]
assert (smaller.present?), "Smaller clones #%d should be visible, it is not" % [i]
smaller.hover
assert (smaller.visible?), "Smaller clones #%d should still be visible after hovering it" % [i]
assert (smaller.present?), "Smaller clones #%d should still be visible after hovering it" % [i]
assert (not $b.clone_in_scatterplot(smaller.id).visible?), "Smaller clone %d should not be visible in scatterplot" % [i]
assert (not $b.clone_in_scatterplot(smaller.id).present?), "Smaller clone %d should not be visible in scatterplot" % [i]
end
end
......@@ -308,7 +308,7 @@ class TestMultilocus < BrowserTest
def test_18_empty_clone_invisible
assert ( $b.execute_script("return m.clones[66].reads[0]") == 0), "Clone should have no read"
assert (not $b.clone_in_scatterplot('66').visible?), "Clone should not be visible"
assert (not $b.clone_in_scatterplot('66').present?), "Clone should not be visible"
end
def TODO_test_14_edit_tag
......@@ -317,7 +317,7 @@ class TestMultilocus < BrowserTest
$b.clone_info('25')[:star].click
edit = $b.tag_item('0')[:edit]
edit.wait_until_present
edit.wait_until(&:present?)
edit.click
$b.tag_selector_edit_name.set 'renamed_click'
$b.tag_selector_name_validator.click
......@@ -329,7 +329,7 @@ class TestMultilocus < BrowserTest
$b.clone_info('24')[:star].click
edit = $b.tag_item('1')[:edit]
edit.wait_until_present
edit.wait_until(&:present?)
edit.click
$b.tag_selector_edit_name.set 'renamed_return'
$b.send_keys :return
......@@ -340,7 +340,7 @@ class TestMultilocus < BrowserTest
## check renames (on again another clone)
$b.clone_info('23')[:star].click
edit = $b.tag_item('1')[:edit]
edit.wait_until_present
edit.wait_until(&:present?)
assert ($b.tag_selector.text.include? 'renamed_click'), "fail edit tag with mouse : tag name in tag selector hasn't changed"
assert ($b.tag_selector.text.include? 'renamed_return'), "fail edit tag with keyboard : tag name in tag selector hasn't changed"
......
......@@ -17,23 +17,23 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
$b.button(:id => 'form_submit').click
$b.element(:class => 'imgAjaxLoading').wait_until_present
$b.clone_in_scatterplot('0').wait_until_present
$b.element(:class => 'imgAjaxLoading').wait_until(&:present?)
$b.clone_in_scatterplot('0').wait_until(&:present?)
assert ($b.element(:class => 'segmenter').present?), "Segmenter should be present"
assert ($b.element(:class => 'scatterplot').present?), "Segmenter should be present"
end
def test_01_segmenter
assert ($b.clone_in_segmenter('0').visible?), "Clone 0 should be in segmenter"
assert ($b.clone_in_segmenter('1').visible?), "Clone 1 should be in segmenter"
assert ($b.clone_in_segmenter('0').present?), "Clone 0 should be in segmenter"
assert ($b.clone_in_segmenter('1').present?), "Clone 1 should be in segmenter"
assert (not $b.clone_in_segmenter('2').exists?), "Clone 2 should not exist"
end
def test_02_scatterplot
assert ($b.clone_in_scatterplot('0').visible?), "Clone 0 should be in scatterplot"
assert ($b.clone_in_scatterplot('1').visible?), "Clone 1 should be in scatterplot"
assert (not $b.clone_in_scatterplot('2').visible?), "Clone 2 should not be visible"
assert ($b.clone_in_scatterplot('0').present?), "Clone 0 should be in scatterplot"
assert ($b.clone_in_scatterplot('1').present?), "Clone 1 should be in scatterplot"
assert (not $b.clone_in_scatterplot('2').present?), "Clone 2 should not be visible"
end
def test_03_change_color
......@@ -44,6 +44,7 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
$b.tag_item('3')[:name].click
$b.clone_in_segmenter('1').hover # Change clone to hover: on hover color doesn't change
sleep(1)
assert ($b.clone_info_segmenter('0')[:name].style('color') == tagColor), "Clone has not changed color in segmenter"
# Must remove rgb from the start of the fill style, and the closing parentheses at the end,
......@@ -58,7 +59,7 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
for i in ['0', '1']
for gene in ['V', 'J']
span = $b.clone_in_segmenter(i).span(:class => gene)
assert (span.visible?), "#{gene} span should be visible"
assert (span.present?), "#{gene} span should be visible"
end
end
end
......
......@@ -12,7 +12,7 @@ class TestSegmenterPageErrors < SegmenterTest
$b.button(:id => 'form_submit').click
$b.element(:class => 'flash_2').wait_until_present
$b.element(:class => 'flash_2').wait_until(&:present?)
assert ($b.element(:class => 'flash_2', :index => 1).text.include? "invalid sequences"), "We should have an error_message"
assert (not $b.element(:class => 'segmenter').present?), "Segmenter should not be present"
......@@ -30,8 +30,8 @@ CGTCTT"
$b.button(:id => 'form_submit').click
$b.element(:class => 'imgAjaxLoading').wait_until_present
$b.clone_in_segmenter('0').wait_until_present
$b.element(:class => 'imgAjaxLoading').wait_until(&:present?)
$b.clone_in_segmenter('0').wait_until(&:present?)
assert ($b.element(:class => 'segmenter').present?), "Segmenter should be present"
assert ($b.element(:class => 'scatterplot').present?), "Segmenter should be present"
......
# coding: utf-8
require 'watir-webdriver'
require 'watir'
class VidjilBrowser < Watir::Browser
......@@ -9,7 +9,7 @@ class VidjilBrowser < Watir::Browser
Selenium::WebDriver::Firefox.path = ENV['WATIR_BROWSER_PATH']
end
# :chrome or :safari
super :firefox
super :firefox, :marionette => false
print "Running "+driver.capabilities.browser_name+" "+driver.capabilities.version+"\n"
end
......@@ -70,9 +70,9 @@ class VidjilBrowser < Watir::Browser
# Beware the id must be a string
def clone_in_scatterplot(id, extra={}, number=1)
circle = element(extra.merge(:id => scatterplot_id(number) + "_circle"+id))
if circle.exists? and not circle.visible?
if circle.exists? and not circle.present?
bar = element(extra.merge(:id => scatterplot_id(number) + "_bar"+id))
if bar.exists? and bar.visible?
if bar.exists? and bar.present?
return bar
end
end
......@@ -133,7 +133,7 @@ class VidjilBrowser < Watir::Browser
# Return the span of the locus
def locus_topleft(locus)
return span(:class => 'systemBoxNameMenu', :class => locus)
return span(:class => ['systemBoxNameMenu', locus])
end
def menu_patient
......@@ -196,6 +196,7 @@ class VidjilBrowser < Watir::Browser
# (String or Regex)
def scatterplot_select_preset(axis, number = 1)
scatterplot_menu(number).hover
sleep 1
preset_selector.select axis
end
......
......@@ -371,42 +371,27 @@ For OS X, see https://github.com/watir/watirbook/blob/master/manuscript/installa
source /etc/profile.d/rvm.sh
#+END_SRC
***** Install ruby 2.1.1
***** Install ruby 2.6.1
#+BEGIN_SRC sh
rvm install 2.1.1
rvm install 2.6.1
#+END_SRC
***** Switch to ruby 2.1.1
***** Switch to ruby 2.6.1
#+BEGIN_SRC sh
rvm use 2.1.1
rvm use 2.6.1
#+END_SRC
***** Install necessary gems
#+BEGIN_SRC sh
gem install minitest
gem install minitest-ci
gem install watir-webdriver
gem install test-unit
gem install minitest minitest-ci watir test-unit
#+END_SRC
This may install a =selenium-webdriver= gem whose version is ≥ 3. We highly
recommend that you force an install to a version < 3 (/e.g./ 2.53.4).
#+BEGIN_SRC sh
# Removing a new version of selenium-webdriver
gem uninstall selenium-webdriver
# Installing an older version
gem install selenium-webdriver -v 2.53.4
#+END_SRC
However the webdriver may not work with recent versions of Firefox (> 45). In
such a case you would like to downgrade your Firefox version or use a former
version. The Firefox version used can be set with an environment variable (see
The Firefox version used can be set with an environment variable (see
below). All Firefox releases are [[https://download-installer.cdn.mozilla.net/pub/firefox/releases/ ][available here]].
**** Launch browser tests
......
require 'rubygems'
gem "minitest"
require 'watir-webdriver'
require 'watir'
require 'test/unit'
require "minitest/autorun"
require 'minitest/ci'
......@@ -50,7 +50,7 @@ class BrowserTest < MiniTest::Test
puts "Vidjil client loaded, launching tests."
# check the 'db_content' window opens
assert ($b.div(:id => 'db_content').wait_until_present), "db content is not present"
assert ($b.div(:id => 'db_content').wait_until(&:present?)), "db content is not present"
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
......
......@@ -11,7 +11,7 @@ class TestLogin < ServerTest
logout = $b.a(:class => "button", :text => "(logout)")
if logout.present?
logout.click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
end
end
......@@ -22,7 +22,7 @@ class TestLogin < ServerTest
init_button.click
init_form = $b.form(:id => "data_form")
init_form.wait_until_present
init_form.wait_until(&:present?)
init_form.text_field(:id => "email").set("plop@plop.com")
init_form.text_field(:id => "password").set("foobartest")
......@@ -31,7 +31,7 @@ class TestLogin < ServerTest
init_form.input(:type => "submit").click
login_form = $b.form(:id => 'login_form')
login_form.wait_until_present
login_form.wait_until(&:present?)
end
=end
......@@ -41,7 +41,7 @@ class TestLogin < ServerTest
login_form.text_field(:id => "auth_user_email").set('foo@bar.com')
login_form.text_field(:id => "auth_user_password").set('foobar')
login_form.tr(:id => 'submit_record__row').input(:type => 'submit').click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
login_form = $b.form(:id => 'login_form')
assert(login_form.present?)
......@@ -53,7 +53,7 @@ class TestLogin < ServerTest
login_form.text_field(:id => "auth_user_email").set('plop@plop.com')
login_form.text_field(:id => "auth_user_password").set('foobartest')
login_form.tr(:id => 'submit_record__row').input(:type => 'submit').click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
assert(!login_form.present?)
end
end
......
......@@ -13,15 +13,15 @@ class TestPreProcess < ServerTest
login_form.text_field(:id => "auth_user_email").set('plop@plop.com')
login_form.text_field(:id => "auth_user_password").set('foobartest')
login_form.tr(:id => 'submit_record__row').input(:type => 'submit').click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
end
end
def go_to_list
$b.a(:class => "button", :text => "pre-process").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
table = $b.table(:id => "table")
table.wait_until_present
table.wait_until(&:present?)
table
end
......@@ -38,16 +38,16 @@ class TestPreProcess < ServerTest
# go to form
$b.span(:class => "button2", :text => "+ new pre-process").click
form = $b.form(:id => "data_form")
form.wait_until_present
form.wait_until(&:present?)
form.text_field(:id => "pre_process_name").set('dummy')
form.textarea(:id => "pre_process_command").set('dummy &file1& &file2& > &result&')
form.textarea(:id => "pre_process_name").set('dummy pre-process for testing purposes')
form.input(:type => "submit").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
table = $b.table(:id => "table")
table.wait_until_present
table.wait_until(&:present?)
lines = table.tbody.rows
assert(lines.count == count+1)
end
......@@ -60,7 +60,7 @@ class TestPreProcess < ServerTest
line.i(:class => "icon-pencil-2").click
form = $b.form(:id => "data_form")
form.wait_until_present
form.wait_until(&:present?)
info = form.textarea(:id => "pre_process_info")
assert(form.text_field(:id => "pre_process_name").value == "test pre-process 0")
assert(form.textarea(:id => "pre_process_command").value == "dummy &file1& &file2& > &result&")
......@@ -69,9 +69,9 @@ class TestPreProcess < ServerTest
info.set("edited")
form.input(:type => "submit").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
table = $b.table(:id => 'table')
table.wait_until_present
table.wait_until(&:present?)
line = table.td(:index => 0, :text => uid).parent
assert(line.td(:text => "edited").present?)
......@@ -83,10 +83,10 @@ class TestPreProcess < ServerTest
count = table.tbody.rows.count
line = table.td(:text => "test pre-process 2").parent
line.i(:class => "icon-erase").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
$b.button(:text => "continue").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
table.wait_until_present
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
table.wait_until(&:present?)
lines = table.tbody.rows
assert(lines.count == count-1)
end
......@@ -96,10 +96,10 @@ class TestPreProcess < ServerTest
line = table.td(:text => "pre-process perm").parent
line.i(:class => 'icon-key').click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
list = $b.table(:id => "table")
list.wait_until_present
list.wait_until(&:present?)
line = table.td(:text => "public").parent
checkbox = line.cells.last.checkbox
assert(checkbox.set? == false)
......@@ -107,9 +107,9 @@ class TestPreProcess < ServerTest
# reload page to check if permissions are persistant.
$b.span(:id => "db_reload").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
list = $b.table(:id => "table")
list.wait_until_present
list.wait_until(&:present?)
line = table.td(:text => "public").parent
checkbox = line.cells.last.checkbox
assert(checkbox.set?)
......
......@@ -19,9 +19,9 @@ class TestSampleSet < ServerTest
def go_to_list
#$b.a(:class => ["button", "button_token", "patient_token"], :text => "patients").click
$b.a(:class => "button button_token patient_token", :text => "patients").click
Watir::Wait.until(30) {$b.execute_script("return jQuery.active") == 0}
Watir::Wait.until(timeout: 30) {$b.execute_script("return jQuery.active") == 0}
table = $b.table(:id => "table")
table.wait_until_present
table.wait_until(&:present?)
table
end
......@@ -38,7 +38,7 @@ class TestSampleSet < ServerTest
# go to form
$b.span(:class => "button2", :text => "+ new patients").click
form = $b.form(:id => "object_form")