page_object 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/ChangeLog +809 -0
- data/Gemfile +14 -0
- data/Guardfile +20 -0
- data/LICENSE +20 -0
- data/README.md +111 -0
- data/Rakefile +35 -0
- data/cucumber.yml +10 -0
- data/features/area.feature +35 -0
- data/features/async.feature +30 -0
- data/features/audio.feature +68 -0
- data/features/bold.feature +21 -0
- data/features/button.feature +98 -0
- data/features/canvas.feature +37 -0
- data/features/check_box.feature +55 -0
- data/features/div.feature +45 -0
- data/features/element.feature +322 -0
- data/features/file_field.feature +40 -0
- data/features/form.feature +43 -0
- data/features/frames.feature +75 -0
- data/features/generic_elements.feature +29 -0
- data/features/gxt_table_extension.feature +24 -0
- data/features/headings.feature +97 -0
- data/features/hidden_field.feature +45 -0
- data/features/html/04-Death_Becomes_Fur.mp4 +0 -0
- data/features/html/04-Death_Becomes_Fur.oga +0 -0
- data/features/html/async.html +36 -0
- data/features/html/double_click.html +13 -0
- data/features/html/failure.html +8 -0
- data/features/html/frame_1.html +18 -0
- data/features/html/frame_2.html +16 -0
- data/features/html/frame_3.html +14 -0
- data/features/html/frames.html +12 -0
- data/features/html/hover.html +12 -0
- data/features/html/iframes.html +12 -0
- data/features/html/images/circle.png +0 -0
- data/features/html/images/img_pulpit.jpg +0 -0
- data/features/html/images/submit.gif +0 -0
- data/features/html/indexed_property.html +55 -0
- data/features/html/modal.html +17 -0
- data/features/html/modal_1.html +38 -0
- data/features/html/modal_2.html +27 -0
- data/features/html/movie.mp4 +0 -0
- data/features/html/movie.ogg +0 -0
- data/features/html/multi_elements.html +144 -0
- data/features/html/nested_elements.html +77 -0
- data/features/html/nested_frame_1.html +1 -0
- data/features/html/nested_frame_2.html +11 -0
- data/features/html/nested_frame_3.html +14 -0
- data/features/html/nested_frames.html +10 -0
- data/features/html/planets.gif +0 -0
- data/features/html/static_elements.html +207 -0
- data/features/html/success.html +8 -0
- data/features/html/sun.gif +0 -0
- data/features/html/sun.html +7 -0
- data/features/image.feature +50 -0
- data/features/indexed_property.feature +117 -0
- data/features/javascript.feature +28 -0
- data/features/label.feature +46 -0
- data/features/link.feature +52 -0
- data/features/list_item.feature +36 -0
- data/features/modal_dialog.feature +15 -0
- data/features/multi_elements.feature +492 -0
- data/features/nested_elements.feature +117 -0
- data/features/ordered_list.feature +56 -0
- data/features/page_level_actions.feature +90 -0
- data/features/paragraph.feature +35 -0
- data/features/radio_button.feature +58 -0
- data/features/radio_button_group.feature +29 -0
- data/features/sample-app/public/jquery-1.3.2.js +4376 -0
- data/features/sample-app/public/jquery.html +30 -0
- data/features/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/features/sample-app/public/prototype.html +35 -0
- data/features/sample-app/sample_app.rb +35 -0
- data/features/section.feature +132 -0
- data/features/select_list.feature +86 -0
- data/features/span.feature +37 -0
- data/features/step_definitions/accessor_steps.rb +64 -0
- data/features/step_definitions/area_steps.rb +19 -0
- data/features/step_definitions/async_steps.rb +83 -0
- data/features/step_definitions/audio_steps.rb +27 -0
- data/features/step_definitions/bold_steps.rb +12 -0
- data/features/step_definitions/button_steps.rb +48 -0
- data/features/step_definitions/canvas_steps.rb +15 -0
- data/features/step_definitions/check_box_steps.rb +35 -0
- data/features/step_definitions/div_steps.rb +19 -0
- data/features/step_definitions/element_steps.rb +266 -0
- data/features/step_definitions/file_field_steps.rb +19 -0
- data/features/step_definitions/form_steps.rb +19 -0
- data/features/step_definitions/frames_steps.rb +159 -0
- data/features/step_definitions/generic_element_steps.rb +31 -0
- data/features/step_definitions/gxt_table_steps.rb +58 -0
- data/features/step_definitions/headings_steps.rb +12 -0
- data/features/step_definitions/hidden_field_steps.rb +27 -0
- data/features/step_definitions/image_steps.rb +27 -0
- data/features/step_definitions/indexed_property_steps.rb +163 -0
- data/features/step_definitions/javascript_steps.rb +53 -0
- data/features/step_definitions/label_steps.rb +19 -0
- data/features/step_definitions/link_steps.rb +40 -0
- data/features/step_definitions/list_item_steps.rb +19 -0
- data/features/step_definitions/modal_dialog_steps.rb +62 -0
- data/features/step_definitions/multi_elements_steps.rb +541 -0
- data/features/step_definitions/nested_elements_steps.rb +212 -0
- data/features/step_definitions/ordered_list_steps.rb +23 -0
- data/features/step_definitions/page_level_actions_steps.rb +135 -0
- data/features/step_definitions/page_traversal_steps.rb +4 -0
- data/features/step_definitions/paragraph_steps.rb +28 -0
- data/features/step_definitions/radio_button_group_steps.rb +36 -0
- data/features/step_definitions/radio_button_steps.rb +27 -0
- data/features/step_definitions/section_steps.rb +268 -0
- data/features/step_definitions/select_list_steps.rb +65 -0
- data/features/step_definitions/span_steps.rb +19 -0
- data/features/step_definitions/table_cell_steps.rb +15 -0
- data/features/step_definitions/table_row_steps.rb +23 -0
- data/features/step_definitions/table_steps.rb +70 -0
- data/features/step_definitions/text_area_steps.rb +35 -0
- data/features/step_definitions/text_field_steps.rb +35 -0
- data/features/step_definitions/unordered_list_steps.rb +23 -0
- data/features/step_definitions/video_steps.rb +45 -0
- data/features/support/ajax_text_environment.rb +26 -0
- data/features/support/env.rb +8 -0
- data/features/support/hooks.rb +8 -0
- data/features/support/page.rb +382 -0
- data/features/support/persistent_browser.rb +70 -0
- data/features/support/targets/firefox14_osx.rb +6 -0
- data/features/support/targets/firefox14_windows7.rb +6 -0
- data/features/support/url_helper.rb +57 -0
- data/features/table.feature +122 -0
- data/features/table_cell.feature +45 -0
- data/features/table_row.feature +43 -0
- data/features/text_area.feature +51 -0
- data/features/text_field.feature +70 -0
- data/features/unordered_list.feature +56 -0
- data/features/video.feature +73 -0
- data/lib/page-object.rb +421 -0
- data/lib/page-object/accessors.rb +1412 -0
- data/lib/page-object/core_ext/string.rb +5 -0
- data/lib/page-object/element_locators.rb +21 -0
- data/lib/page-object/elements.rb +60 -0
- data/lib/page-object/elements/area.rb +31 -0
- data/lib/page-object/elements/audio.rb +9 -0
- data/lib/page-object/elements/bold.rb +11 -0
- data/lib/page-object/elements/button.rb +35 -0
- data/lib/page-object/elements/canvas.rb +23 -0
- data/lib/page-object/elements/check_box.rb +37 -0
- data/lib/page-object/elements/div.rb +19 -0
- data/lib/page-object/elements/element.rb +226 -0
- data/lib/page-object/elements/file_field.rb +38 -0
- data/lib/page-object/elements/form.rb +36 -0
- data/lib/page-object/elements/heading.rb +15 -0
- data/lib/page-object/elements/hidden_field.rb +22 -0
- data/lib/page-object/elements/image.rb +36 -0
- data/lib/page-object/elements/label.rb +19 -0
- data/lib/page-object/elements/link.rb +46 -0
- data/lib/page-object/elements/list_item.rb +19 -0
- data/lib/page-object/elements/media.rb +45 -0
- data/lib/page-object/elements/option.rb +10 -0
- data/lib/page-object/elements/ordered_list.rb +50 -0
- data/lib/page-object/elements/paragraph.rb +9 -0
- data/lib/page-object/elements/radio_button.rb +37 -0
- data/lib/page-object/elements/select_list.rb +42 -0
- data/lib/page-object/elements/span.rb +19 -0
- data/lib/page-object/elements/table.rb +79 -0
- data/lib/page-object/elements/table_cell.rb +28 -0
- data/lib/page-object/elements/table_row.rb +50 -0
- data/lib/page-object/elements/text_area.rb +38 -0
- data/lib/page-object/elements/text_field.rb +42 -0
- data/lib/page-object/elements/unordered_list.rb +51 -0
- data/lib/page-object/elements/video.rb +18 -0
- data/lib/page-object/indexed_properties.rb +40 -0
- data/lib/page-object/javascript/angularjs.rb +14 -0
- data/lib/page-object/javascript/jquery.rb +14 -0
- data/lib/page-object/javascript/prototype.rb +14 -0
- data/lib/page-object/javascript/yui.rb +19 -0
- data/lib/page-object/javascript_framework_facade.rb +80 -0
- data/lib/page-object/loads_platform.rb +45 -0
- data/lib/page-object/locator_generator.rb +131 -0
- data/lib/page-object/nested_elements.rb +17 -0
- data/lib/page-object/page_factory.rb +108 -0
- data/lib/page-object/page_populator.rb +83 -0
- data/lib/page-object/platforms.rb +18 -0
- data/lib/page-object/platforms/selenium_webdriver.rb +30 -0
- data/lib/page-object/platforms/selenium_webdriver/button.rb +15 -0
- data/lib/page-object/platforms/selenium_webdriver/check_box.rb +29 -0
- data/lib/page-object/platforms/selenium_webdriver/element.rb +291 -0
- data/lib/page-object/platforms/selenium_webdriver/file_field.rb +16 -0
- data/lib/page-object/platforms/selenium_webdriver/form.rb +16 -0
- data/lib/page-object/platforms/selenium_webdriver/image.rb +28 -0
- data/lib/page-object/platforms/selenium_webdriver/link.rb +23 -0
- data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +39 -0
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +1237 -0
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +22 -0
- data/lib/page-object/platforms/selenium_webdriver/select_list.rb +93 -0
- data/lib/page-object/platforms/selenium_webdriver/surrogate_selenium_element.rb +42 -0
- data/lib/page-object/platforms/selenium_webdriver/table.rb +42 -0
- data/lib/page-object/platforms/selenium_webdriver/table_row.rb +43 -0
- data/lib/page-object/platforms/selenium_webdriver/text_area.rb +17 -0
- data/lib/page-object/platforms/selenium_webdriver/text_field.rb +17 -0
- data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +39 -0
- data/lib/page-object/platforms/watir_webdriver.rb +30 -0
- data/lib/page-object/platforms/watir_webdriver/check_box.rb +29 -0
- data/lib/page-object/platforms/watir_webdriver/element.rb +249 -0
- data/lib/page-object/platforms/watir_webdriver/file_field.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/form.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/image.rb +22 -0
- data/lib/page-object/platforms/watir_webdriver/link.rb +15 -0
- data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +35 -0
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +1082 -0
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +22 -0
- data/lib/page-object/platforms/watir_webdriver/select_list.rb +74 -0
- data/lib/page-object/platforms/watir_webdriver/table.rb +38 -0
- data/lib/page-object/platforms/watir_webdriver/table_row.rb +37 -0
- data/lib/page-object/platforms/watir_webdriver/text_area.rb +23 -0
- data/lib/page-object/platforms/watir_webdriver/text_field.rb +16 -0
- data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +36 -0
- data/lib/page-object/sections.rb +29 -0
- data/lib/page-object/version.rb +4 -0
- data/lib/page-object/widgets.rb +133 -0
- data/page_object.gemspec +31 -0
- data/pageobject.gems +1 -0
- data/spec/page-object/accessors_spec.rb +40 -0
- data/spec/page-object/element_locators_spec.rb +1122 -0
- data/spec/page-object/elements/area_spec.rb +45 -0
- data/spec/page-object/elements/bold_spec.rb +29 -0
- data/spec/page-object/elements/button_spec.rb +64 -0
- data/spec/page-object/elements/canvas_spec.rb +40 -0
- data/spec/page-object/elements/check_box_spec.rb +49 -0
- data/spec/page-object/elements/div_spec.rb +28 -0
- data/spec/page-object/elements/element_spec.rb +114 -0
- data/spec/page-object/elements/file_field_spec.rb +39 -0
- data/spec/page-object/elements/form_spec.rb +28 -0
- data/spec/page-object/elements/heading_spec.rb +48 -0
- data/spec/page-object/elements/hidden_field_spec.rb +28 -0
- data/spec/page-object/elements/image_spec.rb +66 -0
- data/spec/page-object/elements/label_spec.rb +29 -0
- data/spec/page-object/elements/link_spec.rb +49 -0
- data/spec/page-object/elements/list_item_spec.rb +29 -0
- data/spec/page-object/elements/nested_element_spec.rb +254 -0
- data/spec/page-object/elements/option_spec.rb +11 -0
- data/spec/page-object/elements/ordered_list_spec.rb +94 -0
- data/spec/page-object/elements/paragraph_spec.rb +27 -0
- data/spec/page-object/elements/select_list_spec.rb +142 -0
- data/spec/page-object/elements/selenium/radio_button_spec.rb +44 -0
- data/spec/page-object/elements/selenium/text_field_spec.rb +49 -0
- data/spec/page-object/elements/selenium_element_spec.rb +177 -0
- data/spec/page-object/elements/span_spec.rb +26 -0
- data/spec/page-object/elements/table_cell_spec.rb +21 -0
- data/spec/page-object/elements/table_row_spec.rb +70 -0
- data/spec/page-object/elements/table_spec.rb +98 -0
- data/spec/page-object/elements/text_area_spec.rb +39 -0
- data/spec/page-object/elements/unordered_list_spec.rb +94 -0
- data/spec/page-object/elements/watir_element_spec.rb +145 -0
- data/spec/page-object/javascript_framework_facade_spec.rb +61 -0
- data/spec/page-object/loads_platform_spec.rb +53 -0
- data/spec/page-object/page-object_spec.rb +407 -0
- data/spec/page-object/page_factory_spec.rb +238 -0
- data/spec/page-object/page_populator_spec.rb +122 -0
- data/spec/page-object/page_section_spec.rb +73 -0
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +68 -0
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +29 -0
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +29 -0
- data/spec/page-object/platforms/watir_webdriver_spec.rb +9 -0
- data/spec/page-object/selenium_accessors_spec.rb +609 -0
- data/spec/page-object/watir_accessors_spec.rb +1134 -0
- data/spec/page-object/widget_spec.rb +226 -0
- data/spec/spec_helper.rb +47 -0
- metadata +601 -0
data/pageobject.gems
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bundler
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -0,0 +1,1122 @@
|
|
|
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
|
+
end
|
|
731
|
+
|
|
732
|
+
context "when using Selenium" do
|
|
733
|
+
let(:selenium_browser) { mock_selenium_browser }
|
|
734
|
+
let(:selenium_page_object) { ElementLocatorsTestPageObject.new(selenium_browser) }
|
|
735
|
+
|
|
736
|
+
it "should find a button element" do
|
|
737
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
738
|
+
element = selenium_page_object.button_element(:id => 'blah')
|
|
739
|
+
expect(element).to be_instance_of PageObject::Elements::Button
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
it "should find all button elements" do
|
|
743
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
744
|
+
elements = selenium_page_object.button_elements(:id => 'blah')
|
|
745
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Button
|
|
746
|
+
end
|
|
747
|
+
|
|
748
|
+
it "should find a text field element" do
|
|
749
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
750
|
+
element = selenium_page_object.text_field_element(:id => 'blah')
|
|
751
|
+
expect(element).to be_instance_of PageObject::Elements::TextField
|
|
752
|
+
end
|
|
753
|
+
|
|
754
|
+
it "should find all text field elements" do
|
|
755
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
756
|
+
elements = selenium_page_object.text_field_elements(:id => 'blah')
|
|
757
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TextField
|
|
758
|
+
end
|
|
759
|
+
|
|
760
|
+
it "should find a hidden field element" do
|
|
761
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
762
|
+
element = selenium_page_object.hidden_field_element(:id => 'blah')
|
|
763
|
+
expect(element).to be_instance_of PageObject::Elements::HiddenField
|
|
764
|
+
end
|
|
765
|
+
|
|
766
|
+
it "should find all hidden field elements" do
|
|
767
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
|
768
|
+
elements = selenium_page_object.hidden_field_elements(:id => 'blah')
|
|
769
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::HiddenField
|
|
770
|
+
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
it "should find a text area element" do
|
|
774
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
775
|
+
element = selenium_page_object.text_area_element(:id => 'blah')
|
|
776
|
+
expect(element).to be_instance_of PageObject::Elements::TextArea
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
it "should find all text area elements" do
|
|
780
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
781
|
+
elements = selenium_page_object.text_area_elements(:id => 'blah')
|
|
782
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
|
|
783
|
+
end
|
|
784
|
+
|
|
785
|
+
it "should find a select list element" do
|
|
786
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
787
|
+
element = selenium_page_object.select_list_element(:id => 'blah')
|
|
788
|
+
expect(element).to be_instance_of PageObject::Elements::SelectList
|
|
789
|
+
end
|
|
790
|
+
|
|
791
|
+
it "should find all select list elements" do
|
|
792
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
793
|
+
elements = selenium_page_object.select_list_elements(:id => 'blah')
|
|
794
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
|
|
795
|
+
end
|
|
796
|
+
|
|
797
|
+
it "should find a link element" do
|
|
798
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
799
|
+
element = selenium_page_object.link_element(:id => 'blah')
|
|
800
|
+
expect(element).to be_instance_of PageObject::Elements::Link
|
|
801
|
+
end
|
|
802
|
+
|
|
803
|
+
it "should find all link elements" do
|
|
804
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
805
|
+
elements = selenium_page_object.link_elements(:id => 'blah')
|
|
806
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Link
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
it "should find a check box" do
|
|
810
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
811
|
+
element = selenium_page_object.checkbox_element(:id => 'blah')
|
|
812
|
+
expect(element).to be_instance_of PageObject::Elements::CheckBox
|
|
813
|
+
end
|
|
814
|
+
|
|
815
|
+
it "should find all checkbox elements" do
|
|
816
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
817
|
+
elements = selenium_page_object.checkbox_elements(:id => 'blah')
|
|
818
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
it "should find a radio button" do
|
|
822
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
823
|
+
element = selenium_page_object.radio_button_element(:id => 'blah')
|
|
824
|
+
expect(element).to be_instance_of PageObject::Elements::RadioButton
|
|
825
|
+
end
|
|
826
|
+
|
|
827
|
+
it "should find all radio button elements" do
|
|
828
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
829
|
+
elements = selenium_page_object.radio_button_elements(:id => 'blah')
|
|
830
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
it "should find a div" do
|
|
834
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
835
|
+
element = selenium_page_object.div_element(:id => 'blah')
|
|
836
|
+
expect(element).to be_instance_of PageObject::Elements::Div
|
|
837
|
+
end
|
|
838
|
+
|
|
839
|
+
it "should find all div elements" do
|
|
840
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
841
|
+
elements = selenium_page_object.div_elements(:id => 'blah')
|
|
842
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Div
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
it "should find a span" do
|
|
846
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
847
|
+
element = selenium_page_object.span_element(:id => 'blah')
|
|
848
|
+
expect(element).to be_instance_of PageObject::Elements::Span
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
it "should find all span elements" do
|
|
852
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
853
|
+
elements = selenium_page_object.span_elements(:id => 'blah')
|
|
854
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Span
|
|
855
|
+
end
|
|
856
|
+
|
|
857
|
+
it "should find a table" do
|
|
858
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
859
|
+
element = selenium_page_object.table_element(:id => 'blah')
|
|
860
|
+
expect(element).to be_instance_of PageObject::Elements::Table
|
|
861
|
+
end
|
|
862
|
+
|
|
863
|
+
it "should find all table elements" do
|
|
864
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
865
|
+
elements = selenium_page_object.table_elements(:id => 'blah')
|
|
866
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Table
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
it "should find a table cell" do
|
|
870
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
871
|
+
element = selenium_page_object.cell_element(:id => 'blah')
|
|
872
|
+
expect(element).to be_instance_of PageObject::Elements::TableCell
|
|
873
|
+
end
|
|
874
|
+
|
|
875
|
+
it "should find all table cell elements" do
|
|
876
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
877
|
+
elements = selenium_page_object.cell_elements(:id => 'blah')
|
|
878
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
|
|
879
|
+
end
|
|
880
|
+
|
|
881
|
+
it "should find an image" do
|
|
882
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
883
|
+
element = selenium_page_object.image_element(:id => 'blah')
|
|
884
|
+
expect(element).to be_instance_of PageObject::Elements::Image
|
|
885
|
+
end
|
|
886
|
+
|
|
887
|
+
it "should find all image elements" do
|
|
888
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
889
|
+
elements = selenium_page_object.image_elements(:id => 'blah')
|
|
890
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Image
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
it "should find a form" do
|
|
894
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
895
|
+
element = selenium_page_object.form_element(:id => 'blah')
|
|
896
|
+
expect(element).to be_instance_of PageObject::Elements::Form
|
|
897
|
+
end
|
|
898
|
+
|
|
899
|
+
it "should find all forms" do
|
|
900
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
901
|
+
elements = selenium_page_object.form_elements(:id => 'blah')
|
|
902
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Form
|
|
903
|
+
end
|
|
904
|
+
|
|
905
|
+
it "should find a list item" do
|
|
906
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
907
|
+
element = selenium_page_object.list_item_element(:id => 'blah')
|
|
908
|
+
expect(element).to be_instance_of PageObject::Elements::ListItem
|
|
909
|
+
end
|
|
910
|
+
|
|
911
|
+
it "should find all list items" do
|
|
912
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
913
|
+
element = selenium_page_object.list_item_elements(:id => 'blah')
|
|
914
|
+
expect(element[0]).to be_instance_of PageObject::Elements::ListItem
|
|
915
|
+
end
|
|
916
|
+
|
|
917
|
+
it "should find an unordered list" do
|
|
918
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
919
|
+
element = selenium_page_object.unordered_list_element(:id => 'blah')
|
|
920
|
+
expect(element).to be_instance_of PageObject::Elements::UnorderedList
|
|
921
|
+
end
|
|
922
|
+
|
|
923
|
+
it "should find all unordered lists" do
|
|
924
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
925
|
+
elements = selenium_page_object.unordered_list_elements(:id => 'blah')
|
|
926
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
|
|
927
|
+
end
|
|
928
|
+
|
|
929
|
+
it "should find an ordered list" do
|
|
930
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
931
|
+
element = selenium_page_object.ordered_list_element(:id => 'blah')
|
|
932
|
+
expect(element).to be_instance_of PageObject::Elements::OrderedList
|
|
933
|
+
end
|
|
934
|
+
|
|
935
|
+
it "should find all orderd list elements" do
|
|
936
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
937
|
+
elements = selenium_page_object.ordered_list_elements(:id => 'blah')
|
|
938
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
|
|
939
|
+
end
|
|
940
|
+
|
|
941
|
+
it "should find a h1 element" do
|
|
942
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
943
|
+
element = selenium_page_object.h1_element(:id => 'blah')
|
|
944
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
945
|
+
end
|
|
946
|
+
|
|
947
|
+
it "should find all h1 elements" do
|
|
948
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
|
|
949
|
+
elements = selenium_page_object.h1_elements(:id => 'blah')
|
|
950
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
951
|
+
end
|
|
952
|
+
|
|
953
|
+
it "should find a h2 element" do
|
|
954
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
955
|
+
element = selenium_page_object.h2_element(:id => 'blah')
|
|
956
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
957
|
+
end
|
|
958
|
+
|
|
959
|
+
it "should find all h2 elements" do
|
|
960
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
961
|
+
elements = selenium_page_object.h2_elements(:id => 'blah')
|
|
962
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
it "should find a h3 element" do
|
|
966
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
967
|
+
element = selenium_page_object.h3_element(:id => 'blah')
|
|
968
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
969
|
+
end
|
|
970
|
+
|
|
971
|
+
it "should find all h3 elements" do
|
|
972
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
973
|
+
elements = selenium_page_object.h3_elements(:id => 'blah')
|
|
974
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
975
|
+
end
|
|
976
|
+
|
|
977
|
+
it "should find a h4 element" do
|
|
978
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
979
|
+
element = selenium_page_object.h4_element(:id => 'blah')
|
|
980
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
981
|
+
end
|
|
982
|
+
|
|
983
|
+
it "should find all h4 elements" do
|
|
984
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
985
|
+
elements = selenium_page_object.h4_elements(:id => 'blah')
|
|
986
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
987
|
+
end
|
|
988
|
+
|
|
989
|
+
it "should find a h5 element" do
|
|
990
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
991
|
+
element = selenium_page_object.h5_element(:id => 'blah')
|
|
992
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
993
|
+
end
|
|
994
|
+
|
|
995
|
+
it "should find all h5 elements" do
|
|
996
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
997
|
+
elements = selenium_page_object.h5_elements(:id => 'blah')
|
|
998
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
999
|
+
end
|
|
1000
|
+
|
|
1001
|
+
it "should find a h6 element" do
|
|
1002
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1003
|
+
element = selenium_page_object.h6_element(:id => 'blah')
|
|
1004
|
+
expect(element).to be_instance_of PageObject::Elements::Heading
|
|
1005
|
+
end
|
|
1006
|
+
|
|
1007
|
+
it "should find all h6 elements" do
|
|
1008
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1009
|
+
elements = selenium_page_object.h6_elements(:id => 'blah')
|
|
1010
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Heading
|
|
1011
|
+
end
|
|
1012
|
+
|
|
1013
|
+
it "should find a paragraph element" do
|
|
1014
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1015
|
+
element = selenium_page_object.paragraph_element(:id => 'blah')
|
|
1016
|
+
expect(element).to be_instance_of PageObject::Elements::Paragraph
|
|
1017
|
+
end
|
|
1018
|
+
|
|
1019
|
+
it "should find all paragraph elements" do
|
|
1020
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1021
|
+
elements = selenium_page_object.paragraph_elements(:id => 'blah')
|
|
1022
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
|
|
1023
|
+
end
|
|
1024
|
+
|
|
1025
|
+
it "should find a label" do
|
|
1026
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1027
|
+
element = selenium_page_object.label_element(:id => 'blah')
|
|
1028
|
+
expect(element).to be_instance_of PageObject::Elements::Label
|
|
1029
|
+
end
|
|
1030
|
+
|
|
1031
|
+
it "should find all label elements" do
|
|
1032
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1033
|
+
elements = selenium_page_object.label_elements(:id => 'blah')
|
|
1034
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Label
|
|
1035
|
+
end
|
|
1036
|
+
|
|
1037
|
+
it "should find a file field element" do
|
|
1038
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1039
|
+
element = selenium_page_object.file_field_element(:id => 'blah')
|
|
1040
|
+
expect(element).to be_instance_of PageObject::Elements::FileField
|
|
1041
|
+
end
|
|
1042
|
+
|
|
1043
|
+
it "should find an area element" do
|
|
1044
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1045
|
+
element = selenium_page_object.area_element(:id => 'blah')
|
|
1046
|
+
expect(element).to be_instance_of PageObject::Elements::Area
|
|
1047
|
+
end
|
|
1048
|
+
|
|
1049
|
+
it "should find an area element using a default identifier" do
|
|
1050
|
+
expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//area)[1]').and_return(selenium_browser)
|
|
1051
|
+
selenium_page_object.area_element
|
|
1052
|
+
end
|
|
1053
|
+
|
|
1054
|
+
it "should find all area elements" do
|
|
1055
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1056
|
+
elements = selenium_page_object.area_elements(:id => 'blah')
|
|
1057
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Area
|
|
1058
|
+
end
|
|
1059
|
+
|
|
1060
|
+
it "should find all areas with no identifier" do
|
|
1061
|
+
expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'area').and_return([selenium_browser])
|
|
1062
|
+
selenium_page_object.area_elements
|
|
1063
|
+
end
|
|
1064
|
+
|
|
1065
|
+
it "should find a canvas element" do
|
|
1066
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1067
|
+
element = selenium_page_object.canvas_element(:id => 'blah')
|
|
1068
|
+
expect(element).to be_instance_of PageObject::Elements::Canvas
|
|
1069
|
+
end
|
|
1070
|
+
|
|
1071
|
+
it "should find a canvas element using a default identifier" do
|
|
1072
|
+
expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//canvas)[1]').and_return(selenium_browser)
|
|
1073
|
+
selenium_page_object.canvas_element
|
|
1074
|
+
end
|
|
1075
|
+
|
|
1076
|
+
it "should find all canvas elements" do
|
|
1077
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1078
|
+
elements = selenium_page_object.canvas_elements(:id => 'blah')
|
|
1079
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Canvas
|
|
1080
|
+
end
|
|
1081
|
+
|
|
1082
|
+
it "should find all canvases with no identifier" do
|
|
1083
|
+
expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'canvas').and_return([selenium_browser])
|
|
1084
|
+
selenium_page_object.canvas_elements
|
|
1085
|
+
end
|
|
1086
|
+
|
|
1087
|
+
it "should find an audio element" do
|
|
1088
|
+
expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
|
|
1089
|
+
element = selenium_page_object.audio_element(:id => 'blah')
|
|
1090
|
+
expect(element).to be_instance_of PageObject::Elements::Audio
|
|
1091
|
+
end
|
|
1092
|
+
|
|
1093
|
+
it "should find an audio element using a default identifier" do
|
|
1094
|
+
expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//audio)[1]').and_return(selenium_browser)
|
|
1095
|
+
selenium_page_object.audio_element
|
|
1096
|
+
end
|
|
1097
|
+
|
|
1098
|
+
it "should find all audio elements" do
|
|
1099
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1100
|
+
elements = selenium_page_object.audio_elements(:id => 'blah')
|
|
1101
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Audio
|
|
1102
|
+
end
|
|
1103
|
+
|
|
1104
|
+
it "should find all audio elements with no identifier" do
|
|
1105
|
+
expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
|
|
1106
|
+
selenium_page_object.audio_elements
|
|
1107
|
+
end
|
|
1108
|
+
it "should find a b element" do
|
|
1109
|
+
expect(selenium_browser).to receive(:find_element).with(:id,'blah').and_return(selenium_browser)
|
|
1110
|
+
element = selenium_page_object.b_element(:id => 'blah')
|
|
1111
|
+
expect(element).to be_instance_of PageObject::Elements::Bold
|
|
1112
|
+
end
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
it "should find all b elements" do
|
|
1116
|
+
expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
|
|
1117
|
+
elements = selenium_page_object.b_elements(:id => 'blah')
|
|
1118
|
+
expect(elements[0]).to be_instance_of PageObject::Elements::Bold
|
|
1119
|
+
end
|
|
1120
|
+
|
|
1121
|
+
end
|
|
1122
|
+
end
|