external_test_segmenter-page-errors.rb 1.66 KB
Newer Older
1
load 'segmenter_browser.rb'
2
load 'segmenter_test.rb'
3

4
class TestSegmenterPageErrors < SegmenterTest
5
6
7
8
9
10
11
12
13
14

  def test_00_launch_bad_query
    sequences = $b.textarea(:id => 'form_sequences')

    sequences.set "blabla"
    
    assert (not $b.element(:class => 'flash_2').present?), "No log message should be present yet"

    $b.button(:id => 'form_submit').click

Mikaël Salson's avatar
Mikaël Salson committed
15
    $b.element(:class => 'flash_2').wait_until(&:present?)
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    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"
    assert (not $b.element(:class => 'scatterplot').present?), "Segmenter should not be present"
  end

  def test_01_launch_unsegmented_seq
    sequences = $b.textarea(:id => 'form_sequences')

    sequences.set ">seq1
CGTCTT"
    
    assert (not $b.element(:class => 'segmenter').present?), "Segmenter should not be present yet"
    assert (not $b.element(:class => 'scatterplot').present?), "Segmenter should not be present yet"

    $b.button(:id => 'form_submit').click

Mikaël Salson's avatar
Mikaël Salson committed
33
34
    $b.element(:class => 'imgAjaxLoading').wait_until(&:present?)
    $b.clone_in_segmenter('0').wait_until(&:present?)
35
36
37
38
39
40
41
42
43
44
45
    
    assert ($b.element(:class => 'segmenter').present?), "Segmenter should be present"
    assert ($b.element(:class => 'scatterplot').present?), "Segmenter should be present"
    assert ($b.clone_in_segmenter('0').exists?), "We should have one sequence"
    assert ($b.clone_in_segmenter('0').text.include? 'CGTCTT'), "We should have sequence CGTCTT, %s instead" % $b.clone_in_segmenter('0').text
  end

  def test_zz_close
    close_everything
  end
end