celerity 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/History.txt +33 -0
  2. data/README.txt +19 -9
  3. data/Rakefile +9 -3
  4. data/lib/celerity.rb +39 -39
  5. data/lib/celerity/browser.rb +538 -153
  6. data/lib/celerity/clickable_element.rb +48 -7
  7. data/lib/celerity/collections.rb +155 -131
  8. data/lib/celerity/container.rb +766 -385
  9. data/lib/celerity/default_viewer.rb +10 -0
  10. data/lib/celerity/disabled_element.rb +19 -2
  11. data/lib/celerity/element.rb +152 -83
  12. data/lib/celerity/element_collection.rb +106 -0
  13. data/lib/celerity/element_locator.rb +89 -66
  14. data/lib/celerity/elements/button.rb +23 -13
  15. data/lib/celerity/elements/file_field.rb +17 -5
  16. data/lib/celerity/elements/form.rb +21 -16
  17. data/lib/celerity/elements/frame.rb +75 -53
  18. data/lib/celerity/elements/image.rb +76 -63
  19. data/lib/celerity/elements/label.rb +4 -2
  20. data/lib/celerity/elements/link.rb +30 -18
  21. data/lib/celerity/elements/meta.rb +6 -0
  22. data/lib/celerity/{non_control_elements.rb → elements/non_control_elements.rb} +106 -76
  23. data/lib/celerity/elements/option.rb +16 -2
  24. data/lib/celerity/elements/radio_check.rb +55 -20
  25. data/lib/celerity/elements/select_list.rb +65 -29
  26. data/lib/celerity/elements/table.rb +141 -94
  27. data/lib/celerity/elements/table_cell.rb +13 -6
  28. data/lib/celerity/elements/{table_body.rb → table_elements.rb} +20 -8
  29. data/lib/celerity/elements/table_row.rb +23 -7
  30. data/lib/celerity/elements/text_field.rb +89 -33
  31. data/lib/celerity/exception.rb +77 -41
  32. data/lib/celerity/extra/method_generator.rb +42 -24
  33. data/lib/celerity/htmlunit.rb +49 -0
  34. data/lib/celerity/htmlunit/commons-collections-3.2.1.jar +0 -0
  35. data/lib/celerity/htmlunit/htmlunit-2.5-SNAPSHOT.jar +0 -0
  36. data/lib/celerity/htmlunit/htmlunit-core-js-2.5-SNAPSHOT.jar +0 -0
  37. data/lib/celerity/htmlunit/nekohtml-1.9.12-20090308.130127-11.jar +0 -0
  38. data/lib/celerity/htmlunit/serializer-2.7.1.jar +0 -0
  39. data/lib/celerity/htmlunit/xalan-2.7.1.jar +0 -0
  40. data/lib/celerity/htmlunit/xml-apis-1.3.04.jar +0 -0
  41. data/lib/celerity/identifier.rb +3 -2
  42. data/lib/celerity/input_element.rb +5 -5
  43. data/lib/celerity/listener.rb +135 -0
  44. data/lib/celerity/resources/no_viewer.png +0 -0
  45. data/lib/celerity/util.rb +88 -0
  46. data/lib/celerity/version.rb +4 -3
  47. data/lib/celerity/watir_compatibility.rb +35 -25
  48. data/tasks/jar.rake +57 -0
  49. metadata +35 -142
  50. data.tar.gz.sig +0 -0
  51. data/Manifest.txt +0 -150
  52. data/lib/celerity/element_collections.rb +0 -54
  53. data/lib/celerity/element_map.rb +0 -51
  54. data/lib/celerity/elements/table_footer.rb +0 -30
  55. data/lib/celerity/elements/table_header.rb +0 -30
  56. data/lib/celerity/htmlunit/commons-collections-3.2.jar +0 -0
  57. data/lib/celerity/htmlunit/download.sh +0 -23
  58. data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
  59. data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
  60. data/lib/celerity/htmlunit/nekohtml-1.9.8.jar +0 -0
  61. data/lib/celerity/htmlunit/xalan-2.7.0.jar +0 -0
  62. data/lib/celerity/htmlunit/xml-apis-1.0.b2.jar +0 -0
  63. data/spec/area_spec.rb +0 -97
  64. data/spec/areas_spec.rb +0 -40
  65. data/spec/browser_spec.rb +0 -266
  66. data/spec/button_spec.rb +0 -227
  67. data/spec/buttons_spec.rb +0 -39
  68. data/spec/checkbox_spec.rb +0 -302
  69. data/spec/checkboxes_spec.rb +0 -38
  70. data/spec/div_spec.rb +0 -207
  71. data/spec/divs_spec.rb +0 -39
  72. data/spec/element_spec.rb +0 -79
  73. data/spec/filefield_spec.rb +0 -123
  74. data/spec/filefields_spec.rb +0 -40
  75. data/spec/form_spec.rb +0 -59
  76. data/spec/forms_spec.rb +0 -41
  77. data/spec/frame_spec.rb +0 -121
  78. data/spec/frames_spec.rb +0 -71
  79. data/spec/hidden_spec.rb +0 -127
  80. data/spec/hiddens_spec.rb +0 -39
  81. data/spec/hn_spec.rb +0 -104
  82. data/spec/hns_spec.rb +0 -45
  83. data/spec/html/2000_spans.html +0 -2009
  84. data/spec/html/bug_duplicate_attributes.html +0 -14
  85. data/spec/html/bug_javascript_001.html +0 -11
  86. data/spec/html/form_js_bug.html +0 -11
  87. data/spec/html/forms_with_input_elements.html +0 -114
  88. data/spec/html/frame_1.html +0 -17
  89. data/spec/html/frame_2.html +0 -16
  90. data/spec/html/frames.html +0 -11
  91. data/spec/html/iframes.html +0 -12
  92. data/spec/html/images.html +0 -27
  93. data/spec/html/images/1.gif +0 -0
  94. data/spec/html/images/2.gif +0 -0
  95. data/spec/html/images/3.gif +0 -0
  96. data/spec/html/images/button.jpg +0 -0
  97. data/spec/html/images/circle.jpg +0 -0
  98. data/spec/html/images/map.gif +0 -0
  99. data/spec/html/images/map2.gif +0 -0
  100. data/spec/html/images/minus.gif +0 -0
  101. data/spec/html/images/originaltriangle.jpg +0 -0
  102. data/spec/html/images/plus.gif +0 -0
  103. data/spec/html/images/square.jpg +0 -0
  104. data/spec/html/images/triangle.jpg +0 -0
  105. data/spec/html/invalid_js.html +0 -11
  106. data/spec/html/latin1_text.html +0 -17
  107. data/spec/html/non_control_elements.html +0 -115
  108. data/spec/html/simple_ajax.html +0 -22
  109. data/spec/html/tables.html +0 -119
  110. data/spec/html/utf8_text.html +0 -15
  111. data/spec/htmlunit_spec.rb +0 -26
  112. data/spec/image_spec.rb +0 -220
  113. data/spec/images_spec.rb +0 -39
  114. data/spec/label_spec.rb +0 -79
  115. data/spec/labels_spec.rb +0 -40
  116. data/spec/li_spec.rb +0 -139
  117. data/spec/link_spec.rb +0 -189
  118. data/spec/links_spec.rb +0 -43
  119. data/spec/lis_spec.rb +0 -40
  120. data/spec/map_spec.rb +0 -102
  121. data/spec/maps_spec.rb +0 -40
  122. data/spec/meta_spec.rb +0 -8
  123. data/spec/ol_spec.rb +0 -87
  124. data/spec/ols_spec.rb +0 -40
  125. data/spec/option_spec.rb +0 -154
  126. data/spec/p_spec.rb +0 -171
  127. data/spec/pre_spec.rb +0 -135
  128. data/spec/pres_spec.rb +0 -40
  129. data/spec/ps_spec.rb +0 -40
  130. data/spec/radio_spec.rb +0 -299
  131. data/spec/radios_spec.rb +0 -42
  132. data/spec/select_list_spec.rb +0 -299
  133. data/spec/select_lists_spec.rb +0 -47
  134. data/spec/span_spec.rb +0 -184
  135. data/spec/spans_spec.rb +0 -64
  136. data/spec/spec.opts +0 -1
  137. data/spec/spec_helper.rb +0 -55
  138. data/spec/table_bodies_spec.rb +0 -57
  139. data/spec/table_body_spec.rb +0 -111
  140. data/spec/table_cell_spec.rb +0 -74
  141. data/spec/table_cells_spec.rb +0 -59
  142. data/spec/table_footer_spec.rb +0 -101
  143. data/spec/table_footers_spec.rb +0 -55
  144. data/spec/table_header_spec.rb +0 -101
  145. data/spec/table_headers_spec.rb +0 -55
  146. data/spec/table_row_spec.rb +0 -104
  147. data/spec/table_rows_spec.rb +0 -58
  148. data/spec/table_spec.rb +0 -160
  149. data/spec/tables_spec.rb +0 -42
  150. data/spec/text_field_spec.rb +0 -323
  151. data/spec/text_fields_spec.rb +0 -44
  152. data/spec/ul_spec.rb +0 -88
  153. data/spec/uls_spec.rb +0 -40
  154. data/spec/watir_compatibility_spec.rb +0 -260
  155. data/support/spec_server.rb +0 -73
  156. data/tasks/rspec.rake +0 -30
  157. data/tasks/specserver.rake +0 -21
  158. metadata.gz.sig +0 -0
@@ -1,40 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "FileFields" 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 correct number of file fields" do
15
- @browser.file_fields.length.should == 2
16
- end
17
- end
18
-
19
- describe "#[]" do
20
- it "should return the file field at the given index" do
21
- @browser.file_fields[1].id.should == "new_user_portrait"
22
- end
23
- end
24
-
25
- describe "#each" do
26
- it "should iterate through file fields correctly" do
27
- @browser.file_fields.each_with_index do |f, index|
28
- f.name.should == @browser.file_field(:index, index+1).name
29
- f.id.should == @browser.file_field(:index, index+1).id
30
- f.value.should == @browser.file_field(: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/form_spec.rb DELETED
@@ -1,59 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "Form" do
4
- before :all do
5
- @browser = Browser.new
6
- end
7
-
8
- before :each do
9
- @browser.goto(TEST_HOST + "/forms_with_input_elements.html")
10
- end
11
-
12
- describe "#exists" do
13
- it "should return true if the form exists" do
14
- @browser.form(:id, 'new_user').should exist
15
- @browser.form(:id, /new_user/).should exist
16
- @browser.form(:class, 'user').should exist
17
- @browser.form(:class, /user/).should exist
18
- @browser.form(:method, 'post').should exist
19
- @browser.form(:method, /post/).should exist
20
- @browser.form(:action, 'post_to_me').should exist
21
- @browser.form(:action, /to_me/).should exist
22
- @browser.form(:index, 1).should exist
23
- @browser.form(:xpath, "//form[@id='new_user']").should exist
24
- end
25
-
26
- it "should return true if the element exists (default how = :name)" do
27
- @browser.form("user_new").should exist
28
- end
29
-
30
- it "should return false if the form doesn't exist" do
31
- @browser.form(:id, 'no_such_id').should_not exist
32
- @browser.form(:id, /no_such_id/).should_not exist
33
- @browser.form(:class, 'no_such_class').should_not exist
34
- @browser.form(:class, /no_such_class/).should_not exist
35
- @browser.form(:method, 'no_such_method').should_not exist
36
- @browser.form(:method, /no_such_method/).should_not exist
37
- @browser.form(:action, 'no_such_action').should_not exist
38
- @browser.form(:action, /no_such_action/).should_not exist
39
- @browser.form(:index, 1337).should_not exist
40
- @browser.form(:xpath, "//form[@id='no_such_id']").should_not exist
41
- end
42
-
43
- it "should raise ArgumentError when 'what' argument is invalid" do
44
- lambda { @browser.form(:id, 3.14).exists? }.should raise_error(ArgumentError)
45
- end
46
-
47
- it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
48
- lambda { @browser.form(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
49
- end
50
- end
51
-
52
- describe "#submit" do
53
- it "should submit the form" do
54
- @browser.form(:id, "delete_user").submit
55
- @browser.text.should include("Semantic table")
56
- end
57
- end
58
-
59
- end
data/spec/forms_spec.rb DELETED
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "Forms" 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 forms in the container" do
15
- @browser.forms.length.should == 2
16
- end
17
- end
18
-
19
- describe "#[]n" do
20
- it "should provide access to the nth form" do
21
- @browser.forms[1].action.should == 'post_to_me'
22
- @browser.forms[1].attribute_value('method').should == 'post'
23
- end
24
- end
25
-
26
- describe "#each" do
27
- it "should iterate through forms correctly" do
28
- @browser.forms.each_with_index do |f, index|
29
- f.name.should == @browser.form(:index, index+1).name
30
- f.id.should == @browser.form(:index, index+1).id
31
- f.class_name.should == @browser.form(:index, index+1).class_name
32
- end
33
- end
34
- end
35
-
36
- after :all do
37
- @browser.close
38
- end
39
-
40
- end
41
-
data/spec/frame_spec.rb DELETED
@@ -1,121 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "Frame" do
4
- before :all do
5
- @browser = Browser.new
6
- end
7
-
8
- before :each do
9
- @browser.goto(TEST_HOST + "/frames.html")
10
- end
11
-
12
- it "should handle crossframe javascript" do
13
- @browser.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
14
- @browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
15
- @browser.frame(:id, "frame_1").button(:id, 'send').click
16
- @browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
17
- end
18
-
19
- # Exists
20
- describe "#exist?" do
21
- it "should return true if the frame exists" do
22
- @browser.frame(:id, "frame_1").should exist
23
- @browser.frame(:id, /frame/).should exist
24
- @browser.frame(:name, "frame1").should exist
25
- @browser.frame(:name, /frame/).should exist
26
- @browser.frame(:src, "frame_1.html").should exist
27
- @browser.frame(:src, /frame_1/).should exist
28
- @browser.frame(:class, "half").should exist
29
- @browser.frame(:class, /half/).should exist
30
- @browser.frame(:index, 1).should exist
31
- @browser.frame(:xpath, "//frame[@id='frame_1']").should exist
32
- end
33
-
34
- it "should return true if the iframe exists" do
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
- end
47
-
48
- it "should return true if the element exists (default how = :name)" do
49
- @browser.frame("frame1").should exist
50
- @browser.goto(TEST_HOST + "/iframes.html")
51
- @browser.frame("frame1").should exist
52
- end
53
-
54
- it "should return false if the frame doesn't exist" do
55
- @browser.frame(:id, "no_such_id").should_not exist
56
- @browser.frame(:id, /no_such_id/).should_not exist
57
- @browser.frame(:name, "no_such_text").should_not exist
58
- @browser.frame(:name, /no_such_text/).should_not exist
59
- @browser.frame(:src, "no_such_src").should_not exist
60
- @browser.frame(:src, /no_such_src/).should_not exist
61
- @browser.frame(:class, "no_such_class").should_not exist
62
- @browser.frame(:class, /no_such_class/).should_not exist
63
- @browser.frame(:index, 1337).should_not exist
64
- @browser.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
65
- end
66
-
67
- it "should raise ArgumentError when 'what' argument is invalid" do
68
- lambda { @browser.frame(:id, 3.14).exists? }.should raise_error(ArgumentError)
69
- end
70
-
71
- it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
72
- lambda { @browser.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
73
- end
74
- end
75
-
76
- it "should raise UnknownFrameException when accessing elements inside non-existing frame" do
77
- lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
78
- end
79
-
80
- it "should raise UnknownFrameException when accessing a non-existing frame" do
81
- lambda { @browser.frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
82
- end
83
-
84
- it "should raise UnknownFrameException when accessing a non-existing subframe" do
85
- lambda { @browser.frame(:name, "frame1").frame(:name, "no_such_name").p(:index, 1).id }.should raise_error(UnknownFrameException)
86
- end
87
-
88
- it "should raise UnknownObjectException when accessing a non-existing element inside an existing frame" do
89
- lambda { @browser.frame(:index, 1).p(:index, 1337).id }.should raise_error(UnknownObjectException)
90
- end
91
-
92
- it "should be able to send a value to another frame by using Javascript" do
93
- frame1, frame2 = @browser.frame(:index, 1), @browser.frame(:index, 2)
94
- frame1.text_field(:index, 1).value.should == "send_this_value"
95
- frame2.text_field(:index, 1).value.should == "old_value"
96
- frame1.button(:index, 1).click
97
- frame2.text_field(:index, 1).value.should == "send_this_value"
98
- end
99
-
100
- describe "#contains_text" do
101
- it "should find text in a frame" do
102
- @browser.frame(:name, 'frame1').contains_text('Suspendisse sit amet nisi.').should be_instance_of(Fixnum)
103
- end
104
-
105
- it "should raise ArgumentError when given an invalid argument" do
106
- lambda { @browser.frame(:name, 'frame1').contains_text(3.14) }.should raise_error(ArgumentError)
107
- end
108
- end
109
-
110
- describe "#to_s" do
111
- it "should return a human readable representation of the frame" do
112
- @browser.frame(:index, 1).to_s.should == "tag: frame\n" +
113
- " src: frame_1.html\n" +
114
- " id: frame_1\n" +
115
- " name: frame1\n" +
116
- " class: half"
117
- end
118
- end
119
-
120
- end
121
-
data/spec/frames_spec.rb DELETED
@@ -1,71 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "Frames" do
4
-
5
- before :all do
6
- @browser = Browser.new
7
- end
8
-
9
- describe "<frame> elements" do
10
-
11
- before :each do
12
- @browser.goto(TEST_HOST + "/frames.html")
13
- end
14
-
15
- describe "#length" do
16
- it "should return the correct number of frames" do
17
- @browser.frames.length.should == 2
18
- end
19
- end
20
-
21
- describe "#[]" do
22
- it "should return the frame at the given index" do
23
- @browser.frames[1].id.should == "frame_1"
24
- end
25
- end
26
-
27
- describe "#each" do
28
- it "should iterate through frames correctly" do
29
- @browser.frames.each_with_index do |f, index|
30
- f.name.should == @browser.frame(:index, index+1).name
31
- f.id.should == @browser.frame(:index, index+1).id
32
- f.value.should == @browser.frame(:index, index+1).value
33
- end
34
- end
35
- end
36
- end
37
-
38
- describe "<iframe> elements" do
39
-
40
- before :each do
41
- @browser.goto(TEST_HOST + "/iframes.html")
42
- end
43
-
44
- describe "#length" do
45
- it "should return the correct number of frames" do
46
- @browser.frames.length.should == 2
47
- end
48
- end
49
-
50
- describe "#[]" do
51
- it "should return the frame at the given index" do
52
- @browser.frames[1].id.should == "frame_1"
53
- end
54
- end
55
-
56
- describe "#each" do
57
- it "should iterate through frames correctly" do
58
- @browser.frames.each_with_index do |f, index|
59
- f.name.should == @browser.frame(:index, index+1).name
60
- f.id.should == @browser.frame(:index, index+1).id
61
- f.value.should == @browser.frame(:index, index+1).value
62
- end
63
- end
64
- end
65
- end
66
-
67
- after :all do
68
- @browser.close
69
- end
70
-
71
- end
data/spec/hidden_spec.rb DELETED
@@ -1,127 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- describe "Hidden" 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
- # Exist method
14
- describe "#exists?" do
15
- it "should return true if the element exists" do
16
- @browser.hidden(:id, 'new_user_interests_dolls').should exist
17
- @browser.hidden(:id, /new_user_interests_dolls/).should exist
18
- @browser.hidden(:name, 'new_user_interests').should exist
19
- @browser.hidden(:name, /new_user_interests/).should exist
20
- @browser.hidden(:value, 'dolls').should exist
21
- @browser.hidden(:value, /dolls/).should exist
22
- # TODO: figure out what :text means for Hidden
23
- # @browser.hidden(:text, 'dolls').should exist
24
- # @browser.hidden(:text, /dolls/).should exist
25
- @browser.hidden(:class, 'fun').should exist
26
- @browser.hidden(:class, /fun/).should exist
27
- @browser.hidden(:index, 1).should exist
28
- @browser.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
29
- end
30
-
31
- it "should return true if the element exists (default how = :name)" do
32
- @browser.hidden("new_user_interests").should exist
33
- end
34
-
35
- it "should return false if the element does not exist" do
36
- @browser.hidden(:id, 'no_such_id').should_not exist
37
- @browser.hidden(:id, /no_such_id/).should_not exist
38
- @browser.hidden(:name, 'no_such_name').should_not exist
39
- @browser.hidden(:name, /no_such_name/).should_not exist
40
- @browser.hidden(:value, 'no_such_value').should_not exist
41
- @browser.hidden(:value, /no_such_value/).should_not exist
42
- @browser.hidden(:text, 'no_such_text').should_not exist
43
- @browser.hidden(:text, /no_such_text/).should_not exist
44
- @browser.hidden(:class, 'no_such_class').should_not exist
45
- @browser.hidden(:class, /no_such_class/).should_not exist
46
- @browser.hidden(:index, 1337).should_not exist
47
- @browser.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
48
- end
49
-
50
- it "should raise ArgumentError when 'what' argument is invalid" do
51
- lambda { @browser.hidden(:id, 3.14).exists? }.should raise_error(ArgumentError)
52
- end
53
-
54
- it "should raise MissingWayOfFindingObjectException when 'how' argument is invalid" do
55
- lambda { @browser.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
56
- end
57
- end
58
-
59
-
60
- # Attribute methods
61
- describe "#id" do
62
- it "should return the id attribute if the text field exists" do
63
- @browser.hidden(:index, 1).id.should == "new_user_interests_dolls"
64
- end
65
-
66
- it "should raise UnknownObjectException if the text field doesn't exist" do
67
- lambda { @browser.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
68
- end
69
- end
70
-
71
- describe "#name" do
72
- it "should return the name attribute if the text field exists" do
73
- @browser.hidden(:index, 1).name.should == "new_user_interests"
74
- end
75
-
76
- it "should raise UnknownObjectException if the text field doesn't exist" do
77
- lambda { @browser.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
78
- end
79
- end
80
-
81
- describe "#type" do
82
- it "should return the type attribute if the text field exists" do
83
- @browser.hidden(:index, 1).type.should == "hidden"
84
- end
85
-
86
- it "should raise UnknownObjectException if the text field doesn't exist" do
87
- lambda { @browser.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
88
- end
89
- end
90
-
91
- describe "#value" do
92
- it "should return the value attribute if the text field exists" do
93
- @browser.hidden(:index, 1).value.should == "dolls"
94
- end
95
-
96
- it "should raise UnknownObjectException if the text field doesn't exist" do
97
- lambda { @browser.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
98
- end
99
- end
100
-
101
- describe "#respond_to?" do
102
- it "should return true for all attribute methods" do
103
- @browser.hidden(:index, 1).should respond_to(:id)
104
- @browser.hidden(:index, 1).should respond_to(:name)
105
- @browser.hidden(:index, 1).should respond_to(:type)
106
- @browser.hidden(:index, 1).should respond_to(:value)
107
- end
108
- end
109
-
110
-
111
- # Manipulation methods
112
- describe "#value=" do
113
- it "should set the value of the element" do
114
- @browser.hidden(:id, 'new_user_interests_dolls').value = 'guns'
115
- @browser.hidden(:id, "new_user_interests_dolls").value.should == 'guns'
116
- end
117
-
118
- it "should raise UnknownObjectException if the text field doesn't exist" do
119
- lambda { @browser.hidden(:id, 'no_such_id').value = 'guns' }.should raise_error(UnknownObjectException)
120
- end
121
- end
122
-
123
- after :all do
124
- @browser.close
125
- end
126
- end
127
-