celerity 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +10 -0
- data/README.txt +8 -11
- data/Rakefile +5 -3
- data/benchmark/bm_2000_spans.rb +48 -0
- data/benchmark/bm_digg.rb +26 -0
- data/benchmark/bm_google_images.rb +36 -0
- data/benchmark/bm_input_locator.rb +69 -0
- data/benchmark/loader.rb +9 -0
- data/lib/celerity.rb +3 -1
- data/lib/celerity/container.rb +23 -171
- data/lib/celerity/disabled_element.rb +1 -1
- data/lib/celerity/element.rb +78 -47
- data/lib/celerity/element_collections.rb +16 -32
- data/lib/celerity/element_locator.rb +135 -0
- data/lib/celerity/elements/button.rb +15 -0
- data/lib/celerity/elements/file_field.rb +1 -1
- data/lib/celerity/elements/form.rb +2 -1
- data/lib/celerity/elements/frame.rb +18 -21
- data/lib/celerity/elements/image.rb +2 -8
- data/lib/celerity/elements/label.rb +1 -3
- data/lib/celerity/elements/link.rb +1 -1
- data/lib/celerity/elements/option.rb +16 -0
- data/lib/celerity/elements/radio_check.rb +18 -7
- data/lib/celerity/elements/select_list.rb +1 -17
- data/lib/celerity/elements/table.rb +4 -4
- data/lib/celerity/elements/table_body.rb +6 -8
- data/lib/celerity/elements/table_cell.rb +3 -14
- data/lib/celerity/elements/table_row.rb +4 -10
- data/lib/celerity/elements/text_field.rb +16 -4
- data/lib/celerity/extra/method_generator.rb +144 -0
- data/lib/celerity/identifier.rb +10 -0
- data/lib/celerity/ie.rb +28 -13
- data/lib/celerity/input_element.rb +0 -4
- data/lib/celerity/non_control_elements.rb +12 -12
- data/lib/celerity/version.rb +1 -1
- data/spec/area_spec.rb +41 -41
- data/spec/areas_spec.rb +11 -11
- data/spec/button_spec.rb +73 -68
- data/spec/buttons_spec.rb +10 -10
- data/spec/checkbox_spec.rb +102 -96
- data/spec/checkboxes_spec.rb +10 -10
- data/spec/div_spec.rb +78 -73
- data/spec/divs_spec.rb +10 -10
- data/spec/element_spec.rb +20 -11
- data/spec/filefield_spec.rb +36 -41
- data/spec/filefields_spec.rb +10 -10
- data/spec/form_spec.rb +29 -29
- data/spec/forms_spec.rb +11 -11
- data/spec/frame_spec.rb +54 -49
- data/spec/hidden_spec.rb +43 -43
- data/spec/hiddens_spec.rb +10 -10
- data/spec/html/2000_spans.html +2009 -0
- data/spec/html/forms_with_input_elements.html +15 -9
- data/spec/html/non_control_elements.html +4 -2
- data/spec/ie_spec.rb +82 -48
- data/spec/image_spec.rb +83 -100
- data/spec/images_spec.rb +10 -10
- data/spec/label_spec.rb +29 -29
- data/spec/labels_spec.rb +10 -10
- data/spec/li_spec.rb +41 -41
- data/spec/link_spec.rb +65 -59
- data/spec/links_spec.rb +11 -11
- data/spec/lis_spec.rb +10 -10
- data/spec/map_spec.rb +30 -30
- data/spec/maps_spec.rb +10 -10
- data/spec/p_spec.rb +49 -49
- data/spec/pre_spec.rb +41 -41
- data/spec/pres_spec.rb +10 -10
- data/spec/ps_spec.rb +10 -10
- data/spec/radio_spec.rb +104 -97
- data/spec/radios_spec.rb +11 -11
- data/spec/select_list_spec.rb +118 -106
- data/spec/select_lists_spec.rb +15 -15
- data/spec/span_spec.rb +54 -54
- data/spec/spans_spec.rb +11 -11
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +23 -3
- data/spec/table_bodies.rb +8 -8
- data/spec/table_bodies_spec.rb +9 -9
- data/spec/table_body_spec.rb +28 -27
- data/spec/table_cell_spec.rb +25 -25
- data/spec/table_cells_spec.rb +16 -16
- data/spec/table_row_spec.rb +16 -16
- data/spec/table_rows_spec.rb +12 -12
- data/spec/table_spec.rb +36 -36
- data/spec/tables_spec.rb +12 -12
- data/spec/text_field_spec.rb +111 -92
- data/spec/text_fields_spec.rb +13 -13
- data/tasks/benchmark.rake +3 -0
- data/tasks/rspec.rake +2 -2
- data/tasks/testserver.rake +15 -0
- metadata +58 -46
- data/tasks/simple_ci.rake +0 -94
data/spec/table_cell_spec.rb
CHANGED
@@ -3,58 +3,58 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "TableCell" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@browser = IE.new
|
12
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
13
13
|
end
|
14
14
|
|
15
15
|
# Exists
|
16
16
|
describe "#exists" do
|
17
17
|
it "should return true when the table cell exists" do
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
18
|
+
@browser.cell(:id, 't1_r2_c1').should exist
|
19
|
+
@browser.cell(:id, /t1_r2_c1/).should exist
|
20
|
+
@browser.cell(:text, 'Table 1, Row 3, Cell 1').should exist
|
21
|
+
@browser.cell(:text, /Table 1/).should exist
|
22
|
+
@browser.cell(:index, 1).should exist
|
23
|
+
@browser.cell(:xpath, "//td[@id='t1_r2_c1']").should exist
|
24
24
|
end
|
25
25
|
it "should return false when the table cell does not exist" do
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
26
|
+
@browser.cell(:id, 'no_such_id').should_not exist
|
27
|
+
@browser.cell(:id, /no_such_id/).should_not exist
|
28
|
+
@browser.cell(:text, 'no_such_text').should_not exist
|
29
|
+
@browser.cell(:text, /no_such_text/).should_not exist
|
30
|
+
@browser.cell(:index, 1337).should_not exist
|
31
|
+
@browser.cell(:xpath, "//td[@id='no_such_id']").should_not exist
|
32
32
|
end
|
33
|
-
it "should raise ArgumentError when what argument is invalid" do
|
34
|
-
lambda { @
|
33
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
34
|
+
lambda { @browser.cell(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
35
35
|
end
|
36
|
-
it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
|
37
|
-
lambda { @
|
36
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
37
|
+
lambda { @browser.cell(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
# Attribute methods
|
42
42
|
describe "#text" do
|
43
43
|
it "should return the text inside the table cell" do
|
44
|
-
@
|
45
|
-
@
|
44
|
+
@browser.cell(:id, 't1_r2_c1').text.should == 'Table 1, Row 2, Cell 1'
|
45
|
+
@browser.cell(:id, 't2_r1_c1').text.should == 'Table 2, Row 1, Cell 1'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#colspan" do
|
50
50
|
it "should get the colspan attribute" do
|
51
|
-
@
|
52
|
-
@
|
51
|
+
@browser.cell(:id, 'colspan_2').colspan.should == 2
|
52
|
+
@browser.cell(:id, 'no_colspan').colspan.should == 1
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
after :all do
|
57
|
-
@
|
57
|
+
@browser.close
|
58
58
|
end
|
59
59
|
|
60
60
|
|
data/spec/table_cells_spec.rb
CHANGED
@@ -3,47 +3,47 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "TableCells" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@browser = IE.new
|
12
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
13
13
|
end
|
14
14
|
|
15
15
|
# describe "#length" do
|
16
16
|
# it "should return the number of cells" do
|
17
|
-
# @
|
18
|
-
# @
|
17
|
+
# @browser.table(:id, 'outer').cells.length.should == 6
|
18
|
+
# @browser.table(:id, 'inner').cells.length.should == 2
|
19
19
|
# end
|
20
20
|
# end
|
21
21
|
#
|
22
22
|
# describe "#[]" do
|
23
23
|
# it "should return the row at the given index" do
|
24
|
-
# @
|
25
|
-
# @
|
26
|
-
# @
|
24
|
+
# @browser.table(:id, 'outer').cells[1].text.should == "Table 1, Row 1, Cell 1"
|
25
|
+
# @browser.table(:id, 'inner').cells[1].text.should == "Table 2, Row 1, Cell 1"
|
26
|
+
# @browser.table(:id, 'outer').cells[6].text.should == "Table 1, Row 3, Cell 2"
|
27
27
|
# end
|
28
28
|
# end
|
29
29
|
|
30
30
|
describe "#each" do
|
31
31
|
it "should iterate through cells correctly" do
|
32
32
|
# All cells on the page
|
33
|
-
@
|
34
|
-
c.name.should == @
|
35
|
-
c.id.should == @
|
36
|
-
c.value.should == @
|
33
|
+
@browser.cells.each_with_index do |c, index|
|
34
|
+
c.name.should == @browser.cell(:index, index+1).name
|
35
|
+
c.id.should == @browser.cell(:index, index+1).id
|
36
|
+
c.value.should == @browser.cell(:index, index+1).value
|
37
37
|
end
|
38
38
|
# Cells inside a table
|
39
|
-
inner_table = @
|
39
|
+
inner_table = @browser.table(:id, 'inner')
|
40
40
|
inner_table.cells.each_with_index do |c, index|
|
41
41
|
c.name.should == inner_table.cell(:index, index+1).name
|
42
42
|
c.id.should == inner_table.cell(:index, index+1).id
|
43
43
|
c.value.should == inner_table.cell(:index, index+1).value
|
44
44
|
end
|
45
45
|
# Cells inside a table (should not include cells inside a table inside a table)
|
46
|
-
outer_table = @
|
46
|
+
outer_table = @browser.table(:id, 'outer')
|
47
47
|
outer_table.cells.each_with_index do |c, index|
|
48
48
|
c.name.should == outer_table.cell(:index, index+1).name
|
49
49
|
c.id.should == outer_table.cell(:index, index+1).id
|
@@ -53,7 +53,7 @@ describe "TableCells" do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
after :all do
|
56
|
-
@
|
56
|
+
@browser.close
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
data/spec/table_row_spec.rb
CHANGED
@@ -3,44 +3,44 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "TableRow" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@browser = IE.new
|
12
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#column_count" do
|
16
16
|
it "should return the number of columns (cells) in the row" do
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
17
|
+
@browser.table(:id, 'outer').rows[1].column_count.should == 2
|
18
|
+
@browser.table(:id, 'outer')[2].column_count.should == 2
|
19
|
+
@browser.table(:id, 'colspan')[1].column_count.should == 1
|
20
|
+
@browser.table(:id, 'colspan').rows[2].column_count.should == 2
|
21
|
+
@browser.rows[1].column_count.should == 4
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "#length" do
|
26
26
|
it "should return the number of rows" do
|
27
|
-
@
|
28
|
-
@
|
27
|
+
@browser.table(:id, 'outer').rows.length.should == 3
|
28
|
+
@browser.table(:id, 'inner').rows.length.should == 1
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#[]n" do
|
33
33
|
it "should " do
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
34
|
+
@browser.table(:id, 'outer').row(:index, 1)[1].text.should == "Table 1, Row 1, Cell 1"
|
35
|
+
@browser.table(:id, 'outer')[1][1].text.should == "Table 1, Row 1, Cell 1"
|
36
|
+
@browser.table(:id, 'outer')[3][1].text.should == "Table 1, Row 3, Cell 1"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "#each" do
|
41
41
|
it "should " do
|
42
42
|
index = 1
|
43
|
-
@
|
43
|
+
@browser.table(:id, 'outer')[2].each do |c|
|
44
44
|
case index
|
45
45
|
when 1
|
46
46
|
c.text.should == "Table 1, Row 2, Cell 1"
|
@@ -53,7 +53,7 @@ describe "TableRow" do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
after :all do
|
56
|
-
@
|
56
|
+
@browser.close
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
data/spec/table_rows_spec.rb
CHANGED
@@ -3,45 +3,45 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "TableRows" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@browser = IE.new
|
12
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#length" do
|
16
16
|
it "should return the correct number of cells (table context)" do
|
17
|
-
@
|
18
|
-
@
|
17
|
+
@browser.table(:id, 'inner').rows.length.should == 1
|
18
|
+
@browser.table(:id, 'outer').rows.length.should == 3
|
19
19
|
end
|
20
20
|
it "should return the correct number of cells (page context)" do
|
21
|
-
@
|
21
|
+
@browser.rows.length.should == 14
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "#[]" do
|
26
26
|
it "should return the row at the given index (table context)" do
|
27
|
-
@
|
27
|
+
@browser.table(:id, 'outer').rows[1].text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
|
28
28
|
end
|
29
29
|
it "should return the row at the given index (page context)" do
|
30
|
-
@
|
30
|
+
@browser.rows[1].text.should == "Before income tax Income tax After income tax"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "#each" do
|
35
35
|
it "should iterate through rows correctly" do
|
36
36
|
# rows inside a table
|
37
|
-
inner_table = @
|
37
|
+
inner_table = @browser.table(:id, 'inner')
|
38
38
|
inner_table.rows.each_with_index do |r, index|
|
39
39
|
r.name.should == inner_table.row(:index, index+1).name
|
40
40
|
r.id.should == inner_table.row(:index, index+1).id
|
41
41
|
r.value.should == inner_table.row(:index, index+1).value
|
42
42
|
end
|
43
43
|
# rows inside a table (should not include rows inside a table inside a table)
|
44
|
-
outer_table = @
|
44
|
+
outer_table = @browser.table(:id, 'outer')
|
45
45
|
outer_table.rows.each_with_index do |r, index|
|
46
46
|
r.name.should == outer_table.row(:index, index+1).name
|
47
47
|
r.id.should == outer_table.row(:index, index+1).id
|
@@ -51,7 +51,7 @@ describe "TableRows" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
after :all do
|
54
|
-
@
|
54
|
+
@browser.close
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
data/spec/table_spec.rb
CHANGED
@@ -3,96 +3,96 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "Table" do
|
4
4
|
|
5
5
|
before :all do
|
6
|
-
@
|
7
|
-
add_spec_checker(@
|
6
|
+
@browser = IE.new
|
7
|
+
add_spec_checker(@browser)
|
8
8
|
end
|
9
9
|
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@browser = IE.new
|
12
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
13
13
|
end
|
14
14
|
|
15
15
|
# Exists
|
16
16
|
describe "#exists?" do
|
17
17
|
it "should return true if the table exists" do
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
18
|
+
@browser.table(:id, 'axis_example').should exist
|
19
|
+
@browser.table(:id, /axis_example/).should exist
|
20
|
+
@browser.table(:index, 1).should exist
|
21
|
+
@browser.table(:xpath, "//table[@id='axis_example']").should exist
|
22
22
|
end
|
23
23
|
it "should return false if the table does not exist" do
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
24
|
+
@browser.table(:id, 'no_such_id').should_not exist
|
25
|
+
@browser.table(:id, /no_such_id/).should_not exist
|
26
|
+
@browser.table(:index, 1337).should_not exist
|
27
|
+
@browser.table(:xpath, "//table[@id='no_such_id']").should_not exist
|
28
28
|
end
|
29
|
-
it "should raise ArgumentError when what argument is invalid" do
|
30
|
-
lambda { @
|
29
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
30
|
+
lambda { @browser.table(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
31
31
|
end
|
32
|
-
it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
|
33
|
-
lambda { @
|
32
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
33
|
+
lambda { @browser.table(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
# Other
|
38
38
|
describe "#to_a" do
|
39
39
|
it "should return a two-dimensional array representation of the table" do
|
40
|
-
@
|
40
|
+
@browser.table(:id, 'inner').to_a.should == [["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]]
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "#row_count" do
|
45
45
|
it "should count the number of rows correctly" do
|
46
|
-
@
|
47
|
-
@
|
46
|
+
@browser.table(:id, 'inner').row_count.should == 1
|
47
|
+
@browser.table(:id, 'outer').row_count.should == 3
|
48
48
|
end
|
49
49
|
it "should raise an UnknownObjectException if the table doesn't exist" do
|
50
|
-
lambda { @
|
51
|
-
lambda { @
|
50
|
+
lambda { @browser.table(:id, 'no_such_id').row_count }.should raise_error(UnknownObjectException)
|
51
|
+
lambda { @browser.table(:index, 1337).row_count }.should raise_error(UnknownObjectException)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "#row_values" do
|
56
56
|
it "should get row values" do
|
57
|
-
@
|
58
|
-
@
|
59
|
-
@
|
57
|
+
@browser.table(:id, 'outer').row_values(1).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 1, Cell 2"]
|
58
|
+
@browser.table(:id, 'inner').row_values(1).should == ["Table 2, Row 1, Cell 1", "Table 2, Row 1, Cell 2"]
|
59
|
+
@browser.table(:id, 'outer').row_values(3).should == ["Table 1, Row 3, Cell 1", "Table 1, Row 3, Cell 2"]
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "#column_count" do
|
64
64
|
it "should count the number of columns correctly" do
|
65
|
-
@
|
66
|
-
@
|
65
|
+
@browser.table(:id, 'inner').column_count.should == 2
|
66
|
+
@browser.table(:id, 'outer').column_count.should == 2
|
67
67
|
end
|
68
68
|
it "should raise an UnknownObjectException if the table doesn't exist" do
|
69
|
-
lambda { @
|
70
|
-
lambda { @
|
69
|
+
lambda { @browser.table(:id, 'no_such_id').column_count }.should raise_error(UnknownObjectException)
|
70
|
+
lambda { @browser.table(:index, 1337).column_count }.should raise_error(UnknownObjectException)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "#column_values" do
|
75
75
|
it "should get column values" do
|
76
|
-
@
|
77
|
-
@
|
76
|
+
@browser.table(:id, 'inner').column_values(1).should == ["Table 2, Row 1, Cell 1"]
|
77
|
+
@browser.table(:id, 'outer').column_values(1).should == ["Table 1, Row 1, Cell 1", "Table 1, Row 2, Cell 1", "Table 1, Row 3, Cell 1"]
|
78
78
|
end
|
79
79
|
it "should raise UnknownCellException when trying to locate non-existing cell" do
|
80
|
-
lambda { @
|
80
|
+
lambda { @browser.table(:id, 'inner').column_values(1337) }.should raise_error(UnknownCellException)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
describe "#[]" do
|
85
85
|
it "should return the row at the given index" do
|
86
|
-
@
|
87
|
-
@
|
88
|
-
@
|
86
|
+
@browser.table(:id, 'outer')[1].id.should == "outer_first"
|
87
|
+
@browser.table(:id, 'inner')[1].id.should == "inner_first"
|
88
|
+
@browser.table(:id, 'outer')[3].id.should == "outer_last"
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "#each" do
|
93
93
|
it "should iterate through the table's rows" do
|
94
94
|
index = 1
|
95
|
-
@
|
95
|
+
@browser.table(:id, 'outer').each do |r|
|
96
96
|
case index
|
97
97
|
when 1
|
98
98
|
r.text.should == "Table 1, Row 1, Cell 1 Table 1, Row 1, Cell 2"
|
@@ -105,7 +105,7 @@ describe "Table" do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
after :all do
|
108
|
-
@
|
108
|
+
@browser.close
|
109
109
|
end
|
110
110
|
|
111
111
|
end
|
data/spec/tables_spec.rb
CHANGED
@@ -2,40 +2,40 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
3
3
|
describe "Tables" do
|
4
4
|
before :all do
|
5
|
-
@
|
6
|
-
add_spec_checker(@
|
5
|
+
@browser = IE.new
|
6
|
+
add_spec_checker(@browser)
|
7
7
|
end
|
8
8
|
|
9
9
|
before :each do
|
10
|
-
@
|
10
|
+
@browser.goto(TEST_HOST + "/tables.html")
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "#length" do
|
14
14
|
it "should return the number of tables" do
|
15
|
-
@
|
15
|
+
@browser.tables.length.should == 4
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "#[]" do
|
20
20
|
it "should return the p at the given index" do
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
21
|
+
@browser.tables[1].id.should == "axis_example"
|
22
|
+
@browser.tables[2].id.should == "outer"
|
23
|
+
@browser.tables[3].id.should == "inner"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "#each" do
|
28
28
|
it "should iterate through tables correctly" do
|
29
|
-
@
|
30
|
-
t.name.should == @
|
31
|
-
t.id.should == @
|
32
|
-
t.value.should == @
|
29
|
+
@browser.tables.each_with_index do |t, index|
|
30
|
+
t.name.should == @browser.table(:index, index+1).name
|
31
|
+
t.id.should == @browser.table(:index, index+1).id
|
32
|
+
t.value.should == @browser.table(:index, index+1).value
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
after :all do
|
38
|
-
@
|
38
|
+
@browser.close
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|