test_analysis-example1.rb 2.32 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
load 'vidjil_browser.rb'
load 'browser_test.rb'

class TestSimple < BrowserTest

  def setup
    super
    if not defined? $b
      set_browser("/doc/analysis-example1.vidjil")
    end
  end
  
  def test_00_graph_hidden
    assert (not $b.clone_in_graph('0').visible?), "Graph lines should not be visible"
    assert ($b.graph().style('height')=='0px'), "Graph should be hidden"
  end

18
19
20
21
22
23
  def test_00_double_scatterplot
    # analysis-example has only one sample, second scatterplot expected
    assert ( $b.div(:id => 'visu', :class => 'scatterplot').exists?), "First scatterplot should be found"
    assert ( $b.div(:id => 'visu2', :class => 'scatterplot').exists?), "Second scatterplot should be found"
  end

24
25
26
27
28
29
30
31
32
  def test_01_legend_scatterplot
    assert ($b.scatterplot_x_legend(0).text == "TRGV5"), "First legend should be TRGV5"
    assert ($b.scatterplot_y_legend(0).text == "TRGJ1"), "First legend should be TRGJ1"
  end

  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
33
    assert ($b.info_selected_locus.text == "no read"), "When unselected we have no reads"
34
35
36
37
38
39
40
41

    # Reactivate
    $b.locus_topleft('TRG').click
    $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

  def test_03_color_V
42
    $b.color_by('V/5\'')
43
44
45
46
47
48
49
50
51
52

    color_sp_legend = $b.scatterplot_x_legend(0).style('color')
    color_clone_sp = $b.clone_in_scatterplot('0').style('color')
    color_clone_list = $b.clone_in_list('0').style('color')

    assert (color_sp_legend == color_clone_sp), "Legend on V and clone should have the same color"
    assert (color_clone_list == color_clone_sp), "Clone should have the same color in list and in scatterplot"
  end

  def test_03_color_J
53
    $b.color_by('J/3\'')
54
55
56
57
58
59
60
61
62
63
64
65
66

    color_sp_legend = $b.scatterplot_y_legend(0).style('color')
    color_clone_sp = $b.clone_in_scatterplot('0').style('color')
    color_clone_list = $b.clone_in_list('0').style('color')

    assert (color_sp_legend == color_clone_sp), "Legend on V and clone should have the same color"
    assert (color_clone_list == color_clone_sp), "Clone should have the same color in list and in scatterplot"
  end

  def test_zz_close
    close_everything
  end
end