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,39 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::FileField do
5
-
6
- describe "when mapping how to find an element" do
7
- let(:filefield) { PageObject::Elements::FileField }
8
-
9
- it "should map watir types to same" do
10
- [:class, :id, :index, :name, :xpath, :title].each do |t|
11
- identifier = filefield.watir_identifier_for t => 'value'
12
- expect(identifier.keys.first).to eql t
13
- end
14
- end
15
-
16
- it "should map selenium types to same" do
17
- [:class, :id, :index, :name, :xpath, :title].each do |t|
18
- key, value = filefield.selenium_identifier_for t => 'value'
19
- expect(key).to eql t
20
- end
21
- end
22
- end
23
-
24
- describe "interface" do
25
- let(:filefield) { double('file_field') }
26
-
27
- it "should register as type :file" do
28
- expect(::PageObject::Elements.element_class_for(:input, :file)).to eql ::PageObject::Elements::FileField
29
- end
30
-
31
- context "for selenium" do
32
- it "should set its' value" do
33
- selenium_file_field = PageObject::Elements::FileField.new(filefield, :platform => :selenium_webdriver)
34
- expect(filefield).to receive(:send_keys).with('a file')
35
- selenium_file_field.value = 'a file'
36
- end
37
- end
38
- end
39
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Form do
5
- describe "interface" do
6
- let(:form_element) { double('form_element') }
7
-
8
- it "should register with tag_name :form" do
9
- expect(::PageObject::Elements.element_class_for(:form)).to eql ::PageObject::Elements::Form
10
- end
11
-
12
- context "for watir" do
13
- it "should submit a form" do
14
- form = PageObject::Elements::Form.new(form_element, :platform => :watir_webdriver)
15
- expect(form_element).to receive(:submit)
16
- form.submit
17
- end
18
- end
19
-
20
- context "for selenium" do
21
- it "should submit a form" do
22
- form = PageObject::Elements::Form.new(form_element, :platform => :selenium_webdriver)
23
- expect(form_element).to receive(:submit)
24
- form.submit
25
- end
26
- end
27
- end
28
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Heading do
5
- let(:heading) { PageObject::Elements::Heading }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :index, :name, :xpath].each do |t|
10
- identifier = heading.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :index, :name, :xpath].each do |t|
17
- key, value = heading.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
- end
22
-
23
- describe "interface" do
24
- it "should register with tag :h1" do
25
- expect(::PageObject::Elements.element_class_for(:h1)).to eql ::PageObject::Elements::Heading
26
- end
27
-
28
- it "should register with tag :h2" do
29
- expect(::PageObject::Elements.element_class_for(:h2)).to eql ::PageObject::Elements::Heading
30
- end
31
-
32
- it "should register with tag :h3" do
33
- expect(::PageObject::Elements.element_class_for(:h3)).to eql ::PageObject::Elements::Heading
34
- end
35
-
36
- it "should register with tag :h4" do
37
- expect(::PageObject::Elements.element_class_for(:h4)).to eql ::PageObject::Elements::Heading
38
- end
39
-
40
- it "should register with tag :h5" do
41
- expect(::PageObject::Elements.element_class_for(:h5)).to eql ::PageObject::Elements::Heading
42
- end
43
-
44
- it "should register with tag :h6" do
45
- expect(::PageObject::Elements.element_class_for(:h6)).to eql ::PageObject::Elements::Heading
46
- end
47
- end
48
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::HiddenField do
5
- let(:hiddenfield) { PageObject::Elements::HiddenField }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :index, :name, :text, :xpath, :value].each do |t|
10
- identifier = hiddenfield.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :name, :xpath, :index, :value].each do |t|
17
- key, value = hiddenfield.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
- end
22
-
23
- describe "interface" do
24
- it "should register with type :hidden" do
25
- expect(::PageObject::Elements.element_class_for(:input, :hidden)).to eql ::PageObject::Elements::HiddenField
26
- end
27
- end
28
- end
@@ -1,66 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Image do
5
- let(:image) { PageObject::Elements::Image }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :index, :name, :xpath, :alt, :src].each do |t|
10
- identifier = image.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :index, :name, :xpath, :alt, :src].each do |t|
17
- key, value = image.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
- end
22
-
23
- describe "interface" do
24
- let(:image_element) { double('image_element') }
25
-
26
- before(:each) do
27
- allow(image_element).to receive(:size).and_return(image_element)
28
- end
29
-
30
- it "should register with tag_name :img" do
31
- expect(::PageObject::Elements.element_class_for(:img)).to eql ::PageObject::Elements::Image
32
- end
33
-
34
- context "for watir" do
35
- it "should know the images width" do
36
- image = PageObject::Elements::Image.new(image_element, :platform => :watir_webdriver)
37
- expect(image_element).to receive(:width).and_return(100)
38
- expect(image.width).to eql 100
39
- end
40
-
41
- it "should know the images height" do
42
- image = PageObject::Elements::Image.new(image_element, :platform => :watir_webdriver)
43
- expect(image_element).to receive(:height).and_return(120)
44
- expect(image.height).to eql 120
45
- end
46
- end
47
-
48
- context "for selenium" do
49
- it "should know the images width" do
50
- dim = double('dimension')
51
- image = PageObject::Elements::Image.new(image_element, :platform => :selenium_webdriver)
52
- expect(image_element).to receive(:size).and_return(dim)
53
- expect(dim).to receive(:width).and_return(100)
54
- expect(image.width).to eql 100
55
- end
56
-
57
- it "should know the images height" do
58
- dim = double('dimension')
59
- image = PageObject::Elements::Image.new(image_element, :platform => :selenium_webdriver)
60
- expect(image_element).to receive(:size).and_return(dim)
61
- expect(dim).to receive(:height).and_return(120)
62
- expect(image.height).to eql 120
63
- end
64
- end
65
- end
66
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Italic do
5
- let(:italic) { PageObject::Elements::Italic }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :index, :name, :xpath].each do |t|
10
- identifier = italic.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :index, :name, :xpath].each do |t|
17
- key, value = italic.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
- end
22
-
23
- describe "interface" do
24
-
25
- it "should register with tag :i" do
26
- expect(::PageObject::Elements.element_class_for(:i)).to eql ::PageObject::Elements::Italic
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Label do
5
- let(:label) { PageObject::Elements::Label }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :text, :index, :xpath].each do |t|
10
- identifier = label.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :text, :index, :xpath].each do |t|
17
- key, value = label.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
-
22
- describe "interface" do
23
- it "should register with tag :label" do
24
- expect(::PageObject::Elements.element_class_for(:label)).to eql ::PageObject::Elements::Label
25
- end
26
- end
27
- end
28
- end
29
-
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Link do
5
- let(:link) { PageObject::Elements::Link }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :href, :id, :index, :name, :text, :xpath, :css, :title].each do |t|
10
- identifier = link.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to watir" do
16
- [:link, :link_text].each do |t|
17
- identifier = link.watir_identifier_for t => 'value'
18
- expect(identifier.keys.first).to eql :text
19
- end
20
- end
21
-
22
- it "should map selenium types to same" do
23
- [:class, :id, :link, :link_text, :name, :xpath, :index, :css, :title].each do |t|
24
- key, value = link.selenium_identifier_for t => 'value'
25
- expect(key).to eql t
26
- end
27
- end
28
-
29
- it "should map watir types to selenium" do
30
- key, value = link.selenium_identifier_for :text => 'value'
31
- expect(key).to eql :link_text
32
- end
33
- end
34
-
35
- describe "interface" do
36
- let(:link_element) { double('link_element') }
37
-
38
- it "should register with tag :a" do
39
- expect(::PageObject::Elements.element_class_for(:a)).to eql ::PageObject::Elements::Link
40
- end
41
-
42
- context "for selenium" do
43
- it "should return error when asked for its' value" do
44
- link = PageObject::Elements::Link.new(link_element, :platform => :selenium_webdriver)
45
- expect(lambda { link.value }).to raise_error
46
- end
47
- end
48
- end
49
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::ListItem do
5
- let(:list_item) { PageObject::Elements::ListItem }
6
-
7
- describe "when mapping how to find an element" do
8
- it "should map watir types to same" do
9
- [:class, :id, :index, :text, :xpath].each do |t|
10
- identifier = list_item.watir_identifier_for t => 'value'
11
- expect(identifier.keys.first).to eql t
12
- end
13
- end
14
-
15
- it "should map selenium types to same" do
16
- [:class, :id, :index, :name, :text, :xpath].each do |t|
17
- key, value = list_item.selenium_identifier_for t => 'value'
18
- expect(key).to eql t
19
- end
20
- end
21
-
22
- describe "interface" do
23
- it "should register as tag_name :li" do
24
- expect(::PageObject::Elements.element_class_for(:li)).to eql ::PageObject::Elements::ListItem
25
- end
26
- end
27
- end
28
- end
29
-
@@ -1,63 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
- describe PageObject::Elements::Media do
5
-
6
- let(:media) { PageObject::Elements::Media.new(double(''), :platform => :watir_webdriver) }
7
-
8
- it "should return autoplay" do
9
- expect(media).to receive(:attribute).with(:autoplay).and_return(true)
10
- expect(media.autoplay?).to eq(true)
11
- end
12
-
13
- it "should return controls" do
14
- expect(media).to receive(:attribute).with(:controls).and_return(true)
15
- expect(media.has_controls?).to eq(true)
16
- end
17
-
18
- it "should return paused" do
19
- expect(media).to receive(:attribute).with(:paused).and_return(true)
20
- expect(media.paused?).to eq(true)
21
- end
22
-
23
- it "should not return duration when not present" do
24
- expect(media).to receive(:attribute).with(:duration).and_return(nil)
25
- expect(media.duration).to eq(nil)
26
- end
27
-
28
- it "should return duration when present" do
29
- expect(media).to receive(:attribute).with(:duration).and_return('1.405')
30
- expect(media.duration).to eq(1.405)
31
- end
32
-
33
- it "should not return volume when not present" do
34
- expect(media).to receive(:attribute).with(:volume).and_return(nil)
35
- expect(media.volume).to eq(nil)
36
- end
37
-
38
- it "should return volume when present" do
39
- expect(media).to receive(:attribute).with(:volume).and_return('3')
40
- expect(media.volume).to eq(3)
41
- end
42
-
43
- it "should return ended" do
44
- expect(media).to receive(:attribute).with(:ended).and_return(true)
45
- expect(media.ended?).to eq(true)
46
- end
47
-
48
- it "should return seeking" do
49
- expect(media).to receive(:attribute).with(:seeking).and_return(true)
50
- expect(media.seeking?).to eq(true)
51
- end
52
-
53
- it "should return loop" do
54
- expect(media).to receive(:attribute).with(:loop).and_return(true)
55
- expect(media.loop?).to eq(true)
56
- end
57
-
58
- it "should return muted" do
59
- expect(media).to receive(:attribute).with(:muted).and_return(true)
60
- expect(media.muted?).to eq(true)
61
- end
62
-
63
- end
@@ -1,254 +0,0 @@
1
- require 'spec_helper'
2
- require 'page-object/elements'
3
-
4
-
5
- describe "Element with nested elements" do
6
- context "in Watir" do
7
- before(:each) do
8
- @watir_driver = Watir::Element.new(nil, {})
9
- @watir_element = PageObject::Elements::Element.new(@watir_driver, :platform => :watir_webdriver)
10
- end
11
-
12
- it "should find nested links" do
13
- expect(@watir_driver).to receive(:link).with(:id => 'blah').and_return(@watir_driver)
14
- @watir_element.link_element(:id => 'blah')
15
- end
16
-
17
- it "should find nested buttons" do
18
- expect(@watir_driver).to receive(:button).with(:id => 'blah').and_return(@watir_driver)
19
- @watir_element.button_element(:id => 'blah')
20
- end
21
-
22
- it "should find nested text fields" do
23
- expect(@watir_driver).to receive(:text_field).with(:id => 'blah').and_return(@watir_driver)
24
- @watir_element.text_field_element(:id => 'blah')
25
- end
26
-
27
- it "should find nested hidden fields" do
28
- expect(@watir_driver).to receive(:hidden).and_return(@watir_driver)
29
- @watir_element.hidden_field_element
30
- end
31
-
32
- it "should find nested text areas" do
33
- expect(@watir_driver).to receive(:textarea).and_return(@watir_driver)
34
- @watir_element.text_area_element
35
- end
36
-
37
- it "should find a nested select list" do
38
- expect(@watir_driver).to receive(:select_list).and_return(@watir_driver)
39
- @watir_element.select_list_element
40
- end
41
-
42
- it "should find a nested checkbox" do
43
- expect(@watir_driver).to receive(:checkbox).and_return(@watir_driver)
44
- @watir_element.checkbox_element
45
- end
46
-
47
- it "should find a nested radio button" do
48
- expect(@watir_driver).to receive(:radio).and_return(@watir_driver)
49
- @watir_element.radio_button_element
50
- end
51
-
52
- it "should find a nested div" do
53
- expect(@watir_driver).to receive(:div).and_return(@watir_driver)
54
- @watir_element.div_element
55
- end
56
-
57
- it "should find a nested span" do
58
- expect(@watir_driver).to receive(:span).and_return(@watir_driver)
59
- @watir_element.span_element
60
- end
61
-
62
- it "should find a nested table" do
63
- expect(@watir_driver).to receive(:table).and_return(@watir_driver)
64
- @watir_element.table_element
65
- end
66
-
67
- it "should find a nested cell" do
68
- expect(@watir_driver).to receive(:td).and_return(@watir_driver)
69
- @watir_element.cell_element
70
- end
71
-
72
- it "should find a nested image" do
73
- expect(@watir_driver).to receive(:image).and_return(@watir_driver)
74
- @watir_element.image_element
75
- end
76
-
77
- it "should find a nested form" do
78
- expect(@watir_driver).to receive(:form).and_return(@watir_driver)
79
- @watir_element.form_element
80
- end
81
-
82
- it "should find a nested ordered list" do
83
- expect(@watir_driver).to receive(:ol).and_return(@watir_driver)
84
- @watir_element.ordered_list_element
85
- end
86
-
87
- it "should find a nested unordered list" do
88
- expect(@watir_driver).to receive(:ul).and_return(@watir_driver)
89
- @watir_element.unordered_list_element
90
- end
91
-
92
- it "should find a nested list item" do
93
- expect(@watir_driver).to receive(:li).and_return(@watir_driver)
94
- @watir_element.list_item_element
95
- end
96
-
97
- it "should find a nested h1" do
98
- expect(@watir_driver).to receive(:h1).and_return(@watir_driver)
99
- @watir_element.h1_element
100
- end
101
-
102
- it "should find a nested h2" do
103
- expect(@watir_driver).to receive(:h2).and_return(@watir_driver)
104
- @watir_element.h2_element
105
- end
106
-
107
- it "should find a nested h3" do
108
- expect(@watir_driver).to receive(:h3).and_return(@watir_driver)
109
- @watir_element.h3_element
110
- end
111
-
112
- it "should find a nested h4" do
113
- expect(@watir_driver).to receive(:h4).and_return(@watir_driver)
114
- @watir_element.h4_element
115
- end
116
-
117
- it "should find a nested h5" do
118
- expect(@watir_driver).to receive(:h5).and_return(@watir_driver)
119
- @watir_element.h5_element
120
- end
121
-
122
- it "should find a nested h6" do
123
- expect(@watir_driver).to receive(:h6).and_return(@watir_driver)
124
- @watir_element.h6_element
125
- end
126
- end
127
-
128
- context "in Selenium" do
129
- before(:each) do
130
- @selenium_driver = double('selenium')
131
- @selenium_element = PageObject::Elements::Element.new(@selenium_driver, :platform => :selenium_webdriver)
132
- end
133
-
134
- it "should find nested links" do
135
- expect(@selenium_driver).to receive(:find_element).with(:id, 'blah').and_return(@selenium_driver)
136
- @selenium_element.link_element(:id => 'blah')
137
- end
138
-
139
- it "should find nested buttons" do
140
- expect(@selenium_driver).to receive(:find_element).with(:id, 'blah').and_return(@selenium_driver)
141
- @selenium_element.button_element(:id => 'blah')
142
- end
143
-
144
- it "should find nested text fields" do
145
- expect(@selenium_driver).to receive(:find_element).with(:id, 'blah').and_return(@selenium_driver)
146
- @selenium_element.text_field_element(:id => 'blah')
147
- end
148
-
149
- it "should find nested hidden fields" do
150
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
151
- @selenium_element.hidden_field_element
152
- end
153
-
154
- it "should find nested text areas" do
155
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
156
- @selenium_element.text_area_element
157
- end
158
-
159
- it "should find a nested select list" do
160
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
161
- @selenium_element.select_list_element
162
- end
163
-
164
- it "should find a nested checkbox" do
165
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
166
- @selenium_element.checkbox_element
167
- end
168
-
169
- it "should find a nested radio button" do
170
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
171
- @selenium_element.radio_button_element
172
- end
173
-
174
- it "should find a nested div" do
175
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
176
- @selenium_element.div_element
177
- end
178
-
179
- it "should find a nested span" do
180
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
181
- @selenium_element.span_element
182
- end
183
-
184
- it "should find a nested table" do
185
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
186
- @selenium_element.table_element
187
- end
188
-
189
- it "should find a nested cell" do
190
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
191
- @selenium_element.cell_element
192
- end
193
-
194
- it "should find a nested image" do
195
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
196
- @selenium_element.image_element
197
- end
198
-
199
- it "should find a nested form" do
200
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
201
- @selenium_element.form_element
202
- end
203
-
204
- it "should find an ordered list" do
205
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
206
- @selenium_element.ordered_list_element
207
- end
208
-
209
- it "should find an unordered list" do
210
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
211
- @selenium_element.unordered_list_element
212
- end
213
-
214
- it "should find a nested list item" do
215
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
216
- @selenium_element.list_item_element
217
- end
218
-
219
- it "should find a nested h1" do
220
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
221
- @selenium_element.h1_element
222
- end
223
-
224
- it "should find a nested h2" do
225
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
226
- @selenium_element.h2_element
227
- end
228
-
229
- it "should find a nested h3" do
230
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
231
- @selenium_element.h3_element
232
- end
233
-
234
- it "should find a nested h4" do
235
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
236
- @selenium_element.h4_element
237
- end
238
-
239
- it "should find a nested h5" do
240
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
241
- @selenium_element.h5_element
242
- end
243
-
244
- it "should find a nested h6" do
245
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
246
- @selenium_element.h6_element
247
- end
248
-
249
- it "should find a nested paragraph" do
250
- expect(@selenium_driver).to receive(:find_element).and_return(@selenium_driver)
251
- @selenium_element.paragraph_element
252
- end
253
- end
254
- end