Commit 5b0ba979 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-cs/update-watir' into 'dev'

Update watir

See merge request !398
parents c22ac23f b849c26b
Pipeline #61752 failed with stages
in 2 minutes and 18 seconds
......@@ -222,7 +222,7 @@ test_browser-functional:
script:
- make -C browser
- source /etc/profile.d/rvm.sh
- rvm use 2.1.1
- rvm use 2.6.1
- HEADLESS=1 make -C browser/test functional
artifacts:
paths:
......@@ -241,7 +241,7 @@ test_browser-functional-external:
script:
- make -C browser
- source /etc/profile.d/rvm.sh
- rvm use 2.1.1
- rvm use 2.6.1
- HEADLESS=1 make -C browser/test external
artifacts:
paths:
......@@ -306,7 +306,7 @@ test_server_functional:
- docker exec docker_uwsgi_1 sed -i "s/^\(FILE_SOURCE .*\)/FILE_SOURCE = '\/usr\/share\/vidjil\/demo'/" /usr/share/vidjil/server/web2py/applications/vidjil/modules/defs.py
- docker exec docker_nginx_1 make -C /usr/share/vidjil browser
- source /etc/profile.d/rvm.sh
- rvm use 2.1.1
- rvm use 2.6.1
- HEADLESS=1 make functional_server || (cd docker && docker-compose stop; docker stop $(docker ps -aq); docker rm $(docker ps -aq); docker rmi "vidjil/server:test" "vidjil/client:test"; false)
- cd docker && docker-compose stop
- docker stop $(docker ps -aq)
......
......@@ -198,8 +198,6 @@
normalization
<form name="normalize_list" id="normalize_list">
</form>
<form name="normalize_list" id="normalize_list"> <!-- class="devel-mode"> -->
</form>
</div>
<div class="menu_box">
size display</br>
......
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')
......
......@@ -7,19 +7,21 @@ class TestSimple < BrowserTest
super
if not defined? $b
set_browser("/doc/analysis-example1.vidjil")
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
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 +37,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,8 +7,10 @@ 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.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
$b.clone_in_scatterplot('0').wait_until(&:present?)
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
end
......@@ -30,9 +32,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 +63,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 +107,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 +128,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
......
......@@ -9,7 +9,9 @@ class TestMultilocus < BrowserTest
super
if not defined? $b
set_browser("/doc/analysis-example.vidjil")
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
end
......@@ -44,7 +46,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 +109,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 +119,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 +142,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 +152,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
......@@ -159,9 +161,9 @@ class TestMultilocus < BrowserTest
assert (not $b.clone_in_list('25').class_name.include? "list_select"), ">> Incorrect class name, clone is not unselected'"
end
def TODO_test_09_normalize
def 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 +177,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 +189,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
......@@ -202,9 +204,9 @@ class TestMultilocus < BrowserTest
$b.clone_in_scatterplot('90').click(:control)
$b.menu_item_export_fasta.click
assert ( $b.window(:title => "").exists? ) , ">> fail opening fasta export "
$b.window(:title => "").use do
assert ($b.text.include? ">TRBV29*01 -1/0/-0 TRBD1*01 -2/0/-5 TRBJ2-5*01"), "header name"
assert ( $b.window(:url => /about:blank/ )) , ">> fail opening fasta export "
$b.window(:url => /about:blank/).use do
assert ($b.text.include? ">TRBV29*01 -1/0/-0 TRBD1*01 -2/0/-5 TRBJ2-5*01"), "header name: "+$b.text
assert ($b.text.include? "YYGGGYYACGYAYAGCGGYGYTTYYCCTYTYTGYTYTGCYAAAYAACYYYYTGTGYCTYTGTGCYGYGTTYCCCGGYYYAAACYCYCYYCCTYGG\nCYAGGYCYGG"), "sequence"
assert ($b.text.include? ">ERG-4F 0/TCT/0 ERG-Seq-R"), "header name locus ERG"
assert (not $b.text.include? ">ERG-4F\n"), "header name of segment should not exist (segment is not present in germline)"
......@@ -258,11 +260,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 +310,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 +319,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 +331,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 +342,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"
......
......@@ -8,8 +8,10 @@ class TestNormalization < BrowserTest
def setup
super
if not defined? $b
set_browser("/doc/analysis-example.vidjil")
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
set_browser("/doc/analysis-example.vidjil")
if $b.div(id: 'tip-container').present?
$b.div(:id => 'tip-container').div(:class => 'tip_1').element(:class => 'icon-cancel').click
end
end
end
......@@ -20,45 +22,43 @@ class TestNormalization < BrowserTest
def test_00_normalization_none
$b.element(:id => 'settings_menu').click
assert ($b.div(:id => 'normalize_list').visible?), "After clicking normalize_list form should be visible"
assert ($b.div(:id => 'reset_norm').present?), "Form have the input for reset normalization"
$b.execute_script(' showSelector("settingsSelector"); console.log( "hide settings")')
$b.send_keys :escape
end
assert ($b.form(:id => 'normalize_list').present?), "After clicking normalize_list form should be visible"
assert ($b.input(:id => 'reset_norm').present?), "Form have the input for reset normalization"
$b.clone_in_list('25').hover # Just put the mouse somewhere else to close the menu
end
def test_01_normalization_expected
set_browser("/doc/analysis-example.vidjil")
$b.div(:id => 'color25').click
$b.text_field(:id => 'norm_button').set '0.1'
assert ($b.clone_info('25')[:size].text == '0.129%'), "Span show correct size before normalization"
$b.clone_info('25')[:star].click
$b.tag_selector_edit_normalisation.set '0.1'
$b.send_keys :enter
assert ($b.span(:text => '10.00%').present?), "Span show correct normalized size"
assert ($b.clone_info('25')[:size].text == '10.00%'), "Span show correct normalized size"
$b.element(:id => 'settings_menu').click
assert ($b.div(:id => 'normalize_list').visible?), "After clicking normalize_list form should be visible"
$b.menu_settings.click
assert ($b.form(:id => 'normalize_list').present?), "After clicking normalize_list form should be visible"
assert ($b.div(:id => 'normalizetest25').present?), "Form have the input for expected normalization"
$b.div(:id => 'reset_norm').click
$b.input(:id => 'reset_norm').click
$b.send_keys :escape
assert ($b.span(:text => '0.129%').present?), "Span show correct size after reset normalization"
assert ($b.clone_info('25')[:size].text == '0.129%'), "Span show correct size after reset normalization"
end
def test_02_normalization_external
set_browser("/doc/analysis-example.vidjil")
assert ($b.span(:text => '0.122%').present?), "Span show correct normalized size (external) by default"
assert ($b.clone_info('1')[:size].text == '0.081%'), "Span show correct size after reset normalization"
$b.element(:id => 'settings_menu').click
assert ($b.div(:id => 'normalize_list').visible?), "After clicking normalize_list form should be visible"
$b.menu_settings.click
assert ($b.form(:id => 'normalize_list').present?), "After clicking normalize_list form should be visible"
assert ($b.div(:id => 'normalize_external').present?), "Form have the input for external normalization"
assert (not $b.div(:id => 'normalizetest25').present?), "Form have not the input for expected normalization"
assert ($b.div(:id => 'normalizetest25').present?), "Form still have the input for expected normalization"
$b.div(:id => 'reset_norm').click
$b.div(:id => 'normalize_external').click
assert ($b.span(:text => '0.081%').present?), "Span show correct size after reset normalization"
assert ($b.clone_info('1')[:size].text == '0.122%'), "Span should show correct normalized size (external) (" + $b.clone_info('1')[:size].text+")"
end
......
......@@ -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
......@@ -74,8 +75,8 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
def test_07_export_fasta
$b.element(:id => 'btn_exportfasta').click
assert ( $b.window(:title => "").exists? ) , ">> fail opening fasta export "
$b.window(:title => "").use do
assert ( $b.window(:url => /about:blank/).exists? ) , ">> fail opening fasta export "
$b.window(:url => /about:blank/).use do
assert ($b.text.index(/TRGV5.*200 nt/) > 0), "header name"
assert ($b.text.index(/IGHV3-13.*374 nt/) > 0), "header name"
assert ($b.text.include? "CCTGGG\nGGGCCAG\nATT"), "sequence"
......
......@@ -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
......@@ -308,7 +309,7 @@ class VidjilBrowser < Watir::Browser
# Return the field for editing tag name in the tag selector
def tag_selector_edit_normalisation
return tag_selector.text_field(:id => 'normalized_size')
return tag_selector.text_field(:id => 'norm_button')
end
# Return the button that validates the changes in the tag selector
......
......@@ -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
......@@ -488,6 +473,8 @@ make functional
#+END_SRC
If you have to launch =irb= on a remote server without X (only using =Xvfb=)