page-object 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +22 -12
  3. data/ChangeLog +10 -0
  4. data/Gemfile +4 -2
  5. data/Guardfile +1 -1
  6. data/README.md +2 -2
  7. data/lib/page-object/accessors.rb +57 -35
  8. data/lib/page-object/elements/element.rb +26 -0
  9. data/lib/page-object/locator_generator.rb +46 -0
  10. data/lib/page-object/platforms/selenium_webdriver/element.rb +6 -6
  11. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +14 -0
  12. data/lib/page-object/platforms/watir_webdriver/element.rb +0 -7
  13. data/lib/page-object/platforms/watir_webdriver/page_object.rb +16 -3
  14. data/lib/page-object/version.rb +1 -1
  15. data/page-object.gemspec +7 -10
  16. metadata +34 -375
  17. data/features/area.feature +0 -35
  18. data/features/async.feature +0 -21
  19. data/features/audio.feature +0 -64
  20. data/features/bold.feature +0 -21
  21. data/features/button.feature +0 -98
  22. data/features/canvas.feature +0 -37
  23. data/features/check_box.feature +0 -55
  24. data/features/div.feature +0 -45
  25. data/features/element.feature +0 -343
  26. data/features/file_field.feature +0 -40
  27. data/features/form.feature +0 -43
  28. data/features/frames.feature +0 -75
  29. data/features/generic_elements.feature +0 -29
  30. data/features/gxt_table_extension.feature +0 -23
  31. data/features/headings.feature +0 -97
  32. data/features/hidden_field.feature +0 -45
  33. data/features/html/04-Death_Becomes_Fur.mp4 +0 -0
  34. data/features/html/04-Death_Becomes_Fur.oga +0 -0
  35. data/features/html/async.html +0 -36
  36. data/features/html/double_click.html +0 -13
  37. data/features/html/failure.html +0 -8
  38. data/features/html/frame_1.html +0 -18
  39. data/features/html/frame_2.html +0 -16
  40. data/features/html/frame_3.html +0 -14
  41. data/features/html/frames.html +0 -12
  42. data/features/html/hover.html +0 -12
  43. data/features/html/iframes.html +0 -12
  44. data/features/html/images/circle.png +0 -0
  45. data/features/html/images/img_pulpit.jpg +0 -0
  46. data/features/html/images/submit.gif +0 -0
  47. data/features/html/indexed_property.html +0 -55
  48. data/features/html/modal.html +0 -17
  49. data/features/html/modal_1.html +0 -38
  50. data/features/html/modal_2.html +0 -27
  51. data/features/html/movie.mp4 +0 -0
  52. data/features/html/movie.ogg +0 -0
  53. data/features/html/multi_elements.html +0 -145
  54. data/features/html/nested_elements.html +0 -77
  55. data/features/html/nested_frame_1.html +0 -1
  56. data/features/html/nested_frame_2.html +0 -11
  57. data/features/html/nested_frame_3.html +0 -14
  58. data/features/html/nested_frames.html +0 -10
  59. data/features/html/planets.gif +0 -0
  60. data/features/html/static_elements.html +0 -194
  61. data/features/html/success.html +0 -8
  62. data/features/html/sun.gif +0 -0
  63. data/features/html/sun.html +0 -7
  64. data/features/html/widgets.html +0 -20
  65. data/features/image.feature +0 -50
  66. data/features/indexed_property.feature +0 -117
  67. data/features/italic.feature +0 -21
  68. data/features/javascript.feature +0 -28
  69. data/features/label.feature +0 -46
  70. data/features/link.feature +0 -52
  71. data/features/list_item.feature +0 -36
  72. data/features/modal_dialog.feature +0 -15
  73. data/features/multi_elements.feature +0 -498
  74. data/features/nested_elements.feature +0 -117
  75. data/features/ordered_list.feature +0 -56
  76. data/features/page_level_actions.feature +0 -90
  77. data/features/paragraph.feature +0 -35
  78. data/features/radio_button.feature +0 -58
  79. data/features/radio_button_group.feature +0 -29
  80. data/features/sample-app/public/audio_video.html +0 -23
  81. data/features/sample-app/public/jquery-1.3.2.js +0 -4376
  82. data/features/sample-app/public/jquery.html +0 -30
  83. data/features/sample-app/public/prototype-1.6.0.3.js +0 -4320
  84. data/features/sample-app/public/prototype.html +0 -35
  85. data/features/sample-app/sample_app.rb +0 -35
  86. data/features/section.feature +0 -136
  87. data/features/select_list.feature +0 -86
  88. data/features/span.feature +0 -37
  89. data/features/step_definitions/accessor_steps.rb +0 -64
  90. data/features/step_definitions/area_steps.rb +0 -19
  91. data/features/step_definitions/async_steps.rb +0 -83
  92. data/features/step_definitions/audio_steps.rb +0 -27
  93. data/features/step_definitions/bold_steps.rb +0 -12
  94. data/features/step_definitions/button_steps.rb +0 -48
  95. data/features/step_definitions/canvas_steps.rb +0 -15
  96. data/features/step_definitions/check_box_steps.rb +0 -35
  97. data/features/step_definitions/div_steps.rb +0 -19
  98. data/features/step_definitions/element_steps.rb +0 -294
  99. data/features/step_definitions/file_field_steps.rb +0 -19
  100. data/features/step_definitions/form_steps.rb +0 -19
  101. data/features/step_definitions/frames_steps.rb +0 -159
  102. data/features/step_definitions/generic_element_steps.rb +0 -31
  103. data/features/step_definitions/gxt_table_steps.rb +0 -53
  104. data/features/step_definitions/headings_steps.rb +0 -12
  105. data/features/step_definitions/hidden_field_steps.rb +0 -27
  106. data/features/step_definitions/image_steps.rb +0 -27
  107. data/features/step_definitions/indexed_property_steps.rb +0 -163
  108. data/features/step_definitions/italic_steps.rb +0 -12
  109. data/features/step_definitions/javascript_steps.rb +0 -53
  110. data/features/step_definitions/label_steps.rb +0 -19
  111. data/features/step_definitions/link_steps.rb +0 -40
  112. data/features/step_definitions/list_item_steps.rb +0 -19
  113. data/features/step_definitions/modal_dialog_steps.rb +0 -62
  114. data/features/step_definitions/multi_elements_steps.rb +0 -554
  115. data/features/step_definitions/nested_elements_steps.rb +0 -212
  116. data/features/step_definitions/ordered_list_steps.rb +0 -23
  117. data/features/step_definitions/page_level_actions_steps.rb +0 -135
  118. data/features/step_definitions/page_traversal_steps.rb +0 -8
  119. data/features/step_definitions/paragraph_steps.rb +0 -28
  120. data/features/step_definitions/radio_button_group_steps.rb +0 -36
  121. data/features/step_definitions/radio_button_steps.rb +0 -27
  122. data/features/step_definitions/section_steps.rb +0 -277
  123. data/features/step_definitions/select_list_steps.rb +0 -65
  124. data/features/step_definitions/span_steps.rb +0 -19
  125. data/features/step_definitions/table_cell_steps.rb +0 -15
  126. data/features/step_definitions/table_row_steps.rb +0 -23
  127. data/features/step_definitions/table_steps.rb +0 -70
  128. data/features/step_definitions/text_area_steps.rb +0 -35
  129. data/features/step_definitions/text_field_steps.rb +0 -35
  130. data/features/step_definitions/unordered_list_steps.rb +0 -23
  131. data/features/step_definitions/video_steps.rb +0 -45
  132. data/features/support/ajax_text_environment.rb +0 -26
  133. data/features/support/audio_video_page.rb +0 -24
  134. data/features/support/env.rb +0 -8
  135. data/features/support/hooks.rb +0 -8
  136. data/features/support/page.rb +0 -373
  137. data/features/support/persistent_browser.rb +0 -70
  138. data/features/support/targets/firefox14_osx.rb +0 -6
  139. data/features/support/targets/firefox14_windows7.rb +0 -6
  140. data/features/support/url_helper.rb +0 -61
  141. data/features/table.feature +0 -122
  142. data/features/table_cell.feature +0 -45
  143. data/features/table_row.feature +0 -43
  144. data/features/text_area.feature +0 -51
  145. data/features/text_field.feature +0 -70
  146. data/features/unordered_list.feature +0 -56
  147. data/features/video.feature +0 -69
  148. data/spec/page-object/accessors_spec.rb +0 -40
  149. data/spec/page-object/element_locators_spec.rb +0 -1144
  150. data/spec/page-object/elements/area_spec.rb +0 -45
  151. data/spec/page-object/elements/bold_spec.rb +0 -29
  152. data/spec/page-object/elements/button_spec.rb +0 -64
  153. data/spec/page-object/elements/canvas_spec.rb +0 -41
  154. data/spec/page-object/elements/check_box_spec.rb +0 -49
  155. data/spec/page-object/elements/div_spec.rb +0 -28
  156. data/spec/page-object/elements/element_spec.rb +0 -196
  157. data/spec/page-object/elements/file_field_spec.rb +0 -39
  158. data/spec/page-object/elements/form_spec.rb +0 -28
  159. data/spec/page-object/elements/heading_spec.rb +0 -48
  160. data/spec/page-object/elements/hidden_field_spec.rb +0 -28
  161. data/spec/page-object/elements/image_spec.rb +0 -66
  162. data/spec/page-object/elements/italic_spec.rb +0 -29
  163. data/spec/page-object/elements/label_spec.rb +0 -29
  164. data/spec/page-object/elements/link_spec.rb +0 -49
  165. data/spec/page-object/elements/list_item_spec.rb +0 -29
  166. data/spec/page-object/elements/media_spec.rb +0 -63
  167. data/spec/page-object/elements/nested_element_spec.rb +0 -254
  168. data/spec/page-object/elements/option_spec.rb +0 -11
  169. data/spec/page-object/elements/ordered_list_spec.rb +0 -78
  170. data/spec/page-object/elements/paragraph_spec.rb +0 -27
  171. data/spec/page-object/elements/select_list_spec.rb +0 -142
  172. data/spec/page-object/elements/selenium/radio_button_spec.rb +0 -44
  173. data/spec/page-object/elements/selenium/text_field_spec.rb +0 -49
  174. data/spec/page-object/elements/selenium_element_spec.rb +0 -218
  175. data/spec/page-object/elements/span_spec.rb +0 -26
  176. data/spec/page-object/elements/table_cell_spec.rb +0 -21
  177. data/spec/page-object/elements/table_row_spec.rb +0 -70
  178. data/spec/page-object/elements/table_spec.rb +0 -98
  179. data/spec/page-object/elements/text_area_spec.rb +0 -39
  180. data/spec/page-object/elements/unordered_list_spec.rb +0 -77
  181. data/spec/page-object/elements/video_spec.rb +0 -33
  182. data/spec/page-object/elements/watir_element_spec.rb +0 -193
  183. data/spec/page-object/javascript_framework_facade_spec.rb +0 -61
  184. data/spec/page-object/loads_platform_spec.rb +0 -53
  185. data/spec/page-object/page-object_spec.rb +0 -435
  186. data/spec/page-object/page_factory_spec.rb +0 -238
  187. data/spec/page-object/page_populator_spec.rb +0 -122
  188. data/spec/page-object/page_section_spec.rb +0 -80
  189. data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +0 -68
  190. data/spec/page-object/platforms/selenium_webdriver_spec.rb +0 -29
  191. data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +0 -29
  192. data/spec/page-object/platforms/watir_webdriver_spec.rb +0 -9
  193. data/spec/page-object/selenium_accessors_spec.rb +0 -628
  194. data/spec/page-object/watir_accessors_spec.rb +0 -1191
  195. data/spec/page-object/widget_spec.rb +0 -226
  196. data/spec/spec_helper.rb +0 -43
@@ -1,12 +0,0 @@
1
- When /^I get the italic text for the "([^\"]*)" element$/ do |el|
2
- @i = @page.send "#{el}_id"
3
- end
4
-
5
- Then /^I should see "([^\"]*)" in italic$/ do |text|
6
- @i.should == text
7
- end
8
-
9
- When /^I search italic text for the (\w+) by "([^"]*)"$/ do |text_decorator, type|
10
- @i = @page.send "#{text_decorator}_#{type}"
11
- end
12
-
@@ -1,53 +0,0 @@
1
- class JavascriptPage
2
- include PageObject
3
-
4
- text_field(:expression, :id => 'calculator-expression')
5
- text_field(:results, :id => 'calculator-result')
6
- button(:compute, :value => 'Compute')
7
-
8
- end
9
-
10
- def build_url(page)
11
- target = ENV['BROWSER']
12
- return "http://localhost:4567/#{page}" if target.nil? or target.include? 'local'
13
- "http://ec2-107-22-131-88.compute-1.amazonaws.com:4567/#{page}"
14
- end
15
-
16
- Given /^I am on jQuery example page$/ do
17
- PageObject.javascript_framework = :jquery
18
- @page = JavascriptPage.new(@browser)
19
- @page.navigate_to build_url("jquery.html")
20
- end
21
-
22
- Given /^I am on the Prototype example page$/ do
23
- PageObject.javascript_framework = :prototype
24
- @page = JavascriptPage.new(@browser)
25
- @page.navigate_to build_url('prototype.html')
26
- end
27
-
28
- When /^I ask to compute "([^\"]*)"$/ do |expression|
29
- @page.expression = expression
30
- @page.compute
31
- end
32
-
33
- Then /^I should be able to wait for the answer "([^\"]*)"$/ do |answer|
34
- @page.wait_for_ajax
35
- @page.results.should == answer
36
- end
37
-
38
- Given /^I execute the javascript "([^\"]*)"$/ do |script|
39
- @answer = @page.execute_script script
40
- end
41
-
42
- Given /^I execute the javascript "([^\"]*)" with an argument of "([^\"]*)"$/ do |script, arg|
43
- @answer = @page.execute_script script, arg
44
- end
45
-
46
- Given /^I execute the javascript "([^\"]*)" with a text field argument$/ do |script|
47
- text_field = @page.text_field_element(:id => 'text_field_id')
48
- @page.execute_script(script, text_field)
49
- end
50
-
51
- Then /^I should get the answer "([^\"]*)"$/ do |answer|
52
- @answer.should == answer.to_i
53
- end
@@ -1,19 +0,0 @@
1
- When /^I get the text from the label$/ do
2
- @text = @page.label_id
3
- end
4
-
5
- When /^I search for the label by "([^\"]*)"$/ do |how|
6
- @text = @page.send "label_#{how}".to_sym
7
- end
8
-
9
- When /^I search for the label by "(.*)" and "(.*)"$/ do |param1, param2|
10
- @text = @page.send "label_#{param1}_#{param2}".to_sym
11
- end
12
-
13
- When /^I get the text from a label while the script is executing$/ do
14
- @text = @page.label_element(:id => 'label_id').text
15
- end
16
-
17
- Then /^I should see that the label exists$/ do
18
- @page.label_id?.should be true
19
- end
@@ -1,40 +0,0 @@
1
- When /^I select the link labeled "([^\"]*)"$/ do |text|
2
- @page.google_search_id
3
- end
4
-
5
- When /^I search for the link by "([^\"]*)"$/ do |how|
6
- @how = how
7
- end
8
-
9
- Then /^I should be able to select the link$/ do
10
- @page.send "google_search_#{@how}".to_sym
11
- end
12
-
13
- When /^I select a link labeled "([^"]*)" and index "([^"]*)"$/ do |label, index|
14
- @page.send "#{label.downcase}#{index}".to_sym
15
- end
16
-
17
- When /^I select a link while the script is executing$/ do
18
- link = @page.link_element(:id => 'link_id')
19
- link.click
20
- end
21
-
22
- Then(/^I should see that the link exists$/) do
23
- @page.link_id?.should == true
24
- end
25
-
26
- When(/^I get the href for the link$/) do
27
- @href = @page.google_search_id_element.href
28
- end
29
-
30
- Then(/^I should know it was "(.*?)"$/) do |href|
31
- @href.should include href
32
- end
33
-
34
- When(/^I get the link using the href success$/) do
35
- @link = @page.link_element(:href => /succ.*html/)
36
- end
37
-
38
- Then(/^I should be able to click the link$/) do
39
- @link.click
40
- end
@@ -1,19 +0,0 @@
1
- When /^I get the text from the list item$/ do
2
- @text = @page.li_id
3
- end
4
-
5
- When /^I search for the list item by "([^\"]*)"$/ do |how|
6
- @text = @page.send "li_#{how}"
7
- end
8
-
9
- When /^I search for the list item by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
10
- @text = @page.send "li_#{param1}_#{param2}"
11
- end
12
-
13
- When /^I search for the list item while the script is executing$/ do
14
- @text = @page.list_item_element(:id => 'li_id').text
15
- end
16
-
17
- Then /^I should see that the list item exists$/ do
18
- @page.li_id?.should == true
19
- end
@@ -1,62 +0,0 @@
1
- class ModalPage
2
- include PageObject
3
-
4
- button(:launch_modal, :id => 'launch_modal_button')
5
- end
6
-
7
- class ModalDialog
8
- include PageObject
9
-
10
- button(:close_window, :id => 'close_window')
11
- button(:close_window_with_delay, :id => 'delayed_close')
12
- button(:launch_another_modal, :id => 'launch_modal_button')
13
- end
14
-
15
- class AnotherModalDialog
16
- include PageObject
17
-
18
- button(:close_window, :id => 'close_window2')
19
- button(:close_window_with_delay, :id => 'delayed_close2')
20
- end
21
-
22
-
23
- Given /^I am on the modal page$/ do
24
- ModalPage.new(@browser).navigate_to(UrlHelper.modal)
25
- end
26
-
27
- When /^I open a modal dialog$/ do
28
- page = ModalPage.new(@browser)
29
- page.modal_dialog do
30
- page.launch_modal
31
- end
32
- end
33
-
34
- Then /^I should be able to close the modal$/ do
35
- dialog = ModalDialog.new(@browser)
36
- dialog.attach_to_window(:title => 'Modal 1') do
37
- dialog.close_window
38
- end
39
- end
40
-
41
- When /^I open another modal dialog from that one$/ do
42
- dialog = ModalDialog.new(@browser)
43
- dialog.attach_to_window(:title => 'Modal 1') #do
44
- dialog.modal_dialog #do
45
- # dialog.launch_another_modal
46
- # end
47
- dialog.launch_another_modal
48
- # end
49
- end
50
-
51
- Then /^I should be able to close both modals$/ do
52
- pending
53
- # another = AnotherModalDialog.new(@browser)
54
- # another.attach_to_window(:title => 'Modal 2') do
55
- # another.close_window
56
- # end
57
-
58
- # dialog = ModalDialog.new(@browser)
59
- # dialog.attach_to_window(:title => 'Modal 1') do
60
- # dialog.close_window
61
- # end
62
- end
@@ -1,554 +0,0 @@
1
- class MultiElementsPage
2
- include PageObject
3
-
4
- divs(:the_divs, :class => 'div')
5
- divs(:block_divs) do |page|
6
- page.div_elements(:class => 'div')
7
- end
8
- buttons(:the_buttons, :class => 'button')
9
- text_fields(:the_text_fields, :class => 'textfield')
10
- hidden_fields(:the_hidden_fields, :class => 'hiddenfield')
11
- text_areas(:the_text_areas, :class => 'textarea')
12
- select_lists(:the_select_lists, :class => 'selectlist')
13
- links(:the_links, :class => 'link')
14
- checkboxes(:the_checkboxes, :class => 'checkbox')
15
- radio_buttons(:the_radio_buttons, :class => 'radio')
16
- spans(:the_spans, :class => 'span')
17
- tables(:the_tables, :class => 'table')
18
- cells(:the_cells, :class => 'td')
19
- images(:the_images, :class => 'image')
20
- forms(:the_forms, :class => 'form')
21
- list_items(:the_list_items, :class => 'li')
22
- unordered_lists(:the_unordered_lists, :class => 'ul')
23
- ordered_lists(:the_ordered_lists, :class => 'ol')
24
- h1s(:the_h1s, :class => 'h1')
25
- h2s(:the_h2s, :class => 'h2')
26
- h3s(:the_h3s, :class => 'h3')
27
- h4s(:the_h4s, :class => 'h4')
28
- h5s(:the_h5s, :class => 'h5')
29
- h6s(:the_h6s, :class => 'h6')
30
- paragraphs(:the_paragraphs, :class => 'p')
31
- labels(:the_labels, :class => 'label')
32
- file_fields(:the_file_fields, :class => 'file_field_class')
33
- elements(:generic_label, :label, :class => 'label')
34
- b(:bs)
35
- i(:is)
36
- end
37
-
38
-
39
- Given /^I am on the multi elements page$/ do
40
- @page = MultiElementsPage.new(@browser)
41
- @page.navigate_to(UrlHelper.multi)
42
- end
43
-
44
- When /^I select the buttons with class "([^\"]*)"$/ do |class_name|
45
- @elements = @page.button_elements(:class => class_name)
46
- end
47
-
48
- Then /^I should have (\d+) buttons$/ do |num_buttons|
49
- @elements.size.should == num_buttons.to_i
50
- end
51
-
52
- Then /^the value of button (\d+) should be "([^\"]*)"$/ do |button_num, value|
53
- @elements[button_num.to_i - 1].value.should == value
54
- end
55
-
56
- When /^I select the text fields with class "([^\"]*)"$/ do |class_name|
57
- @elements = @page.text_field_elements(:class => class_name)
58
- end
59
-
60
- Then /^I should have (\d+) text fields$/ do |num_text_fields|
61
- @elements.size.should == num_text_fields.to_i
62
- end
63
-
64
- Then /^the value of text field (\d+) should be "([^\"]*)"$/ do |text_field_num, value|
65
- @elements[text_field_num.to_i - 1].value.should == value
66
- end
67
-
68
- When /^I select the hidden fields with class "([^\"]*)"$/ do |class_name|
69
- @elements = @page.hidden_field_elements(:class => class_name)
70
- end
71
-
72
- Then /^I should have (\d+) hidden fields$/ do |num_hidden_fields|
73
- @elements.size.should == num_hidden_fields.to_i
74
- end
75
-
76
- Then /^the value of hidden field (\d+) should be "([^\"]*)"$/ do |hidden_field_num, value|
77
- @elements[hidden_field_num.to_i - 1].value.should == value
78
- end
79
-
80
- When /^I select the text areas with class "([^\"]*)"$/ do |class_name|
81
- @elements = @page.text_area_elements(:class => class_name)
82
- end
83
-
84
- Then /^I should have (\d+) text areas$/ do |num_text_areas|
85
- @elements.size.should == num_text_areas.to_i
86
- end
87
-
88
- Then /^the value of text area (\d+) should be "([^\"]*)"$/ do |text_area_num, value|
89
- @elements[text_area_num.to_i - 1].value.should == value
90
- end
91
-
92
- When /^I select the select lists with class "([^\"]*)"$/ do |class_name|
93
- @elements = @page.select_list_elements(:class => class_name)
94
- end
95
-
96
- Then /^I should have (\d+) select lists$/ do |num_select_lists|
97
- @elements.size.should == num_select_lists.to_i
98
- end
99
-
100
- Then /^the value of select list (\d+) should be "([^\"]*)"$/ do |select_list_num, value|
101
- @elements[select_list_num.to_i - 1].value.should == value
102
- end
103
-
104
- When /^I select the link with class "([^\"]*)"$/ do |link_class|
105
- @elements = @page.link_elements(:class => link_class)
106
- end
107
-
108
- Then /^I should have (\d+) links$/ do |num_links|
109
- @elements.size.should == num_links.to_i
110
- end
111
-
112
- Then /^the text of link (\d+) should be "([^\"]*)"$/ do |link_num, text|
113
- @elements[link_num.to_i - 1].text.should == text
114
- end
115
-
116
- When /^I select the check boxes with class "([^\"]*)"$/ do |class_name|
117
- @elements = @page.checkbox_elements(:class => class_name)
118
- end
119
-
120
- Then /^I should have (\d+) checkboxes$/ do |num_checkboxes|
121
- @elements.size.should == num_checkboxes.to_i
122
- end
123
-
124
- Then /^the value of checkbox (\d+) should be "([^\"]*)"$/ do |checkbox_num, value|
125
- @elements[checkbox_num.to_i - 1].value.should == value
126
- end
127
-
128
- When /^I select the radio button with class "([^\"]*)"$/ do |class_name|
129
- @elements = @page.radio_button_elements(:class => class_name)
130
- end
131
-
132
- Then /^I should have (\d+) radio buttons$/ do |num_radio_buttons|
133
- @elements.size.should == num_radio_buttons.to_i
134
- end
135
-
136
- Then /^the value of radio button (\d+) should be "([^\"]*)"$/ do |radio_button_num, value|
137
- @elements[radio_button_num.to_i - 1].value.should == value
138
- end
139
-
140
- When /^I select the div with class "([^\"]*)"$/ do |class_name|
141
- @elements = @page.div_elements(:class => class_name)
142
- end
143
-
144
- Then /^I should have (\d+) divs$/ do |num_divs|
145
- @elements.size.should == num_divs.to_i
146
- end
147
-
148
- Then /^the text of div (\d+) should be "([^\"]*)"$/ do |div_num, text|
149
- @elements[div_num.to_i - 1].text.should == text
150
- end
151
-
152
- When /^I select the spans with class "([^\"]*)"$/ do |class_name|
153
- @elements = @page.span_elements(:class => class_name)
154
- end
155
-
156
- Then /^I should have (\d+) spans$/ do |num_spans|
157
- @elements.size.should == num_spans.to_i
158
- end
159
-
160
- Then /^the text of span (\d+) should be "([^\"]*)"$/ do |span_num, text|
161
- @elements[span_num.to_i - 1].text.should == text
162
- end
163
-
164
- When /^I select the tables with class "([^\"]*)"$/ do |class_name|
165
- @elements = @page.table_elements(:class => class_name)
166
- end
167
-
168
- Then /^I should have (\d+) tables$/ do |num_tables|
169
- @elements.size.should == num_tables.to_i
170
- end
171
-
172
- Then /^the first row first column for table (\d+) should have "([^\"]*)"$/ do |table_num, text|
173
- @elements[table_num.to_i - 1][0][0].text.should == text
174
- end
175
-
176
- When /^I select the cells with class "([^\"]*)"$/ do |cell_class|
177
- @elements = @page.cell_elements(:class => cell_class)
178
- end
179
-
180
- Then /^I should have (\d+) cells$/ do |num_cells|
181
- @elements.size.should == num_cells.to_i
182
- end
183
-
184
- Then /^the text for cell (\d+) should be "([^\"]*)"$/ do |cell_num, text|
185
- @elements[cell_num.to_i - 1].text.should == text
186
- end
187
-
188
- When /^I select the images with class "([^\"]*)"$/ do |class_name|
189
- @elements = @page.image_elements(:class => class_name)
190
- end
191
-
192
- Then /^I should have (\d+) images$/ do |num_images|
193
- @elements.size.should == num_images.to_i
194
- end
195
-
196
- Then /^the alt for image (\d+) should be "([^\"]*)"$/ do |image_num, alt|
197
- @elements[image_num.to_i - 1].attribute(:alt).should == alt
198
- end
199
-
200
- When /^I select the forms with class "([^\"]*)"$/ do |class_name|
201
- @elements = @page.form_elements(:class => class_name)
202
- end
203
-
204
- Then /^I should have (\d+) forms$/ do |number|
205
- @elements.size.should == number.to_i
206
- end
207
-
208
- Then /^the action for form (\d+) should be "([^\"]*)"$/ do |form_number, action|
209
- @elements[form_number.to_i-1].attribute(:action).should match action
210
- end
211
-
212
- When /^I select the list items with class "([^\"]*)"$/ do |class_name|
213
- @elements = @page.list_item_elements(:class => class_name)
214
- end
215
-
216
- Then /^I should have (\d+) list items$/ do |num_list_items|
217
- @elements.size.should == num_list_items.to_i
218
- end
219
-
220
- Then /^the text for list item (\d+) should be "([^\"]*)"$/ do |list_item_num, text|
221
- @elements[list_item_num.to_i - 1].text.should == text
222
- end
223
-
224
- When /^I select the unordered list with class "([^\"]*)"$/ do |class_name|
225
- @elements = @page.unordered_list_elements(:class => class_name)
226
- end
227
-
228
- Then /^I should have (\d+) unordered lists$/ do |num_unordered_lists|
229
- @elements.size.should == num_unordered_lists.to_i
230
- end
231
-
232
- Then /^the text for the first item in unordered list (\d+) should be "([^\"]*)"$/ do |ul_num, text|
233
- @elements[ul_num.to_i - 1][0].text.should == text
234
- end
235
-
236
- When /^I select the ordered lists with class "([^\"]*)"$/ do |class_name|
237
- @elements = @page.ordered_list_elements(:class => class_name)
238
- end
239
-
240
- Then /^I should have (\d+) ordered lists$/ do |num_ol|
241
- @elements.size.should == num_ol.to_i
242
- end
243
-
244
- Then /^the text for the first item in ordered list (\d+) should be "([^\"]*)"$/ do |ol_num, text|
245
- @elements[ol_num.to_i - 1][0].text.should == text
246
- end
247
-
248
- When /^I select the h1s with class "([^\"]*)"$/ do |class_name|
249
- @elements = @page.h1_elements(:class => class_name)
250
- end
251
-
252
- Then /^I should have (\d+) h1s$/ do |num_h1s|
253
- @elements.size.should == num_h1s.to_i
254
- end
255
-
256
- Then /^the text for h1 (\d+) should be "([^\"]*)"$/ do |h1_num, text|
257
- @elements[h1_num.to_i - 1].text.should == text
258
- end
259
-
260
- When /^I select the h2s with the class "([^\"]*)"$/ do |class_name|
261
- @elements = @page.h2_elements(:class => class_name)
262
- end
263
-
264
- Then /^I should have (\d+) h2s$/ do |num_h2s|
265
- @elements.size.should == num_h2s.to_i
266
- end
267
-
268
- Then /^the text for h2 (\d+) should be "([^\"]*)"$/ do |h2_num, text|
269
- @elements[h2_num.to_i - 1].text.should == text
270
- end
271
-
272
- When /^I select the h3s with the class "([^\"]*)"$/ do |class_name|
273
- @elements = @page.h3_elements(:class => class_name)
274
- end
275
-
276
- Then /^I should have (\d+) h3s$/ do |num_h3s|
277
- @elements.size.should == num_h3s.to_i
278
- end
279
-
280
- Then /^the text for h3 (\d+) should be "([^\"]*)"$/ do |h3_num, text|
281
- @elements[h3_num.to_i - 1].text.should == text
282
- end
283
-
284
- When /^I select the h4s with the class "([^\"]*)"$/ do |class_name|
285
- @elements = @page.h4_elements(:class => class_name)
286
- end
287
-
288
- Then /^I should have (\d+) h4s$/ do |num_h4s|
289
- @elements.size.should == num_h4s.to_i
290
- end
291
-
292
- Then /^the text for H4 (\d+) should be "([^\"]*)"$/ do |h4_num, text|
293
- @elements[h4_num.to_i - 1].text.should == text
294
- end
295
-
296
- When /^I select the h5s with the class "([^\"]*)"$/ do |class_name|
297
- @elements = @page.h5_elements(:class => class_name)
298
- end
299
-
300
- Then /^I should have (\d+) h5s$/ do |num_h5s|
301
- @elements.size.should == num_h5s.to_i
302
- end
303
-
304
- Then /^the text for H5 (\d+) should be "([^\"]*)"$/ do |h5_num, text|
305
- @elements[h5_num.to_i - 1].text.should == text
306
- end
307
-
308
- When /^I select the h6s with the class "([^\"]*)"$/ do |class_name|
309
- @elements = @page.h6_elements(:class => class_name)
310
- end
311
-
312
- Then /^I should have (\d+) h6s$/ do |num_h6s|
313
- @elements.size.should == num_h6s.to_i
314
- end
315
-
316
- Then /^the text for H6 (\d+) should be "([^\"]*)"$/ do |h6_num, text|
317
- @elements[h6_num.to_i - 1].text.should == text
318
- end
319
-
320
- When /^I select the paragraph with class "([^\"]*)"$/ do |class_name|
321
- @elements = @page.paragraph_elements(:class => class_name)
322
- end
323
-
324
- Then /^I should have (\d+) paragraphs$/ do |num_paragraphs|
325
- @elements.size.should == num_paragraphs.to_i
326
- end
327
-
328
- Then /^the text for paragraph (\d+) should be "([^\"]*)"$/ do |para_num, text|
329
- @elements[para_num.to_i - 1].text.should == text
330
- end
331
-
332
- When /^I select all buttons using no identifier$/ do
333
- @elements = @page.button_elements
334
- end
335
-
336
- When /^I select all text fields using no identifier$/ do
337
- @elements = @page.text_field_elements
338
- end
339
-
340
- When /^I select all hidden fields using no identifier$/ do
341
- @elements = @page.hidden_field_elements
342
- end
343
-
344
- When /^I select text areas using no identifier$/ do
345
- @elements = @page.text_area_elements
346
- end
347
-
348
- When /^I select select lists using no identifier$/ do
349
- @elements = @page.select_list_elements
350
- end
351
-
352
- When /^I select links using no identifier$/ do
353
- @elements = @page.link_elements
354
- end
355
-
356
- When /^I select checboxes using no identifier$/ do
357
- @elements = @page.checkbox_elements
358
- end
359
-
360
- When /^I select radio buttons using no identifier$/ do
361
- @elements = @page.radio_button_elements
362
- end
363
-
364
- When /^I select divs using no identifier$/ do
365
- @elements = @page.div_elements
366
- end
367
-
368
- When /^I select spans using no identifier$/ do
369
- @elements = @page.span_elements
370
- end
371
-
372
- When /^I select tables using no identifier$/ do
373
- @elements = @page.table_elements
374
- end
375
-
376
- When /^I select the cells using no identifier$/ do
377
- @elements = @page.cell_elements
378
- end
379
-
380
- When /^I select the images using no identifier$/ do
381
- @elements = @page.image_elements
382
- end
383
-
384
- When /^I select the forms using no identifier$/ do
385
- @elements = @page.form_elements
386
- end
387
-
388
- When /^I select the list items using no identifier$/ do
389
- @elements = @page.list_item_elements
390
- end
391
-
392
- When /^I select the unordered list using no parameter$/ do
393
- @elements = @page.unordered_list_elements
394
- end
395
-
396
- When /^I select the ordered lists using no identifier$/ do
397
- @elements = @page.ordered_list_elements
398
- end
399
-
400
- When /^I select h(\d+)s using no identifier$/ do |num|
401
- @elements = @page.send "h#{num}_elements"
402
- end
403
-
404
- When /^I select paragraphs using no identifier$/ do
405
- @elements = @page.paragraph_elements
406
- end
407
-
408
- When /^I select the labels with class "([^\"]*)"$/ do |class_name|
409
- @elements = @page.label_elements(:class => class_name)
410
- end
411
-
412
- Then /^I should have (\d+) labels$/ do |num_labels|
413
- @elements.size.should == num_labels.to_i
414
- end
415
-
416
- Then /^the text for label (\d+) should be "([^\"]*)"$/ do |label_num, text|
417
- @elements[label_num.to_i - 1].text.should == text
418
- end
419
-
420
- When /^I select labels using no identifier$/ do
421
- @elements = @page.label_elements
422
- end
423
-
424
- When /^I select the file fields with class "([^\"]*)"$/ do |class_name|
425
- @elements = @page.file_field_elements(:class => class_name)
426
- end
427
-
428
- Then /^I should have (\d+) file fields$/ do |num_file_fields|
429
- @elements.size.should == num_file_fields.to_i
430
- end
431
-
432
- Then /^the title for file field (\d+) should be "([^\"]*)"$/ do |file_field_num, title|
433
- @elements[file_field_num.to_i - 1].attribute('title').should == title
434
- end
435
-
436
- When /^I select the file fields using no identifier$/ do
437
- @elements = @page.file_field_elements
438
- end
439
-
440
- When /^I select the divs using the generated method$/ do
441
- @elements = @page.the_divs_elements
442
- end
443
-
444
- When /^I select the buttons using the generated method$/ do
445
- @elements = @page.the_buttons_elements
446
- end
447
-
448
- When /^I select the text fields using the generated method$/ do
449
- @elements = @page.the_text_fields_elements
450
- end
451
-
452
- When /^I select the hidden fields using the generated method$/ do
453
- @elements = @page.the_hidden_fields_elements
454
- end
455
-
456
- When /^I select the text areas using the generated method$/ do
457
- @elements = @page.the_text_areas_elements
458
- end
459
-
460
- When /^I select the select lists using the generated method$/ do
461
- @elements = @page.the_select_lists_elements
462
- end
463
-
464
- When /^I select the link using the generated method$/ do
465
- @elements = @page.the_links_elements
466
- end
467
-
468
- When /^I select the check boxes using the generated method$/ do
469
- @elements = @page.the_checkboxes_elements
470
- end
471
-
472
- When /^I select the radio button using the generated method$/ do
473
- @elements = @page.the_radio_buttons_elements
474
- end
475
-
476
- When /^I select the spans using the generated method$/ do
477
- @elements = @page.the_spans_elements
478
- end
479
-
480
- When /^I select the tables using the generated method$/ do
481
- @elements = @page.the_tables_elements
482
- end
483
-
484
- When /^I select the cells using the generated method$/ do
485
- @elements = @page.the_cells_elements
486
- end
487
-
488
- When /^I select the images using the generated method$/ do
489
- @elements = @page.the_images_elements
490
- end
491
-
492
- When /^I select the forms using the generated method$/ do
493
- @elements = @page.the_forms_elements
494
- end
495
-
496
- When /^I select the list items using the generated method$/ do
497
- @elements = @page.the_list_items_elements
498
- end
499
-
500
- When /^I select the unordered list using the generated method$/ do
501
- @elements = @page.the_unordered_lists_elements
502
- end
503
-
504
- When /^I select the ordered lists using the generated method$/ do
505
- @elements = @page.the_ordered_lists_elements
506
- end
507
-
508
- When /^I select the h(\d+)s using the generated method$/ do |num|
509
- @elements = @page.send "the_h#{num.to_i}s_elements"
510
- end
511
-
512
- When /^I select the paragraph using the generated method$/ do
513
- @elements = @page.the_paragraphs_elements
514
- end
515
-
516
- When /^I select the labels using the generated method$/ do
517
- @elements = @page.the_labels_elements
518
- end
519
-
520
- When /^I select the file fields using the generated method$/ do
521
- @elements = @page.the_file_fields_elements
522
- end
523
-
524
- When /^I select the divs using a block$/ do
525
- @elements = @page.block_divs_elements
526
- end
527
-
528
- When(/^I select the multiple elements with a tag label$/) do
529
- @elements = @page.generic_label_elements
530
- end
531
-
532
- When /^I select the bs$/ do
533
- @elements = @page.b_elements
534
- end
535
-
536
- Then /^I should have (\d+) bs$/ do |num_bs|
537
- @elements.size.should == num_bs.to_i
538
- end
539
-
540
- Then /^the text for b (\d+) should be "([^\"]*)"$/ do |b_num, text|
541
- @elements[b_num.to_i - 1].text.should == text
542
- end
543
-
544
- When /^I select the is$/ do
545
- @elements = @page.i_elements
546
- end
547
-
548
- Then /^I should have (\d+) is$/ do |num_is|
549
- @elements.size.should == num_is.to_i
550
- end
551
-
552
- Then /^the text for i (\d+) should be "([^\"]*)"$/ do |i_num, text|
553
- @elements[i_num.to_i - 1].text.should == text
554
- end