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,56 +0,0 @@
1
- Feature: Unordered list
2
-
3
- Background:
4
- Given I am on the static elements page
5
-
6
- Scenario: Getting the first element from the unordered list
7
- When I get the first item from the unordered list
8
- Then the list items text should be "Item One"
9
-
10
- Scenario Outline: Locating unordered lists on the page
11
- When I search for the unordered list by "<search_by>"
12
- And I get the first item from the list
13
- Then the list items text should be "Item One"
14
- And the list should contain 3 items
15
- And each item should contain "Item"
16
-
17
- Scenarios:
18
- | search_by |
19
- | id |
20
- | class |
21
- | xpath |
22
- | index |
23
- | name |
24
-
25
- @selenium_only
26
- Scenario Outline: Locating unordered lists on the page
27
- When I search for the unordered list by "<search_by>"
28
- And I get the first item from the list
29
- Then the list items text should be "Item One"
30
- And the list should contain 3 items
31
- And each item should contain "Item"
32
-
33
- Scenarios:
34
- | search_by |
35
- | css |
36
-
37
- Scenario Outline: Locating unordered lists using multiple parameters
38
- When I search for the unordered list by "<param1>" and "<param2>"
39
- And I get the first item from the list
40
- Then the list items text should be "Item One"
41
-
42
- Scenarios:
43
- | param1 | param2 |
44
- | class | index |
45
- | name | index |
46
-
47
- Scenario: Finding a unordered list dynamically
48
- When I search for the unordered list while the script is executing
49
- Then I should see that the unordered list exists
50
- When I get the first item from the list
51
- Then the list items text should be "Item One"
52
-
53
- Scenario: Getting the text from an unordered list
54
- Then the text for the unordered list should contain "Item One"
55
- And the text for the unordered list should contain "Item Two"
56
- And the text for the unordered list should contain "Item Three"
@@ -1,69 +0,0 @@
1
- Feature: Support for video element
2
-
3
- Background:
4
- Given I am on the audio video page
5
-
6
- Scenario: finding an video element
7
- When I retrieve the video element
8
- Then I should know it exists
9
- And I should know it is visible
10
-
11
- Scenario Outline: Locating a video element on the page
12
- When I search for the video element by "<search_by>"
13
- Then I should know it is visible
14
-
15
- Examples:
16
- | search_by |
17
- | id |
18
- | class |
19
- | name |
20
- | xpath |
21
- | index |
22
- | css |
23
-
24
- Scenario Outline: Locating videos using multiple parameters
25
- When I search for the video element by "<param1>" and "<param2>"
26
- Then I should know it is visible
27
-
28
- Examples:
29
- | param1 | param2 |
30
- | class | index |
31
- | name | index |
32
-
33
- Scenario: Should know if it is autoplay
34
- When I retrieve the video element
35
- Then I should know the video is not autoplay
36
-
37
- Scenario: Should know if the controls are displayed
38
- When I retrieve the video element
39
- Then I should know that the controls are displayed
40
-
41
- Scenario: Should know if it is paused
42
- When I retrieve the video element
43
- Then I should know that the video is paused
44
-
45
- Scenario: Should know its volume
46
- When I retrieve the video element
47
- Then I should know that its volume is 1
48
-
49
- Scenario: Should know its height and width
50
- When I retrieve the video element
51
- Then I should know that its height is 240 pixels
52
- And I should knot what its width is 320 pixels
53
-
54
- Scenario: Should know if it has ended
55
- When I retrieve the video element
56
- Then I should know that it has not ended
57
-
58
- Scenario: Should know if it is seeking
59
- When I retrieve the video element
60
- Then I should know that it is not seeking
61
-
62
- Scenario: Should know if it is in a loop
63
- When I retrieve the video element
64
- Then I should know that it is not in a loop
65
-
66
- Scenario: Should know if it is muted
67
- When I retrieve the video element
68
- Then I should know that it is muted
69
-
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class GenericPage
4
- include PageObject
5
-
6
- wait_for_expected_title 'expected title'
7
- end
8
-
9
- describe 'accessors' do
10
- let(:browser) { mock_watir_browser }
11
- let(:page) { GenericPage.new browser }
12
-
13
- context '#wait_for_expected_title' do
14
- before(:each) do
15
- allow(browser).to receive(:wait_until).and_yield
16
- end
17
-
18
- it 'true if already there' do
19
- allow(browser).to receive(:title).and_return 'expected title'
20
- expect(page.wait_for_expected_title?).to be_truthy
21
- end
22
-
23
- it 'does not wait if it already is there' do
24
- allow(browser).to receive(:title).and_return 'expected title'
25
- expect(browser).to_not receive(:wait_until)
26
-
27
- expect(page.wait_for_expected_title?).to be_truthy
28
- end
29
-
30
- it 'errors when it does not match' do
31
- allow(browser).to receive(:title).and_return 'wrong title'
32
- expect { page.wait_for_expected_title? }.to raise_error "Expected title 'expected title' instead of 'wrong title'"
33
- end
34
-
35
- it 'picks up when the title changes' do
36
- allow(browser).to receive(:title).and_return 'wrong title', 'expected title'
37
- expect(page.wait_for_expected_title?).to be_truthy
38
- end
39
- end
40
- end
@@ -1,1144 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class ElementLocatorsTestPageObject
4
- include PageObject
5
- end
6
-
7
-
8
- describe PageObject::ElementLocators do
9
-
10
- context "when using Watir" do
11
- let(:watir_browser) { mock_watir_browser }
12
- let(:watir_page_object) { ElementLocatorsTestPageObject.new(watir_browser) }
13
-
14
- it "should find a button element" do
15
- expect(watir_browser).to receive(:button).with(:id => 'blah').and_return(watir_browser)
16
- element = watir_page_object.button_element(:id => 'blah')
17
- expect(element).to be_instance_of PageObject::Elements::Button
18
- end
19
-
20
- it "should find a button element using a default identifier" do
21
- expect(watir_browser).to receive(:button).with(:index => 0).and_return(watir_browser)
22
- watir_page_object.button_element
23
- end
24
-
25
- it "should find all button elements" do
26
- expect(watir_browser).to receive(:buttons).with(:id => 'blah').and_return([watir_browser])
27
- elements = watir_page_object.button_elements(:id => 'blah')
28
- expect(elements[0]).to be_instance_of PageObject::Elements::Button
29
- end
30
-
31
- it "should find all buttons with no identifier" do
32
- expect(watir_browser).to receive(:buttons).with({}).and_return([watir_browser])
33
- watir_page_object.button_elements
34
- end
35
-
36
- it "should find a text field element" do
37
- expect(watir_browser).to receive(:text_field).with(:id => 'blah').and_return(watir_browser)
38
- element = watir_page_object.text_field_element(:id => 'blah')
39
- expect(element).to be_instance_of PageObject::Elements::TextField
40
- end
41
-
42
- it "should find a text field element using a default identifier" do
43
- expect(watir_browser).to receive(:text_field).with(:index => 0).and_return(watir_browser)
44
- watir_page_object.text_field_element
45
- end
46
-
47
- it "should find all text field elements" do
48
- expect(watir_browser).to receive(:text_fields).with(:id => 'blah').and_return([watir_browser])
49
- expect(watir_browser).to receive(:tag_name).and_return('input')
50
- elements = watir_page_object.text_field_elements(:id => 'blah')
51
- expect(elements[0]).to be_instance_of PageObject::Elements::TextField
52
- end
53
-
54
- it "should find all text fields with no identifier" do
55
- expect(watir_browser).to receive(:text_fields).with({}).and_return([watir_browser])
56
- expect(watir_browser).to receive(:tag_name).and_return('input')
57
- watir_page_object.text_field_elements
58
- end
59
-
60
- it "should find a hidden field element" do
61
- expect(watir_browser).to receive(:hidden).with(:id => 'blah').and_return(watir_browser)
62
- element = watir_page_object.hidden_field_element(:id => 'blah')
63
- expect(element).to be_instance_of PageObject::Elements::HiddenField
64
- end
65
-
66
- it "should find a hidden field using a default identifier" do
67
- expect(watir_browser).to receive(:hidden).with(:index => 0).and_return(watir_browser)
68
- watir_page_object.hidden_field_element
69
- end
70
-
71
- it "should find all hidden field elements" do
72
- expect(watir_browser).to receive(:hiddens).with(:id => 'blah').and_return([watir_browser])
73
- elements = watir_page_object.hidden_field_elements(:id => 'blah')
74
- expect(elements[0]).to be_instance_of(PageObject::Elements::HiddenField)
75
- end
76
-
77
- it "should find all hidden field elements using no identifier" do
78
- expect(watir_browser).to receive(:hiddens).with({}).and_return([watir_browser])
79
- watir_page_object.hidden_field_elements
80
- end
81
-
82
- it "should find a text area element" do
83
- expect(watir_browser).to receive(:textarea).with(:id => 'blah').and_return(watir_browser)
84
- element = watir_page_object.text_area_element(:id => 'blah')
85
- expect(element).to be_instance_of PageObject::Elements::TextArea
86
- end
87
-
88
- it "should find a text area using a default identifier" do
89
- expect(watir_browser).to receive(:textarea).with(:index => 0).and_return(watir_browser)
90
- watir_page_object.text_area_element
91
- end
92
-
93
- it "should find all text area elements" do
94
- expect(watir_browser).to receive(:textareas).with(:id => 'blah').and_return([watir_browser])
95
- elements = watir_page_object.text_area_elements(:id => 'blah')
96
- expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
97
- end
98
-
99
- it "should find all text area elements using no identifier" do
100
- expect(watir_browser).to receive(:textareas).with({}).and_return([watir_browser])
101
- watir_page_object.text_area_elements
102
- end
103
-
104
- it "should find a select list element" do
105
- expect(watir_browser).to receive(:select_list).with(:id => 'blah').and_return(watir_browser)
106
- element = watir_page_object.select_list_element(:id => 'blah')
107
- expect(element).to be_instance_of PageObject::Elements::SelectList
108
- end
109
-
110
- it "should find a select list using a default identifier" do
111
- expect(watir_browser).to receive(:select_list).with(:index => 0).and_return(watir_browser)
112
- watir_page_object.select_list_element
113
- end
114
-
115
- it "should find all select list elements" do
116
- expect(watir_browser).to receive(:select_lists).with(:id => 'blah').and_return([watir_browser])
117
- elements = watir_page_object.select_list_elements(:id => 'blah')
118
- expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
119
- end
120
-
121
- it "should find all select list elements using no identifier" do
122
- expect(watir_browser).to receive(:select_lists).with({}).and_return([watir_browser])
123
- watir_page_object.select_list_elements
124
- end
125
-
126
- it "should find a link element" do
127
- expect(watir_browser).to receive(:link).with(:id => 'blah').and_return(watir_browser)
128
- element = watir_page_object.link_element(:id => 'blah')
129
- expect(element).to be_instance_of PageObject::Elements::Link
130
- end
131
-
132
- it "should find a link element using a default identifier" do
133
- expect(watir_browser).to receive(:link).with(:index => 0).and_return(watir_browser)
134
- watir_page_object.link_element
135
- end
136
-
137
- it "should find all link elements" do
138
- expect(watir_browser).to receive(:links).with(:id => 'blah').and_return([watir_browser])
139
- elements = watir_page_object.link_elements(:id => 'blah')
140
- expect(elements[0]).to be_instance_of PageObject::Elements::Link
141
- end
142
-
143
- it "should find all links using no identifier" do
144
- expect(watir_browser).to receive(:links).with({}).and_return([watir_browser])
145
- watir_page_object.link_elements
146
- end
147
-
148
- it "should find a check box" do
149
- expect(watir_browser).to receive(:checkbox).with(:id => 'blah').and_return(watir_browser)
150
- element = watir_page_object.checkbox_element(:id => 'blah')
151
- expect(element).to be_instance_of PageObject::Elements::CheckBox
152
- end
153
-
154
- it "should find a check box using a default identifier" do
155
- expect(watir_browser).to receive(:checkbox).with(:index => 0).and_return(watir_browser)
156
- watir_page_object.checkbox_element
157
- end
158
-
159
- it "should find all check box elements" do
160
- expect(watir_browser).to receive(:checkboxes).with(:id => 'blah').and_return([watir_browser])
161
- elements = watir_page_object.checkbox_elements(:id => 'blah')
162
- expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
163
- end
164
-
165
- it "should find all check box elements using no identifier" do
166
- expect(watir_browser).to receive(:checkboxes).with({}).and_return([watir_browser])
167
- watir_page_object.checkbox_elements
168
- end
169
-
170
- it "should find a radio button" do
171
- expect(watir_browser).to receive(:radio).with(:id => 'blah').and_return(watir_browser)
172
- element = watir_page_object.radio_button_element(:id => 'blah')
173
- expect(element).to be_instance_of PageObject::Elements::RadioButton
174
- end
175
-
176
- it "should find a radio button using a default identifier" do
177
- expect(watir_browser).to receive(:radio).with(:index => 0).and_return(watir_browser)
178
- watir_page_object.radio_button_element
179
- end
180
-
181
- it "should find all radio buttons" do
182
- expect(watir_browser).to receive(:radios).with(:id => 'blah').and_return([watir_browser])
183
- elements = watir_page_object.radio_button_elements(:id => 'blah')
184
- expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
185
- end
186
-
187
- it "should find all radio buttons using no identifier" do
188
- expect(watir_browser).to receive(:radios).with({}).and_return([watir_browser])
189
- watir_page_object.radio_button_elements
190
- end
191
-
192
- it "should find a div" do
193
- expect(watir_browser).to receive(:div).with(:id => 'blah').and_return(watir_browser)
194
- element = watir_page_object.div_element(:id => 'blah')
195
- expect(element).to be_instance_of PageObject::Elements::Div
196
- end
197
-
198
- it "should find a div using a default identifier" do
199
- expect(watir_browser).to receive(:div).with(:index => 0).and_return(watir_browser)
200
- watir_page_object.div_element
201
- end
202
-
203
- it "should find all div elements" do
204
- expect(watir_browser).to receive(:divs).with(:id => 'blah').and_return([watir_browser])
205
- elements = watir_page_object.div_elements(:id => 'blah')
206
- expect(elements[0]).to be_instance_of PageObject::Elements::Div
207
- end
208
-
209
- it "should find all div elements using no identifier" do
210
- expect(watir_browser).to receive(:divs).with({}).and_return([watir_browser])
211
- watir_page_object.div_elements
212
- end
213
-
214
- it "should find a span" do
215
- expect(watir_browser).to receive(:span).with(:id => 'blah').and_return(watir_browser)
216
- element = watir_page_object.span_element(:id => 'blah')
217
- expect(element).to be_instance_of PageObject::Elements::Span
218
- end
219
-
220
- it "should find a span using a default identifier" do
221
- expect(watir_browser).to receive(:span).with(:index => 0).and_return(watir_browser)
222
- watir_page_object.span_element
223
- end
224
-
225
- it "should find all span elements" do
226
- expect(watir_browser).to receive(:spans).with(:id => 'blah').and_return([watir_browser])
227
- elements = watir_page_object.span_elements(:id => 'blah')
228
- expect(elements[0]).to be_instance_of PageObject::Elements::Span
229
- end
230
-
231
- it "should find all span elements using no identifier" do
232
- expect(watir_browser).to receive(:spans).with({}).and_return([watir_browser])
233
- watir_page_object.span_elements
234
- end
235
-
236
- it "should find a table" do
237
- expect(watir_browser).to receive(:table).with(:id => 'blah').and_return(watir_browser)
238
- element = watir_page_object.table_element(:id => 'blah')
239
- expect(element).to be_instance_of PageObject::Elements::Table
240
- end
241
-
242
- it "should find a table using a default identifier" do
243
- expect(watir_browser).to receive(:table).with(:index => 0).and_return(watir_browser)
244
- watir_page_object.table_element
245
- end
246
-
247
- it "should find all table elements" do
248
- expect(watir_browser).to receive(:tables).with(:id => 'blah').and_return([watir_browser])
249
- elements = watir_page_object.table_elements(:id => 'blah')
250
- expect(elements[0]).to be_instance_of PageObject::Elements::Table
251
- end
252
-
253
- it "should find all table elements using no identifier" do
254
- expect(watir_browser).to receive(:tables).with({}).and_return([watir_browser])
255
- watir_page_object.table_elements
256
- end
257
-
258
- it "should find a table cell" do
259
- expect(watir_browser).to receive(:td).with(:id => 'blah').and_return(watir_browser)
260
- element = watir_page_object.cell_element(:id => 'blah')
261
- expect(element).to be_instance_of PageObject::Elements::TableCell
262
- end
263
-
264
- it "should find a table cell using a default identifier" do
265
- expect(watir_browser).to receive(:td).with(:index => 0).and_return(watir_browser)
266
- watir_page_object.cell_element
267
- end
268
-
269
- it "should find all table cells" do
270
- expect(watir_browser).to receive(:tds).with(:id => 'blah').and_return([watir_browser])
271
- elements = watir_page_object.cell_elements(:id => 'blah')
272
- expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
273
- end
274
-
275
- it "should find all table cells using no identifier" do
276
- expect(watir_browser).to receive(:tds).with({}).and_return([watir_browser])
277
- watir_page_object.cell_elements
278
- end
279
-
280
- it "should find a table row" do
281
- expect(watir_browser).to receive(:tr).with(:id => 'blah').and_return(watir_browser)
282
- element = watir_page_object.row_element(:id => 'blah')
283
- expect(element).to be_instance_of PageObject::Elements::TableRow
284
- end
285
-
286
- it "should find a table row using a default identifier" do
287
- expect(watir_browser).to receive(:tr).with(:index => 0).and_return(watir_browser)
288
- watir_page_object.row_element
289
- end
290
-
291
- it "should find all table row" do
292
- expect(watir_browser).to receive(:trs).with(:id => 'blah').and_return([watir_browser])
293
- elements = watir_page_object.row_elements(:id => 'blah')
294
- expect(elements[0]).to be_instance_of PageObject::Elements::TableRow
295
- end
296
-
297
- it "should find all table rows using no identifier" do
298
- expect(watir_browser).to receive(:trs).with({}).and_return([watir_browser])
299
- watir_page_object.row_elements
300
- end
301
-
302
- it "should find an image" do
303
- expect(watir_browser).to receive(:image).with(:id => 'blah').and_return(watir_browser)
304
- element = watir_page_object.image_element(:id => 'blah')
305
- expect(element).to be_instance_of PageObject::Elements::Image
306
- end
307
-
308
- it "should find an image using a default identifier" do
309
- expect(watir_browser).to receive(:image).with(:index => 0).and_return(watir_browser)
310
- watir_page_object.image_element
311
- end
312
-
313
- it "should find all images" do
314
- expect(watir_browser).to receive(:images).with(:id => 'blah').and_return([watir_browser])
315
- elements = watir_page_object.image_elements(:id => 'blah')
316
- expect(elements[0]).to be_instance_of PageObject::Elements::Image
317
- end
318
-
319
- it "should find all images using no identifier" do
320
- expect(watir_browser).to receive(:images).with({}).and_return([watir_browser])
321
- watir_page_object.image_elements
322
- end
323
-
324
- it "should find a form" do
325
- expect(watir_browser).to receive(:form).with(:id => 'blah').and_return(watir_browser)
326
- element = watir_page_object.form_element(:id => 'blah')
327
- expect(element).to be_instance_of PageObject::Elements::Form
328
- end
329
-
330
- it "should find a form using a default identifier" do
331
- expect(watir_browser).to receive(:form).with(:index => 0).and_return(watir_browser)
332
- watir_page_object.form_element
333
- end
334
-
335
- it "should find all forms" do
336
- expect(watir_browser).to receive(:forms).with(:id => 'blah').and_return([watir_browser])
337
- elements = watir_page_object.form_elements(:id => 'blah')
338
- expect(elements[0]).to be_instance_of PageObject::Elements::Form
339
- end
340
-
341
- it "should find all forms using no identifier" do
342
- expect(watir_browser).to receive(:forms).with({}).and_return([watir_browser])
343
- watir_page_object.form_elements
344
- end
345
-
346
- it "should find a list item" do
347
- expect(watir_browser).to receive(:li).with(:id => 'blah').and_return(watir_browser)
348
- element = watir_page_object.list_item_element(:id => 'blah')
349
- expect(element).to be_instance_of PageObject::Elements::ListItem
350
- end
351
-
352
- it "should find a list item using a default identifier" do
353
- expect(watir_browser).to receive(:li).with(:index => 0).and_return(watir_browser)
354
- watir_page_object.list_item_element
355
- end
356
-
357
- it "should find all list items" do
358
- expect(watir_browser).to receive(:lis).with(:id => 'blah').and_return([watir_browser])
359
- elements = watir_page_object.list_item_elements(:id => 'blah')
360
- expect(elements[0]).to be_instance_of PageObject::Elements::ListItem
361
- end
362
-
363
- it "should find all list items using no parameter" do
364
- expect(watir_browser).to receive(:lis).with({}).and_return([watir_browser])
365
- watir_page_object.list_item_elements
366
- end
367
-
368
- it "should find an unordered list" do
369
- expect(watir_browser).to receive(:ul).with(:id => 'blah').and_return(watir_browser)
370
- element = watir_page_object.unordered_list_element(:id => 'blah')
371
- expect(element).to be_instance_of PageObject::Elements::UnorderedList
372
- end
373
-
374
- it "should find an unordered list using a default identifier" do
375
- expect(watir_browser).to receive(:ul).with(:index => 0).and_return(watir_browser)
376
- watir_page_object.unordered_list_element
377
- end
378
-
379
- it "should find all unordered lists" do
380
- expect(watir_browser).to receive(:uls).with(:id => 'blah').and_return([watir_browser])
381
- elements = watir_page_object.unordered_list_elements(:id => 'blah')
382
- expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
383
- end
384
-
385
- it "should find all unordered lists using no parameters" do
386
- expect(watir_browser).to receive(:uls).with({}).and_return([watir_browser])
387
- watir_page_object.unordered_list_elements
388
- end
389
-
390
- it "should find an ordered list" do
391
- expect(watir_browser).to receive(:ol).with(:id => 'blah').and_return(watir_browser)
392
- element = watir_page_object.ordered_list_element(:id => 'blah')
393
- expect(element).to be_instance_of PageObject::Elements::OrderedList
394
- end
395
-
396
- it "should find an orderd list using a default identifier" do
397
- expect(watir_browser).to receive(:ol).with(:index => 0).and_return(watir_browser)
398
- watir_page_object.ordered_list_element
399
- end
400
-
401
- it "should find all ordered lists" do
402
- expect(watir_browser).to receive(:ols).with(:id => 'blah').and_return([watir_browser])
403
- elements = watir_page_object.ordered_list_elements(:id => 'blah')
404
- expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
405
- end
406
-
407
- it "should find all orderd lists using no parameters" do
408
- expect(watir_browser).to receive(:ols).with({}).and_return([watir_browser])
409
- watir_page_object.ordered_list_elements
410
- end
411
-
412
- it "should find a h1 element" do
413
- expect(watir_browser).to receive(:h1).with(:id => 'blah').and_return(watir_browser)
414
- element = watir_page_object.h1_element(:id => 'blah')
415
- expect(element).to be_instance_of PageObject::Elements::Heading
416
- end
417
-
418
- it "should find a h1 element using a default identifier" do
419
- expect(watir_browser).to receive(:h1).with(:index => 0).and_return(watir_browser)
420
- watir_page_object.h1_element
421
- end
422
-
423
- it "should find all h1 elements" do
424
- expect(watir_browser).to receive(:h1s).with(:id => 'blah').and_return([watir_browser])
425
- elements = watir_page_object.h1_elements(:id => 'blah')
426
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
427
- end
428
-
429
- it "should find all h1 elements using no parameters" do
430
- expect(watir_browser).to receive(:h1s).with({}).and_return([watir_browser])
431
- watir_page_object.h1_elements
432
- end
433
-
434
- it "should find a h2 element" do
435
- expect(watir_browser).to receive(:h2).with(:id => 'blah').and_return(watir_browser)
436
- element = watir_page_object.h2_element(:id => 'blah')
437
- expect(element).to be_instance_of PageObject::Elements::Heading
438
- end
439
-
440
- it "should find a h2 element using default identifier" do
441
- expect(watir_browser).to receive(:h2).with(:index => 0).and_return(watir_browser)
442
- watir_page_object.h2_element
443
- end
444
-
445
- it "should find all h2 elements" do
446
- expect(watir_browser).to receive(:h2s).with(:id => 'blah').and_return([watir_browser])
447
- elements = watir_page_object.h2_elements(:id => 'blah')
448
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
449
- end
450
-
451
- it "should find all h2 elements using no identifier" do
452
- expect(watir_browser).to receive(:h2s).with({}).and_return([watir_browser])
453
- watir_page_object.h2_elements
454
- end
455
-
456
- it "should find a h3 element" do
457
- expect(watir_browser).to receive(:h3).with(:id => 'blah').and_return(watir_browser)
458
- element = watir_page_object.h3_element(:id => 'blah')
459
- expect(element).to be_instance_of PageObject::Elements::Heading
460
- end
461
-
462
- it "should find a h3 element using a default identifier" do
463
- expect(watir_browser).to receive(:h3).with(:index => 0).and_return(watir_browser)
464
- watir_page_object.h3_element
465
- end
466
-
467
- it "should find all h3 elements" do
468
- expect(watir_browser).to receive(:h3s).with(:id => 'blah').and_return([watir_browser])
469
- elements = watir_page_object.h3_elements(:id => 'blah')
470
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
471
- end
472
-
473
- it "should find all h3 elements using no identifiers" do
474
- expect(watir_browser).to receive(:h3s).with({}).and_return([watir_browser])
475
- watir_page_object.h3_elements
476
- end
477
-
478
- it "should find a h4 element" do
479
- expect(watir_browser).to receive(:h4).with(:id => 'blah').and_return(watir_browser)
480
- element = watir_page_object.h4_element(:id => 'blah')
481
- expect(element).to be_instance_of PageObject::Elements::Heading
482
- end
483
-
484
- it "should find a h4 element using a default identifier" do
485
- expect(watir_browser).to receive(:h4).with(:index => 0).and_return(watir_browser)
486
- watir_page_object.h4_element
487
- end
488
-
489
- it "should find all h4 elements" do
490
- expect(watir_browser).to receive(:h4s).with(:id => 'blah').and_return([watir_browser])
491
- elements = watir_page_object.h4_elements(:id => 'blah')
492
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
493
- end
494
-
495
- it "should find all h4 elements using no identifier" do
496
- expect(watir_browser).to receive(:h4s).with({}).and_return([watir_browser])
497
- watir_page_object.h4_elements
498
- end
499
-
500
- it "should find a h5 element" do
501
- expect(watir_browser).to receive(:h5).with(:id => 'blah').and_return(watir_browser)
502
- element = watir_page_object.h5_element(:id => 'blah')
503
- expect(element).to be_instance_of PageObject::Elements::Heading
504
- end
505
-
506
- it "should find a h5 element using a default identifier" do
507
- expect(watir_browser).to receive(:h5).with(:index => 0).and_return(watir_browser)
508
- watir_page_object.h5_element
509
- end
510
-
511
- it "should find all h5 elements" do
512
- expect(watir_browser).to receive(:h5s).with(:id => 'blah').and_return([watir_browser])
513
- elements = watir_page_object.h5_elements(:id => 'blah')
514
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
515
- end
516
-
517
- it "should find all h5 elements using no identifier" do
518
- expect(watir_browser).to receive(:h5s).with({}).and_return([watir_browser])
519
- watir_page_object.h5_elements
520
- end
521
-
522
- it "should find a h6 element" do
523
- expect(watir_browser).to receive(:h6).with(:id => 'blah').and_return(watir_browser)
524
- element = watir_page_object.h6_element(:id => 'blah')
525
- expect(element).to be_instance_of PageObject::Elements::Heading
526
- end
527
-
528
- it "should find a h6 element using a default identifier" do
529
- expect(watir_browser).to receive(:h6).with(:index => 0).and_return(watir_browser)
530
- watir_page_object.h6_element
531
- end
532
-
533
- it "should find all h6 elements" do
534
- expect(watir_browser).to receive(:h6s).with(:id => 'blah').and_return([watir_browser])
535
- elements = watir_page_object.h6_elements(:id => 'blah')
536
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
537
- end
538
-
539
- it "should find all h6 elements using no identifier" do
540
- expect(watir_browser).to receive(:h6s).with({}).and_return([watir_browser])
541
- watir_page_object.h6_elements
542
- end
543
-
544
- it "should find a paragraph element" do
545
- expect(watir_browser).to receive(:p).with(:id => 'blah').and_return(watir_browser)
546
- element = watir_page_object.paragraph_element(:id => 'blah')
547
- expect(element).to be_instance_of PageObject::Elements::Paragraph
548
- end
549
-
550
- it "should find a paragraph element using a default identifier" do
551
- expect(watir_browser).to receive(:p).with(:index => 0).and_return(watir_browser)
552
- watir_page_object.paragraph_element
553
- end
554
-
555
- it "should find all paragraph elements" do
556
- expect(watir_browser).to receive(:ps).with(:id => 'blah').and_return([watir_browser])
557
- elements = watir_page_object.paragraph_elements(:id => 'blah')
558
- expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
559
- end
560
-
561
- it "should find all paragraph elements using no identifier" do
562
- expect(watir_browser).to receive(:ps).with({}).and_return([watir_browser])
563
- watir_page_object.paragraph_elements
564
- end
565
-
566
- it "should find a label" do
567
- expect(watir_browser).to receive(:label).with(:id => 'blah').and_return(watir_browser)
568
- element = watir_page_object.label_element(:id => 'blah')
569
- expect(element).to be_instance_of PageObject::Elements::Label
570
- end
571
-
572
- it "should find a label element using default parameters" do
573
- expect(watir_browser).to receive(:label).with(:index => 0).and_return(watir_browser)
574
- watir_page_object.label_element
575
- end
576
-
577
- it "should find all label elements" do
578
- expect(watir_browser).to receive(:labels).with(:id => 'blah').and_return([watir_browser])
579
- elements = watir_page_object.label_elements(:id => 'blah')
580
- expect(elements[0]).to be_instance_of PageObject::Elements::Label
581
- end
582
-
583
- it "should find all label elements using no parameters" do
584
- expect(watir_browser).to receive(:labels).with({}).and_return([watir_browser])
585
- watir_page_object.label_elements
586
- end
587
-
588
- it "should find a file field element" do
589
- expect(watir_browser).to receive(:file_field).with(:id => 'blah').and_return(watir_browser)
590
- element = watir_page_object.file_field_element(:id => 'blah')
591
- expect(element).to be_instance_of PageObject::Elements::FileField
592
- end
593
-
594
- it "should find a file field element using a default identifier" do
595
- expect(watir_browser).to receive(:file_field).with(:index => 0).and_return(watir_browser)
596
- watir_page_object.file_field_element
597
- end
598
-
599
- it "should find all file field elements" do
600
- expect(watir_browser).to receive(:file_fields).with(:id => 'blah').and_return([watir_browser])
601
- element = watir_page_object.file_field_elements(:id => 'blah')
602
- expect(element[0]).to be_instance_of PageObject::Elements::FileField
603
- end
604
-
605
- it "should find all file fields using no identifier" do
606
- expect(watir_browser).to receive(:file_fields).with({}).and_return([watir_browser])
607
- watir_page_object.file_field_elements
608
- end
609
-
610
- it "should find an area element" do
611
- expect(watir_browser).to receive(:area).with(:id => 'blah').and_return(watir_browser)
612
- element = watir_page_object.area_element(:id => 'blah')
613
- expect(element).to be_instance_of PageObject::Elements::Area
614
- end
615
-
616
- it "should find an area element using a default identifier" do
617
- expect(watir_browser).to receive(:area).with(:index => 0).and_return(watir_browser)
618
- watir_page_object.area_element
619
- end
620
-
621
- it "should find all area elements" do
622
- expect(watir_browser).to receive(:areas).with(:id => 'blah').and_return([watir_browser])
623
- elements = watir_page_object.area_elements(:id => 'blah')
624
- expect(elements[0]).to be_instance_of PageObject::Elements::Area
625
- end
626
-
627
- it "should find all areas with no identifier" do
628
- expect(watir_browser).to receive(:areas).with({}).and_return([watir_browser])
629
- watir_page_object.area_elements
630
- end
631
-
632
- it "should find a canvas element" do
633
- expect(watir_browser).to receive(:canvas).with(:id => 'blah').and_return(watir_browser)
634
- element = watir_page_object.canvas_element(:id => 'blah')
635
- expect(element).to be_instance_of PageObject::Elements::Canvas
636
- end
637
-
638
- it "should find a canvas element using a default identifier" do
639
- expect(watir_browser).to receive(:canvas).with(:index => 0).and_return(watir_browser)
640
- watir_page_object.canvas_element
641
- end
642
-
643
- it "should find all canvas elements" do
644
- expect(watir_browser).to receive(:canvases).with(:id => 'blah').and_return([watir_browser])
645
- elements = watir_page_object.canvas_elements(:id => 'blah')
646
- expect(elements[0]).to be_instance_of PageObject::Elements::Canvas
647
- end
648
-
649
- it "should find all canvases with no identifier" do
650
- expect(watir_browser).to receive(:canvases).with({}).and_return([watir_browser])
651
- watir_page_object.canvas_elements
652
- end
653
-
654
- it "should find an audio element" do
655
- expect(watir_browser).to receive(:audio).with(:id => 'blah').and_return(watir_browser)
656
- element = watir_page_object.audio_element(:id => 'blah')
657
- expect(element).to be_instance_of PageObject::Elements::Audio
658
- end
659
-
660
- it "should find an audio element using a default identifier" do
661
- expect(watir_browser).to receive(:audio).with(:index => 0).and_return(watir_browser)
662
- watir_page_object.audio_element
663
- end
664
-
665
- it "should find all audio elements" do
666
- expect(watir_browser).to receive(:audios).with(:id => 'blah').and_return([watir_browser])
667
- elements = watir_page_object.audio_elements(:id => 'blah')
668
- expect(elements[0]).to be_instance_of PageObject::Elements::Audio
669
- end
670
-
671
- it "should find all audio elements with no identifier" do
672
- expect(watir_browser).to receive(:audios).with({}).and_return([watir_browser])
673
- watir_page_object.audio_elements
674
- end
675
-
676
- it "should find a video element" do
677
- expect(watir_browser).to receive(:video).with(:id => 'blah').and_return(watir_browser)
678
- element = watir_page_object.video_element(:id => 'blah')
679
- expect(element).to be_instance_of PageObject::Elements::Video
680
- end
681
-
682
- it "should find a video element using a default identifier" do
683
- expect(watir_browser).to receive(:video).with(:index => 0).and_return(watir_browser)
684
- watir_page_object.video_element
685
- end
686
-
687
- it "should find all video elements" do
688
- expect(watir_browser).to receive(:videos).with(:id => 'blah').and_return([watir_browser])
689
- elements = watir_page_object.video_elements(:id => 'blah')
690
- expect(elements[0]).to be_instance_of PageObject::Elements::Video
691
- end
692
-
693
- it "should find all video elements with no identifier" do
694
- expect(watir_browser).to receive(:videos).with({}).and_return([watir_browser])
695
- watir_page_object.video_elements
696
- end
697
-
698
- it "should find an element" do
699
- expect(watir_browser).to receive(:audio).with(:id => 'blah').and_return(watir_browser)
700
- element = watir_page_object.element(:audio, :id => 'blah')
701
- expect(element).to be_instance_of PageObject::Elements::Element
702
- end
703
-
704
- it "should find an element using a default identifier" do
705
- expect(watir_browser).to receive(:audio).with(:index => 0).and_return(watir_browser)
706
- watir_page_object.element(:audio)
707
- end
708
-
709
- it "should find a b element" do
710
- expect(watir_browser).to receive(:b).with(:id => 'blah').and_return(watir_browser)
711
- element = watir_page_object.b_element(:id => 'blah')
712
- expect(element).to be_instance_of PageObject::Elements::Bold
713
- end
714
-
715
- it "should find a b element using a default identifier" do
716
- expect(watir_browser).to receive(:b).with(:index => 0).and_return(watir_browser)
717
- watir_page_object.b_element
718
- end
719
-
720
- it "should find all b elements" do
721
- expect(watir_browser).to receive(:bs).with(:id => 'blah').and_return([watir_browser])
722
- elements = watir_page_object.b_elements(:id => 'blah')
723
- expect(elements[0]).to be_instance_of PageObject::Elements::Bold
724
- end
725
-
726
- it "should find all b elements using no parameters" do
727
- expect(watir_browser).to receive(:bs).with({}).and_return([watir_browser])
728
- watir_page_object.b_elements
729
- end
730
-
731
- it "should find an i element" do
732
- expect(watir_browser).to receive(:i).with(:id => 'blah').and_return(watir_browser)
733
- element = watir_page_object.i_element(:id => 'blah')
734
- expect(element).to be_instance_of PageObject::Elements::Italic
735
- end
736
-
737
- it "should find an i element using a default identifier" do
738
- expect(watir_browser).to receive(:i).with(:index => 0).and_return(watir_browser)
739
- watir_page_object.i_element
740
- end
741
-
742
- it "should find all i elements" do
743
- expect(watir_browser).to receive(:is).with(:id => 'blah').and_return([watir_browser])
744
- elements = watir_page_object.i_elements(:id => 'blah')
745
- expect(elements[0]).to be_instance_of PageObject::Elements::Italic
746
- end
747
-
748
- it "should find all i elements using no parameters" do
749
- expect(watir_browser).to receive(:is).with({}).and_return([watir_browser])
750
- watir_page_object.i_elements
751
- end
752
- end
753
-
754
- context "when using Selenium" do
755
- let(:selenium_browser) { mock_selenium_browser }
756
- let(:selenium_page_object) { ElementLocatorsTestPageObject.new(selenium_browser) }
757
-
758
- it "should find a button element" do
759
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
760
- element = selenium_page_object.button_element(:id => 'blah')
761
- expect(element).to be_instance_of PageObject::Elements::Button
762
- end
763
-
764
- it "should find all button elements" do
765
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
766
- elements = selenium_page_object.button_elements(:id => 'blah')
767
- expect(elements[0]).to be_instance_of PageObject::Elements::Button
768
- end
769
-
770
- it "should find a text field element" do
771
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
772
- element = selenium_page_object.text_field_element(:id => 'blah')
773
- expect(element).to be_instance_of PageObject::Elements::TextField
774
- end
775
-
776
- it "should find all text field elements" do
777
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
778
- elements = selenium_page_object.text_field_elements(:id => 'blah')
779
- expect(elements[0]).to be_instance_of PageObject::Elements::TextField
780
- end
781
-
782
- it "should find a hidden field element" do
783
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
784
- element = selenium_page_object.hidden_field_element(:id => 'blah')
785
- expect(element).to be_instance_of PageObject::Elements::HiddenField
786
- end
787
-
788
- it "should find all hidden field elements" do
789
- expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
790
- elements = selenium_page_object.hidden_field_elements(:id => 'blah')
791
- expect(elements[0]).to be_instance_of PageObject::Elements::HiddenField
792
-
793
- end
794
-
795
- it "should find a text area element" do
796
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
797
- element = selenium_page_object.text_area_element(:id => 'blah')
798
- expect(element).to be_instance_of PageObject::Elements::TextArea
799
- end
800
-
801
- it "should find all text area elements" do
802
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
803
- elements = selenium_page_object.text_area_elements(:id => 'blah')
804
- expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
805
- end
806
-
807
- it "should find a select list element" do
808
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
809
- element = selenium_page_object.select_list_element(:id => 'blah')
810
- expect(element).to be_instance_of PageObject::Elements::SelectList
811
- end
812
-
813
- it "should find all select list elements" do
814
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
815
- elements = selenium_page_object.select_list_elements(:id => 'blah')
816
- expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
817
- end
818
-
819
- it "should find a link element" do
820
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
821
- element = selenium_page_object.link_element(:id => 'blah')
822
- expect(element).to be_instance_of PageObject::Elements::Link
823
- end
824
-
825
- it "should find all link elements" do
826
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
827
- elements = selenium_page_object.link_elements(:id => 'blah')
828
- expect(elements[0]).to be_instance_of PageObject::Elements::Link
829
- end
830
-
831
- it "should find a check box" do
832
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
833
- element = selenium_page_object.checkbox_element(:id => 'blah')
834
- expect(element).to be_instance_of PageObject::Elements::CheckBox
835
- end
836
-
837
- it "should find all checkbox elements" do
838
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
839
- elements = selenium_page_object.checkbox_elements(:id => 'blah')
840
- expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
841
- end
842
-
843
- it "should find a radio button" do
844
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
845
- element = selenium_page_object.radio_button_element(:id => 'blah')
846
- expect(element).to be_instance_of PageObject::Elements::RadioButton
847
- end
848
-
849
- it "should find all radio button elements" do
850
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
851
- elements = selenium_page_object.radio_button_elements(:id => 'blah')
852
- expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
853
- end
854
-
855
- it "should find a div" do
856
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
857
- element = selenium_page_object.div_element(:id => 'blah')
858
- expect(element).to be_instance_of PageObject::Elements::Div
859
- end
860
-
861
- it "should find all div elements" do
862
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
863
- elements = selenium_page_object.div_elements(:id => 'blah')
864
- expect(elements[0]).to be_instance_of PageObject::Elements::Div
865
- end
866
-
867
- it "should find a span" do
868
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
869
- element = selenium_page_object.span_element(:id => 'blah')
870
- expect(element).to be_instance_of PageObject::Elements::Span
871
- end
872
-
873
- it "should find all span elements" do
874
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
875
- elements = selenium_page_object.span_elements(:id => 'blah')
876
- expect(elements[0]).to be_instance_of PageObject::Elements::Span
877
- end
878
-
879
- it "should find a table" do
880
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
881
- element = selenium_page_object.table_element(:id => 'blah')
882
- expect(element).to be_instance_of PageObject::Elements::Table
883
- end
884
-
885
- it "should find all table elements" do
886
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
887
- elements = selenium_page_object.table_elements(:id => 'blah')
888
- expect(elements[0]).to be_instance_of PageObject::Elements::Table
889
- end
890
-
891
- it "should find a table cell" do
892
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
893
- element = selenium_page_object.cell_element(:id => 'blah')
894
- expect(element).to be_instance_of PageObject::Elements::TableCell
895
- end
896
-
897
- it "should find all table cell elements" do
898
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
899
- elements = selenium_page_object.cell_elements(:id => 'blah')
900
- expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
901
- end
902
-
903
- it "should find an image" do
904
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
905
- element = selenium_page_object.image_element(:id => 'blah')
906
- expect(element).to be_instance_of PageObject::Elements::Image
907
- end
908
-
909
- it "should find all image elements" do
910
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
911
- elements = selenium_page_object.image_elements(:id => 'blah')
912
- expect(elements[0]).to be_instance_of PageObject::Elements::Image
913
- end
914
-
915
- it "should find a form" do
916
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
917
- element = selenium_page_object.form_element(:id => 'blah')
918
- expect(element).to be_instance_of PageObject::Elements::Form
919
- end
920
-
921
- it "should find all forms" do
922
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
923
- elements = selenium_page_object.form_elements(:id => 'blah')
924
- expect(elements[0]).to be_instance_of PageObject::Elements::Form
925
- end
926
-
927
- it "should find a list item" do
928
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
929
- element = selenium_page_object.list_item_element(:id => 'blah')
930
- expect(element).to be_instance_of PageObject::Elements::ListItem
931
- end
932
-
933
- it "should find all list items" do
934
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
935
- element = selenium_page_object.list_item_elements(:id => 'blah')
936
- expect(element[0]).to be_instance_of PageObject::Elements::ListItem
937
- end
938
-
939
- it "should find an unordered list" do
940
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
941
- element = selenium_page_object.unordered_list_element(:id => 'blah')
942
- expect(element).to be_instance_of PageObject::Elements::UnorderedList
943
- end
944
-
945
- it "should find all unordered lists" do
946
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
947
- elements = selenium_page_object.unordered_list_elements(:id => 'blah')
948
- expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
949
- end
950
-
951
- it "should find an ordered list" do
952
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
953
- element = selenium_page_object.ordered_list_element(:id => 'blah')
954
- expect(element).to be_instance_of PageObject::Elements::OrderedList
955
- end
956
-
957
- it "should find all orderd list elements" do
958
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
959
- elements = selenium_page_object.ordered_list_elements(:id => 'blah')
960
- expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
961
- end
962
-
963
- it "should find a h1 element" do
964
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
965
- element = selenium_page_object.h1_element(:id => 'blah')
966
- expect(element).to be_instance_of PageObject::Elements::Heading
967
- end
968
-
969
- it "should find all h1 elements" do
970
- expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
971
- elements = selenium_page_object.h1_elements(:id => 'blah')
972
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
973
- end
974
-
975
- it "should find a h2 element" do
976
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
977
- element = selenium_page_object.h2_element(:id => 'blah')
978
- expect(element).to be_instance_of PageObject::Elements::Heading
979
- end
980
-
981
- it "should find all h2 elements" do
982
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
983
- elements = selenium_page_object.h2_elements(:id => 'blah')
984
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
985
- end
986
-
987
- it "should find a h3 element" do
988
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
989
- element = selenium_page_object.h3_element(:id => 'blah')
990
- expect(element).to be_instance_of PageObject::Elements::Heading
991
- end
992
-
993
- it "should find all h3 elements" do
994
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
995
- elements = selenium_page_object.h3_elements(:id => 'blah')
996
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
997
- end
998
-
999
- it "should find a h4 element" do
1000
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1001
- element = selenium_page_object.h4_element(:id => 'blah')
1002
- expect(element).to be_instance_of PageObject::Elements::Heading
1003
- end
1004
-
1005
- it "should find all h4 elements" do
1006
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1007
- elements = selenium_page_object.h4_elements(:id => 'blah')
1008
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
1009
- end
1010
-
1011
- it "should find a h5 element" do
1012
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1013
- element = selenium_page_object.h5_element(:id => 'blah')
1014
- expect(element).to be_instance_of PageObject::Elements::Heading
1015
- end
1016
-
1017
- it "should find all h5 elements" do
1018
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1019
- elements = selenium_page_object.h5_elements(:id => 'blah')
1020
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
1021
- end
1022
-
1023
- it "should find a h6 element" do
1024
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1025
- element = selenium_page_object.h6_element(:id => 'blah')
1026
- expect(element).to be_instance_of PageObject::Elements::Heading
1027
- end
1028
-
1029
- it "should find all h6 elements" do
1030
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1031
- elements = selenium_page_object.h6_elements(:id => 'blah')
1032
- expect(elements[0]).to be_instance_of PageObject::Elements::Heading
1033
- end
1034
-
1035
- it "should find a paragraph element" do
1036
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1037
- element = selenium_page_object.paragraph_element(:id => 'blah')
1038
- expect(element).to be_instance_of PageObject::Elements::Paragraph
1039
- end
1040
-
1041
- it "should find all paragraph elements" do
1042
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1043
- elements = selenium_page_object.paragraph_elements(:id => 'blah')
1044
- expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
1045
- end
1046
-
1047
- it "should find a label" do
1048
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1049
- element = selenium_page_object.label_element(:id => 'blah')
1050
- expect(element).to be_instance_of PageObject::Elements::Label
1051
- end
1052
-
1053
- it "should find all label elements" do
1054
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1055
- elements = selenium_page_object.label_elements(:id => 'blah')
1056
- expect(elements[0]).to be_instance_of PageObject::Elements::Label
1057
- end
1058
-
1059
- it "should find a file field element" do
1060
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1061
- element = selenium_page_object.file_field_element(:id => 'blah')
1062
- expect(element).to be_instance_of PageObject::Elements::FileField
1063
- end
1064
-
1065
- it "should find an area element" do
1066
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1067
- element = selenium_page_object.area_element(:id => 'blah')
1068
- expect(element).to be_instance_of PageObject::Elements::Area
1069
- end
1070
-
1071
- it "should find an area element using a default identifier" do
1072
- expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//area)[1]').and_return(selenium_browser)
1073
- selenium_page_object.area_element
1074
- end
1075
-
1076
- it "should find all area elements" do
1077
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1078
- elements = selenium_page_object.area_elements(:id => 'blah')
1079
- expect(elements[0]).to be_instance_of PageObject::Elements::Area
1080
- end
1081
-
1082
- it "should find all areas with no identifier" do
1083
- expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'area').and_return([selenium_browser])
1084
- selenium_page_object.area_elements
1085
- end
1086
-
1087
- it "should find a canvas element" do
1088
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1089
- element = selenium_page_object.canvas_element(:id => 'blah')
1090
- expect(element).to be_instance_of PageObject::Elements::Canvas
1091
- end
1092
-
1093
- it "should find a canvas element using a default identifier" do
1094
- expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//canvas)[1]').and_return(selenium_browser)
1095
- selenium_page_object.canvas_element
1096
- end
1097
-
1098
- it "should find all canvas elements" do
1099
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1100
- elements = selenium_page_object.canvas_elements(:id => 'blah')
1101
- expect(elements[0]).to be_instance_of PageObject::Elements::Canvas
1102
- end
1103
-
1104
- it "should find all canvases with no identifier" do
1105
- expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'canvas').and_return([selenium_browser])
1106
- selenium_page_object.canvas_elements
1107
- end
1108
-
1109
- it "should find an audio element" do
1110
- expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1111
- element = selenium_page_object.audio_element(:id => 'blah')
1112
- expect(element).to be_instance_of PageObject::Elements::Audio
1113
- end
1114
-
1115
- it "should find an audio element using a default identifier" do
1116
- expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//audio)[1]').and_return(selenium_browser)
1117
- selenium_page_object.audio_element
1118
- end
1119
-
1120
- it "should find all audio elements" do
1121
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1122
- elements = selenium_page_object.audio_elements(:id => 'blah')
1123
- expect(elements[0]).to be_instance_of PageObject::Elements::Audio
1124
- end
1125
-
1126
- it "should find all audio elements with no identifier" do
1127
- expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
1128
- selenium_page_object.audio_elements
1129
- end
1130
- it "should find an i element" do
1131
- expect(selenium_browser).to receive(:find_element).with(:id,'blah').and_return(selenium_browser)
1132
- element = selenium_page_object.i_element(:id => 'blah')
1133
- expect(element).to be_instance_of PageObject::Elements::Italic
1134
- end
1135
-
1136
-
1137
- it "should find all i elements" do
1138
- expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1139
- elements = selenium_page_object.i_elements(:id => 'blah')
1140
- expect(elements[0]).to be_instance_of PageObject::Elements::Italic
1141
- end
1142
-
1143
- end
1144
- end