celerity 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +33 -0
- data/README.txt +19 -9
- data/Rakefile +9 -3
- data/lib/celerity.rb +39 -39
- data/lib/celerity/browser.rb +538 -153
- data/lib/celerity/clickable_element.rb +48 -7
- data/lib/celerity/collections.rb +155 -131
- data/lib/celerity/container.rb +766 -385
- data/lib/celerity/default_viewer.rb +10 -0
- data/lib/celerity/disabled_element.rb +19 -2
- data/lib/celerity/element.rb +152 -83
- data/lib/celerity/element_collection.rb +106 -0
- data/lib/celerity/element_locator.rb +89 -66
- data/lib/celerity/elements/button.rb +23 -13
- data/lib/celerity/elements/file_field.rb +17 -5
- data/lib/celerity/elements/form.rb +21 -16
- data/lib/celerity/elements/frame.rb +75 -53
- data/lib/celerity/elements/image.rb +76 -63
- data/lib/celerity/elements/label.rb +4 -2
- data/lib/celerity/elements/link.rb +30 -18
- data/lib/celerity/elements/meta.rb +6 -0
- data/lib/celerity/{non_control_elements.rb → elements/non_control_elements.rb} +106 -76
- data/lib/celerity/elements/option.rb +16 -2
- data/lib/celerity/elements/radio_check.rb +55 -20
- data/lib/celerity/elements/select_list.rb +65 -29
- data/lib/celerity/elements/table.rb +141 -94
- data/lib/celerity/elements/table_cell.rb +13 -6
- data/lib/celerity/elements/{table_body.rb → table_elements.rb} +20 -8
- data/lib/celerity/elements/table_row.rb +23 -7
- data/lib/celerity/elements/text_field.rb +89 -33
- data/lib/celerity/exception.rb +77 -41
- data/lib/celerity/extra/method_generator.rb +42 -24
- data/lib/celerity/htmlunit.rb +49 -0
- data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.5-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.12-20090308.130127-11.jar +0 -0
- data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
- data/lib/celerity/identifier.rb +3 -2
- data/lib/celerity/input_element.rb +5 -5
- data/lib/celerity/listener.rb +135 -0
- data/lib/celerity/resources/no_viewer.png +0 -0
- data/lib/celerity/util.rb +88 -0
- data/lib/celerity/version.rb +4 -3
- data/lib/celerity/watir_compatibility.rb +35 -25
- data/tasks/jar.rake +57 -0
- metadata +35 -142
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -150
- data/lib/celerity/element_collections.rb +0 -54
- data/lib/celerity/element_map.rb +0 -51
- data/lib/celerity/elements/table_footer.rb +0 -30
- data/lib/celerity/elements/table_header.rb +0 -30
- data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
- data/lib/celerity/htmlunit/download.sh +0 -23
- data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
- data/lib/celerity/htmlunit/nekohtml-1.9.8.jar +0 -0
- data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
- data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
- data/spec/area_spec.rb +0 -97
- data/spec/areas_spec.rb +0 -40
- data/spec/browser_spec.rb +0 -266
- data/spec/button_spec.rb +0 -227
- data/spec/buttons_spec.rb +0 -39
- data/spec/checkbox_spec.rb +0 -302
- data/spec/checkboxes_spec.rb +0 -38
- data/spec/div_spec.rb +0 -207
- data/spec/divs_spec.rb +0 -39
- data/spec/element_spec.rb +0 -79
- data/spec/filefield_spec.rb +0 -123
- data/spec/filefields_spec.rb +0 -40
- data/spec/form_spec.rb +0 -59
- data/spec/forms_spec.rb +0 -41
- data/spec/frame_spec.rb +0 -121
- data/spec/frames_spec.rb +0 -71
- data/spec/hidden_spec.rb +0 -127
- data/spec/hiddens_spec.rb +0 -39
- data/spec/hn_spec.rb +0 -104
- data/spec/hns_spec.rb +0 -45
- data/spec/html/2000_spans.html +0 -2009
- data/spec/html/bug_duplicate_attributes.html +0 -14
- data/spec/html/bug_javascript_001.html +0 -11
- data/spec/html/form_js_bug.html +0 -11
- data/spec/html/forms_with_input_elements.html +0 -114
- data/spec/html/frame_1.html +0 -17
- data/spec/html/frame_2.html +0 -16
- data/spec/html/frames.html +0 -11
- data/spec/html/iframes.html +0 -12
- data/spec/html/images.html +0 -27
- data/spec/html/images/1.gif +0 -0
- data/spec/html/images/2.gif +0 -0
- data/spec/html/images/3.gif +0 -0
- data/spec/html/images/button.jpg +0 -0
- data/spec/html/images/circle.jpg +0 -0
- data/spec/html/images/map.gif +0 -0
- data/spec/html/images/map2.gif +0 -0
- data/spec/html/images/minus.gif +0 -0
- data/spec/html/images/originaltriangle.jpg +0 -0
- data/spec/html/images/plus.gif +0 -0
- data/spec/html/images/square.jpg +0 -0
- data/spec/html/images/triangle.jpg +0 -0
- data/spec/html/invalid_js.html +0 -11
- data/spec/html/latin1_text.html +0 -17
- data/spec/html/non_control_elements.html +0 -115
- data/spec/html/simple_ajax.html +0 -22
- data/spec/html/tables.html +0 -119
- data/spec/html/utf8_text.html +0 -15
- data/spec/htmlunit_spec.rb +0 -26
- data/spec/image_spec.rb +0 -220
- data/spec/images_spec.rb +0 -39
- data/spec/label_spec.rb +0 -79
- data/spec/labels_spec.rb +0 -40
- data/spec/li_spec.rb +0 -139
- data/spec/link_spec.rb +0 -189
- data/spec/links_spec.rb +0 -43
- data/spec/lis_spec.rb +0 -40
- data/spec/map_spec.rb +0 -102
- data/spec/maps_spec.rb +0 -40
- data/spec/meta_spec.rb +0 -8
- data/spec/ol_spec.rb +0 -87
- data/spec/ols_spec.rb +0 -40
- data/spec/option_spec.rb +0 -154
- data/spec/p_spec.rb +0 -171
- data/spec/pre_spec.rb +0 -135
- data/spec/pres_spec.rb +0 -40
- data/spec/ps_spec.rb +0 -40
- data/spec/radio_spec.rb +0 -299
- data/spec/radios_spec.rb +0 -42
- data/spec/select_list_spec.rb +0 -299
- data/spec/select_lists_spec.rb +0 -47
- data/spec/span_spec.rb +0 -184
- data/spec/spans_spec.rb +0 -64
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -55
- data/spec/table_bodies_spec.rb +0 -57
- data/spec/table_body_spec.rb +0 -111
- data/spec/table_cell_spec.rb +0 -74
- data/spec/table_cells_spec.rb +0 -59
- data/spec/table_footer_spec.rb +0 -101
- data/spec/table_footers_spec.rb +0 -55
- data/spec/table_header_spec.rb +0 -101
- data/spec/table_headers_spec.rb +0 -55
- data/spec/table_row_spec.rb +0 -104
- data/spec/table_rows_spec.rb +0 -58
- data/spec/table_spec.rb +0 -160
- data/spec/tables_spec.rb +0 -42
- data/spec/text_field_spec.rb +0 -323
- data/spec/text_fields_spec.rb +0 -44
- data/spec/ul_spec.rb +0 -88
- data/spec/uls_spec.rb +0 -40
- data/spec/watir_compatibility_spec.rb +0 -260
- data/support/spec_server.rb +0 -73
- data/tasks/rspec.rake +0 -30
- data/tasks/specserver.rake +0 -21
- metadata.gz.sig +0 -0
data/spec/labels_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Labels" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@browser = Browser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
before :each do
|
10
|
-
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#length" do
|
14
|
-
it "should return the number of labels" do
|
15
|
-
@browser.labels.length.should == 26 # changed this from 25 - Jari
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#[]" do
|
20
|
-
it "should return the pre at the given index" do
|
21
|
-
@browser.labels[1].id.should == "first_label"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "#each" do
|
26
|
-
it "should iterate through labels correctly" do
|
27
|
-
@browser.labels.each_with_index do |l, index|
|
28
|
-
l.name.should == @browser.label(:index, index+1).name
|
29
|
-
l.id.should == @browser.label(:index, index+1).id
|
30
|
-
l.value.should == @browser.label(:index, index+1).value
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
after :all do
|
36
|
-
@browser.close
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
data/spec/li_spec.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Li" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@browser = Browser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
before :each do
|
10
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
# Exists method
|
14
|
-
describe "#exist?" do
|
15
|
-
it "should return true if the 'li' exists" do
|
16
|
-
@browser.li(:id, "non_link_1").should exist
|
17
|
-
@browser.li(:id, /non_link_1/).should exist
|
18
|
-
@browser.li(:text, "Non-link 3").should exist
|
19
|
-
@browser.li(:text, /Non-link 3/).should exist
|
20
|
-
@browser.li(:class, "nonlink").should exist
|
21
|
-
@browser.li(:class, /nonlink/).should exist
|
22
|
-
@browser.li(:index, 1).should exist
|
23
|
-
@browser.li(:xpath, "//li[@id='non_link_1']").should exist
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should return true if the element exists (default how = :id)" do
|
27
|
-
@browser.li("non_link_1").should exist
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should return false if the 'li' doesn't exist" do
|
31
|
-
@browser.li(:id, "no_such_id").should_not exist
|
32
|
-
@browser.li(:id, /no_such_id/).should_not exist
|
33
|
-
@browser.li(:text, "no_such_text").should_not exist
|
34
|
-
@browser.li(:text, /no_such_text/).should_not exist
|
35
|
-
@browser.li(:class, "no_such_class").should_not exist
|
36
|
-
@browser.li(:class, /no_such_class/).should_not exist
|
37
|
-
@browser.li(:index, 1337).should_not exist
|
38
|
-
@browser.li(:xpath, "//li[@id='no_such_id']").should_not exist
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should raise ArgumentError when 'what' argument is invalid" do
|
42
|
-
lambda { @browser.li(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
46
|
-
lambda { @browser.li(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Attribute methods
|
51
|
-
describe "#class_name" do
|
52
|
-
it "should return the class attribute" do
|
53
|
-
@browser.li(:id, 'non_link_1').class_name.should == 'nonlink'
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should return an empty string if the element exists and the attribute doesn't" do
|
57
|
-
@browser.li(:index, 1).class_name.should == ''
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should raise UnknownObjectException if the li doesn't exist" do
|
61
|
-
lambda { @browser.li(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#id" do
|
66
|
-
it "should return the id attribute" do
|
67
|
-
@browser.li(:class, 'nonlink').id.should == "non_link_1"
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should return an empty string if the element exists and the attribute doesn't" do
|
71
|
-
@browser.li(:index, 1).id.should == ''
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should raise UnknownObjectException if the li doesn't exist" do
|
75
|
-
lambda { @browser.li(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
76
|
-
lambda { @browser.li(:index, 1337).id }.should raise_error(UnknownObjectException)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "#title" do
|
81
|
-
it "should return the title attribute" do
|
82
|
-
@browser.li(:id, 'non_link_1').title.should == 'This is not a link!'
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should return an empty string if the element exists and the attribute doesn't" do
|
86
|
-
@browser.li(:index, 1).title.should == ''
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should raise UnknownObjectException if the li doesn't exist" do
|
90
|
-
lambda { @browser.li(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
91
|
-
lambda { @browser.li(:xpath, "//li[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#text" do
|
96
|
-
it "should return the text of the p" do
|
97
|
-
@browser.li(:id, 'non_link_1').text.should == 'Non-link 1'
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should return an empty string if the element doesn't contain any text" do
|
101
|
-
@browser.li(:index, 1).text.should == ''
|
102
|
-
end
|
103
|
-
|
104
|
-
it "should raise UnknownObjectException if the li doesn't exist" do
|
105
|
-
lambda { @browser.li(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
106
|
-
lambda { @browser.li(:xpath , "//li[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "#respond_to?" do
|
111
|
-
it "should return true for all attribute methods" do
|
112
|
-
@browser.li(:index, 1).should respond_to(:class_name)
|
113
|
-
@browser.li(:index, 1).should respond_to(:id)
|
114
|
-
@browser.li(:index, 1).should respond_to(:text)
|
115
|
-
@browser.li(:index, 1).should respond_to(:title)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
# Other
|
121
|
-
describe "#to_s" do
|
122
|
-
it "should return a human readable representation of the element" do
|
123
|
-
@browser.li(:id, 'non_link_1').to_s.should == "tag: li\n" +
|
124
|
-
" id: non_link_1\n" +
|
125
|
-
" class: nonlink\n" +
|
126
|
-
" title: This is not a link!\n" +
|
127
|
-
" text: Non-link 1"
|
128
|
-
end
|
129
|
-
|
130
|
-
it "should raise UnknownObjectException if the li doesn't exist" do
|
131
|
-
lambda { @browser.li(:xpath, "//li[@id='no_such_id']").to_s }.should raise_error( UnknownObjectException)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
after :all do
|
136
|
-
@browser.close
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
data/spec/link_spec.rb
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Link" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@browser = Browser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
before :each do
|
10
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
# Exists method
|
14
|
-
describe "#exist?" do
|
15
|
-
it "should return true if the link exists" do
|
16
|
-
@browser.link(:id, 'link_2').should exist
|
17
|
-
@browser.link(:id, /link_2/).should exist
|
18
|
-
@browser.link(:name, 'bad_attribute').should exist
|
19
|
-
@browser.link(:name, /bad_attribute/).should exist
|
20
|
-
@browser.link(:title, "link_title_2").should exist
|
21
|
-
@browser.link(:title, /link_title_2/).should exist
|
22
|
-
@browser.link(:text, "Link 2").should exist
|
23
|
-
@browser.link(:text, /Link 2/i).should exist
|
24
|
-
@browser.link(:url, 'non_control_elements.html').should exist
|
25
|
-
@browser.link(:url, /non_control_elements.html/).should exist
|
26
|
-
@browser.link(:index, 2).should exist
|
27
|
-
@browser.link(:xpath, "//a[@id='link_2']").should exist
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should return true if the element exists (default how = :href)" do
|
31
|
-
@browser.link(/input_elements/).should exist
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should return false if the link doesn't exist" do
|
35
|
-
@browser.link(:id, 'no_such_id').should_not exist
|
36
|
-
@browser.link(:id, /no_such_id/).should_not exist
|
37
|
-
@browser.link(:name, 'no_such_name').should_not exist
|
38
|
-
@browser.link(:name, /no_such_name/).should_not exist
|
39
|
-
@browser.link(:title, "no_such_title").should_not exist
|
40
|
-
@browser.link(:title, /no_such_title/).should_not exist
|
41
|
-
@browser.link(:text, "no_such_text").should_not exist
|
42
|
-
@browser.link(:text, /no_such_text/i).should_not exist
|
43
|
-
@browser.link(:url, 'no_such_href').should_not exist
|
44
|
-
@browser.link(:url, /no_such_href/).should_not exist
|
45
|
-
@browser.link(:index, 1337).should_not exist
|
46
|
-
@browser.link(:xpath, "//a[@id='no_such_id']").should_not exist
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should raise ArgumentError when 'what' argument is invalid" do
|
50
|
-
lambda { @browser.link(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
54
|
-
lambda { @browser.link(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# Attribute methods
|
59
|
-
describe "#class_name" do
|
60
|
-
it "should return the type attribute if the link exists" do
|
61
|
-
@browser.link(:index, 2).class_name.should == "external"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should return an empty string if the link exists and the attribute doesn't" do
|
65
|
-
@browser.link(:index, 1).class_name.should == ''
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
69
|
-
lambda { @browser.link(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "#href" do
|
74
|
-
it "should return the href attribute if the link exists" do
|
75
|
-
@browser.link(:index, 2).href.should match(/non_control_elements/)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should return an empty string if the link exists and the attribute doesn't" do
|
79
|
-
@browser.link(:index, 1).href.should == ""
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
83
|
-
lambda { @browser.link(:index, 1337).href }.should raise_error(UnknownObjectException)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "#url" do
|
88
|
-
it "should return the href attribute" do
|
89
|
-
@browser.link(:index, 2).url.should match(/non_control_elements/)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe "#id" do
|
94
|
-
it "should return the id attribute if the link exists" do
|
95
|
-
@browser.link(:index, 2).id.should == "link_2"
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should return an empty string if the link exists and the attribute doesn't" do
|
99
|
-
@browser.link(:index, 1).id.should == ""
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
103
|
-
lambda { @browser.link(:index, 1337).id }.should raise_error(UnknownObjectException)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#name" do
|
108
|
-
it "should return the name attribute if the link exists" do
|
109
|
-
@browser.link(:index, 3).name.should == "bad_attribute"
|
110
|
-
end
|
111
|
-
|
112
|
-
it "should return an empty string if the link exists and the attribute doesn't" do
|
113
|
-
@browser.link(:index, 1).name.should == ''
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
117
|
-
lambda { @browser.link(:index, 1337).name }.should raise_error(UnknownObjectException)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe "#text" do
|
122
|
-
it "should return the link text" do
|
123
|
-
@browser.link(:index, 2).text.should == "Link 2"
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should return an empty string if the link exists and contains no text" do
|
127
|
-
@browser.link(:index, 1).text.should == ""
|
128
|
-
end
|
129
|
-
|
130
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
131
|
-
lambda { @browser.link(:index, 1337).text }.should raise_error(UnknownObjectException)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe "#title" do
|
136
|
-
it "should return the type attribute if the link exists" do
|
137
|
-
@browser.link(:index, 2).title.should == "link_title_2"
|
138
|
-
end
|
139
|
-
|
140
|
-
it "should return an empty string if the link exists and the attribute doesn't" do
|
141
|
-
@browser.link(:index, 1).title.should == ""
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
145
|
-
lambda { @browser.link(:index, 1337).title }.should raise_error(UnknownObjectException)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe "#respond_to?" do
|
150
|
-
it "should return true for all attribute methods" do
|
151
|
-
@browser.link(:index, 1).should respond_to(:class_name)
|
152
|
-
@browser.link(:index, 1).should respond_to(:href)
|
153
|
-
@browser.link(:index, 1).should respond_to(:url)
|
154
|
-
@browser.link(:index, 1).should respond_to(:id)
|
155
|
-
@browser.link(:index, 1).should respond_to(:name)
|
156
|
-
@browser.link(:index, 1).should respond_to(:style)
|
157
|
-
@browser.link(:index, 1).should respond_to(:text)
|
158
|
-
@browser.link(:index, 1).should respond_to(:title)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
|
163
|
-
# Manipulation methods
|
164
|
-
describe "#click" do
|
165
|
-
it "should find an existing link by (:text, String) and click it" do
|
166
|
-
@browser.link(:text, "Link 3").click
|
167
|
-
@browser.text.include?("User administration").should be_true
|
168
|
-
end
|
169
|
-
|
170
|
-
it "should find an existing link by (:text, Regexp) and click it" do
|
171
|
-
@browser.link(:url, /forms_with_input_elements/).click
|
172
|
-
@browser.text.include?("User administration").should be_true
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should find an existing link by (:index, Integer) and click it" do
|
176
|
-
@browser.link(:index, 3).click
|
177
|
-
@browser.text.include?("User administration").should be_true
|
178
|
-
end
|
179
|
-
|
180
|
-
it "should raise an UnknownObjectException if the link doesn't exist" do
|
181
|
-
lambda { @browser.link(:index, 1337).click }.should raise_error(UnknownObjectException)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
after :all do
|
186
|
-
@browser.close
|
187
|
-
end
|
188
|
-
|
189
|
-
end
|
data/spec/links_spec.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Links" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@browser = Browser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
before :each do
|
10
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#length" do
|
14
|
-
it "should return the number of links" do
|
15
|
-
@browser.links.length.should == 3
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#[]" do
|
20
|
-
it "should return the link at the given index" do
|
21
|
-
@browser.links[3].id.should == "link_3"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "#each" do
|
26
|
-
it "should iterate through links correctly" do
|
27
|
-
index = 1
|
28
|
-
@browser.links.each do |c|
|
29
|
-
c.name.should == @browser.link(:index, index).name
|
30
|
-
c.id.should == @browser.link(:index, index).id
|
31
|
-
c.value.should == @browser.link(:index, index).value
|
32
|
-
index += 1
|
33
|
-
end
|
34
|
-
@browser.links.length.should == index - 1
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
after :all do
|
39
|
-
@browser.close
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
data/spec/lis_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Lis" do
|
4
|
-
|
5
|
-
before :all do
|
6
|
-
@browser = Browser.new
|
7
|
-
end
|
8
|
-
|
9
|
-
before :each do
|
10
|
-
@browser.goto(TEST_HOST + "/non_control_elements.html")
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#length" do
|
14
|
-
it "should return the number of lis" do
|
15
|
-
@browser.lis.length.should == 18
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#[]" do
|
20
|
-
it "should return the p at the given index" do
|
21
|
-
@browser.lis[5].id.should == "non_link_1"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "#each" do
|
26
|
-
it "should iterate through lis correctly" do
|
27
|
-
@browser.lis.each_with_index do |l, index|
|
28
|
-
l.name.should == @browser.li(:index, index+1).name
|
29
|
-
l.id.should == @browser.li(:index, index+1).id
|
30
|
-
l.value.should == @browser.li(:index, index+1).value
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
after :all do
|
36
|
-
@browser.close
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|