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/filefields_spec.rb
CHANGED
@@ -3,38 +3,38 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "FileFields" 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
|
-
@
|
11
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#length" do
|
15
15
|
it "should return the correct number of file fields" do
|
16
|
-
@
|
16
|
+
@browser.file_fields.length.should == 2
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#[]" do
|
21
21
|
it "should return the file field at the given index" do
|
22
|
-
@
|
22
|
+
@browser.file_fields[1].id.should == "new_user_portrait"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "#each" do
|
27
27
|
it "should iterate through file fields correctly" do
|
28
|
-
@
|
29
|
-
f.name.should == @
|
30
|
-
f.id.should == @
|
31
|
-
f.value.should == @
|
28
|
+
@browser.file_fields.each_with_index do |f, index|
|
29
|
+
f.name.should == @browser.file_field(:index, index+1).name
|
30
|
+
f.id.should == @browser.file_field(:index, index+1).id
|
31
|
+
f.value.should == @browser.file_field(:index, index+1).value
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
after :all do
|
37
|
-
@
|
37
|
+
@browser.close
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|
data/spec/form_spec.rb
CHANGED
@@ -2,51 +2,51 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
3
3
|
describe "Form" 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 + "/forms_with_input_elements.html")
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "#exists" do
|
14
14
|
it "should return true if the form exists" do
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
15
|
+
@browser.form(:id, 'new_user').should exist
|
16
|
+
@browser.form(:id, /new_user/).should exist
|
17
|
+
@browser.form(:class, 'user').should exist
|
18
|
+
@browser.form(:class, /user/).should exist
|
19
|
+
@browser.form(:method, 'post').should exist
|
20
|
+
@browser.form(:method, /post/).should exist
|
21
|
+
@browser.form(:action, 'post_to_me').should exist
|
22
|
+
@browser.form(:action, /to_me/).should exist
|
23
|
+
@browser.form(:index, 1).should exist
|
24
|
+
@browser.form(:xpath, "//form[@id='new_user']").should exist
|
25
25
|
end
|
26
26
|
it "should return false if the form doesn't exist" do
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
27
|
+
@browser.form(:id, 'no_such_id').should_not exist
|
28
|
+
@browser.form(:id, /no_such_id/).should_not exist
|
29
|
+
@browser.form(:class, 'no_such_class').should_not exist
|
30
|
+
@browser.form(:class, /no_such_class/).should_not exist
|
31
|
+
@browser.form(:method, 'no_such_method').should_not exist
|
32
|
+
@browser.form(:method, /no_such_method/).should_not exist
|
33
|
+
@browser.form(:action, 'no_such_action').should_not exist
|
34
|
+
@browser.form(:action, /no_such_action/).should_not exist
|
35
|
+
@browser.form(:index, 1337).should_not exist
|
36
|
+
@browser.form(:xpath, "//form[@id='no_such_id']").should_not exist
|
37
37
|
end
|
38
|
-
it "should raise ArgumentError when what argument is invalid" do
|
39
|
-
lambda { @
|
38
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
39
|
+
lambda { @browser.form(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
40
40
|
end
|
41
|
-
it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
|
42
|
-
lambda { @
|
41
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
42
|
+
lambda { @browser.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "#submit" do
|
47
47
|
it "should submit the form" do
|
48
|
-
@
|
49
|
-
@
|
48
|
+
@browser.form(:id, "delete_user").submit
|
49
|
+
@browser.text.should include("Semantic table")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
data/spec/forms_spec.rb
CHANGED
@@ -3,39 +3,39 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "Forms" 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
|
-
@
|
11
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#length" do
|
15
15
|
it "should return the number of forms in the container" do
|
16
|
-
@
|
16
|
+
@browser.forms.length.should == 2
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
describe "#[]n" do
|
21
21
|
it "should provide access to the nth form" do
|
22
|
-
@
|
23
|
-
@
|
22
|
+
@browser.forms[1].action.should == 'post_to_me'
|
23
|
+
@browser.forms[1].attribute_value('method').should == 'post'
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "#each" do
|
28
28
|
it "should iterate through forms correctly" do
|
29
|
-
@
|
30
|
-
f.name.should == @
|
31
|
-
f.id.should == @
|
32
|
-
f.class_name.should == @
|
29
|
+
@browser.forms.each_with_index do |f, index|
|
30
|
+
f.name.should == @browser.form(:index, index+1).name
|
31
|
+
f.id.should == @browser.form(:index, index+1).id
|
32
|
+
f.class_name.should == @browser.form(:index, index+1).class_name
|
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
|
data/spec/frame_spec.rb
CHANGED
@@ -2,96 +2,101 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
|
3
3
|
describe "Frame" 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 + "/frames.html")
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should handle crossframe javascript" do
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
14
|
+
@browser.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
|
15
|
+
@browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
|
16
|
+
@browser.frame(:id, "frame_1").button(:id, 'send').click
|
17
|
+
@browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
|
18
18
|
end
|
19
19
|
|
20
20
|
# Exists
|
21
21
|
describe "#exist?" do
|
22
22
|
it "should return true if the frame exists" do
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
23
|
+
@browser.frame(:id, "frame_1").should exist
|
24
|
+
@browser.frame(:id, /frame/).should exist
|
25
|
+
@browser.frame(:name, "frame1").should exist
|
26
|
+
@browser.frame(:name, /frame/).should exist
|
27
|
+
@browser.frame(:src, "frame_1.html").should exist
|
28
|
+
@browser.frame(:src, /frame_1/).should exist
|
29
|
+
@browser.frame(:class, "half").should exist
|
30
|
+
@browser.frame(:class, /half/).should exist
|
31
|
+
@browser.frame(:index, 1).should exist
|
32
|
+
@browser.frame(:xpath, "//frame[@id='frame_1']").should exist
|
33
33
|
end
|
34
34
|
it "should return true if the iframe exists" do
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
35
|
+
@browser.goto(TEST_HOST + "/iframes.html")
|
36
|
+
@browser.frame(:id, "frame_1").should exist
|
37
|
+
@browser.frame(:id, /frame/).should exist
|
38
|
+
@browser.frame(:name, "frame1").should exist
|
39
|
+
@browser.frame(:name, /frame/).should exist
|
40
|
+
@browser.frame(:src, "frame_1.html").should exist
|
41
|
+
@browser.frame(:src, /frame_1/).should exist
|
42
|
+
@browser.frame(:class, "iframe").should exist
|
43
|
+
@browser.frame(:class, /iframe/).should exist
|
44
|
+
@browser.frame(:index, 1).should exist
|
45
|
+
@browser.frame(:xpath, "//iframe[@id='frame_1']").should exist
|
46
46
|
end
|
47
47
|
#TODO: default how = name
|
48
48
|
it "should return false if the frame doesn't exist" do
|
49
|
-
@
|
50
|
-
@
|
51
|
-
@
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@
|
55
|
-
@
|
56
|
-
@
|
57
|
-
@
|
58
|
-
@
|
49
|
+
@browser.frame(:id, "no_such_id").should_not exist
|
50
|
+
@browser.frame(:id, /no_such_id/).should_not exist
|
51
|
+
@browser.frame(:name, "no_such_text").should_not exist
|
52
|
+
@browser.frame(:name, /no_such_text/).should_not exist
|
53
|
+
@browser.frame(:src, "no_such_src").should_not exist
|
54
|
+
@browser.frame(:src, /no_such_src/).should_not exist
|
55
|
+
@browser.frame(:class, "no_such_class").should_not exist
|
56
|
+
@browser.frame(:class, /no_such_class/).should_not exist
|
57
|
+
@browser.frame(:index, 1337).should_not exist
|
58
|
+
@browser.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
|
59
59
|
end
|
60
|
-
it "should raise ArgumentError when what argument is invalid" do
|
61
|
-
lambda { @
|
60
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
61
|
+
lambda { @browser.frame(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
62
62
|
end
|
63
|
-
it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
|
64
|
-
lambda { @
|
63
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
64
|
+
lambda { @browser.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should raise UnknownFrameException when accessing elements inside non-existing frame" do
|
69
|
-
lambda { @
|
69
|
+
lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
|
70
70
|
end
|
71
71
|
it "should raise UnknownFrameException when accessing a non-existing frame" do
|
72
|
-
lambda { @
|
72
|
+
lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
|
73
73
|
end
|
74
74
|
it "should raise UnknownFrameException when accessing a non-existing subframe" do
|
75
|
-
lambda { @
|
75
|
+
lambda { @browser.frame(:name, "frame1").frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
|
76
76
|
end
|
77
77
|
it "should raise UnknownObjectException when accessing a non-existing element inside an existing frame" do
|
78
|
-
lambda { @
|
78
|
+
lambda { @browser.frame(:index, 1).p(:index, 1337).id }.should raise_error(UnknownObjectException)
|
79
79
|
end
|
80
80
|
it "should be able to send a value to another frame by using Javascript" do
|
81
|
+
frame1, frame2 = @browser.frame(:index, 1), @browser.frame(:index, 2)
|
82
|
+
frame1.text_field(:index, 1).value.should == "send_this_value"
|
83
|
+
frame2.text_field(:index, 1).value.should == "old_value"
|
84
|
+
frame1.button(:index, 1).click
|
85
|
+
frame2.text_field(:index, 1).value.should == "send_this_value"
|
81
86
|
end
|
82
87
|
|
83
88
|
describe "#contains_text" do
|
84
89
|
it "should find text in a frame" do
|
85
|
-
@
|
90
|
+
@browser.frame(:name, 'frame1').contains_text('Suspendisse sit amet nisi.').should be_instance_of(Fixnum)
|
86
91
|
end
|
87
92
|
it "should raise ArgumentError when given an invalid argument" do
|
88
|
-
lambda { @
|
93
|
+
lambda { @browser.frame(:name, 'frame1').contains_text(3.14) }.should raise_error(ArgumentError)
|
89
94
|
end
|
90
95
|
end
|
91
96
|
|
92
97
|
describe "#to_s" do
|
93
98
|
it "should return a human readable representation of the frame" do
|
94
|
-
@
|
99
|
+
@browser.frame(:index, 1).to_s.should == "tag: frame\n" +
|
95
100
|
" src: frame_1.html\n" +
|
96
101
|
" id: frame_1\n" +
|
97
102
|
" name: frame1\n" +
|
data/spec/hidden_spec.rb
CHANGED
@@ -5,50 +5,50 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
5
5
|
describe "Hidden" do
|
6
6
|
|
7
7
|
before :all do
|
8
|
-
@
|
9
|
-
add_spec_checker(@
|
8
|
+
@browser = IE.new
|
9
|
+
add_spec_checker(@browser)
|
10
10
|
end
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
@
|
13
|
+
@browser.goto(TEST_HOST + "/forms_with_input_elements.html")
|
14
14
|
end
|
15
15
|
|
16
16
|
# Exist method
|
17
17
|
describe "#exists?" do
|
18
18
|
it "should return true if the element exists" do
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
#
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
19
|
+
@browser.hidden(:id, 'new_user_interests_dolls').should exist
|
20
|
+
@browser.hidden(:id, /new_user_interests_dolls/).should exist
|
21
|
+
@browser.hidden(:name, 'new_user_interests').should exist
|
22
|
+
@browser.hidden(:name, /new_user_interests/).should exist
|
23
|
+
@browser.hidden(:value, 'dolls').should exist
|
24
|
+
@browser.hidden(:value, /dolls/).should exist
|
25
|
+
# TODO: figure out what :text means for Hidden
|
26
|
+
# @browser.hidden(:text, 'dolls').should exist
|
27
|
+
# @browser.hidden(:text, /dolls/).should exist
|
28
|
+
@browser.hidden(:class, 'fun').should exist
|
29
|
+
@browser.hidden(:class, /fun/).should exist
|
30
|
+
@browser.hidden(:index, 1).should exist
|
31
|
+
@browser.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
|
32
32
|
end
|
33
33
|
it "should return false if the element does not exist" do
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
34
|
+
@browser.hidden(:id, 'no_such_id').should_not exist
|
35
|
+
@browser.hidden(:id, /no_such_id/).should_not exist
|
36
|
+
@browser.hidden(:name, 'no_such_name').should_not exist
|
37
|
+
@browser.hidden(:name, /no_such_name/).should_not exist
|
38
|
+
@browser.hidden(:value, 'no_such_value').should_not exist
|
39
|
+
@browser.hidden(:value, /no_such_value/).should_not exist
|
40
|
+
@browser.hidden(:text, 'no_such_text').should_not exist
|
41
|
+
@browser.hidden(:text, /no_such_text/).should_not exist
|
42
|
+
@browser.hidden(:class, 'no_such_class').should_not exist
|
43
|
+
@browser.hidden(:class, /no_such_class/).should_not exist
|
44
|
+
@browser.hidden(:index, 1337).should_not exist
|
45
|
+
@browser.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
|
46
46
|
end
|
47
|
-
it "should raise ArgumentError when what argument is invalid" do
|
48
|
-
lambda { @
|
47
|
+
it "should raise ArgumentError when 'what' argument is invalid" do
|
48
|
+
lambda { @browser.hidden(:id, 3.14).exists? }.should raise_error(ArgumentError)
|
49
49
|
end
|
50
|
-
it "should raise MissingWayOfFindingObjectException when how argument is invalid" do
|
51
|
-
lambda { @
|
50
|
+
it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
51
|
+
lambda { @browser.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -56,50 +56,50 @@ describe "Hidden" do
|
|
56
56
|
# Attribute methods
|
57
57
|
describe "#id" do
|
58
58
|
it "should return the id attribute if the text field exists" do
|
59
|
-
@
|
59
|
+
@browser.hidden(:index, 1).id.should == "new_user_interests_dolls"
|
60
60
|
end
|
61
61
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
62
|
-
lambda { @
|
62
|
+
lambda { @browser.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "#name" do
|
67
67
|
it "should return the name attribute if the text field exists" do
|
68
|
-
@
|
68
|
+
@browser.hidden(:index, 1).name.should == "new_user_interests"
|
69
69
|
end
|
70
70
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
71
|
-
lambda { @
|
71
|
+
lambda { @browser.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "#type" do
|
76
76
|
it "should return the type attribute if the text field exists" do
|
77
|
-
@
|
77
|
+
@browser.hidden(:index, 1).type.should == "hidden"
|
78
78
|
end
|
79
79
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
80
|
-
lambda { @
|
80
|
+
lambda { @browser.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
describe "#value" do
|
85
85
|
it "should return the value attribute if the text field exists" do
|
86
|
-
@
|
86
|
+
@browser.hidden(:index, 1).value.should == "dolls"
|
87
87
|
end
|
88
88
|
it "should raise UnknownObjectException if the text field doesn't exist" do
|
89
|
-
lambda { @
|
89
|
+
lambda { @browser.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
# Manipulation methods
|
94
94
|
describe "#value=" do
|
95
95
|
it "should set the value of the element" do
|
96
|
-
@
|
97
|
-
@
|
96
|
+
@browser.hidden(:id, 'new_user_interests_dolls').value = 'guns'
|
97
|
+
@browser.hidden(:id, "new_user_interests_dolls").value.should == 'guns'
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
after :all do
|
102
|
-
@
|
102
|
+
@browser.close
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|