page-object 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/ChangeLog +10 -0
- data/README.md +1 -1
- data/features/bold.feature +21 -0
- data/features/html/indexed_property.html +14 -0
- data/features/html/multi_elements.html +1 -1
- data/features/html/static_elements.html +1 -2
- data/features/indexed_property.feature +15 -0
- data/features/multi_elements.feature +6 -0
- data/features/step_definitions/async_steps.rb +1 -1
- data/features/step_definitions/bold_steps.rb +12 -0
- data/features/step_definitions/check_box_steps.rb +2 -2
- data/features/step_definitions/indexed_property_steps.rb +47 -1
- data/features/step_definitions/label_steps.rb +1 -1
- data/features/step_definitions/multi_elements_steps.rb +13 -0
- data/features/step_definitions/select_list_steps.rb +1 -1
- data/features/step_definitions/table_steps.rb +4 -0
- data/features/support/page.rb +9 -0
- data/features/table.feature +12 -4
- data/lib/page-object.rb +6 -5
- data/lib/page-object/accessors.rb +78 -58
- data/lib/page-object/elements.rb +1 -0
- data/lib/page-object/elements/bold.rb +11 -0
- data/lib/page-object/elements/element.rb +12 -1
- data/lib/page-object/elements/table.rb +12 -1
- data/lib/page-object/indexed_properties.rb +20 -21
- data/lib/page-object/javascript/angularjs.rb +14 -0
- data/lib/page-object/javascript_framework_facade.rb +4 -2
- data/lib/page-object/locator_generator.rb +1 -0
- data/lib/page-object/page_populator.rb +0 -1
- data/lib/page-object/platforms/selenium_webdriver/button.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/selenium_webdriver/page_object.rb +26 -10
- data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +0 -7
- data/lib/page-object/platforms/watir_webdriver/element.rb +1 -1
- data/lib/page-object/platforms/watir_webdriver/page_object.rb +23 -8
- data/lib/page-object/platforms/watir_webdriver/radio_button.rb +0 -7
- data/lib/page-object/version.rb +1 -1
- data/lib/page-object/widgets.rb +7 -0
- data/page-object.gemspec +3 -3
- data/spec/page-object/accessors_spec.rb +40 -0
- data/spec/page-object/element_locators_spec.rb +340 -305
- data/spec/page-object/elements/area_spec.rb +8 -8
- data/spec/page-object/elements/bold_spec.rb +29 -0
- data/spec/page-object/elements/button_spec.rb +7 -7
- data/spec/page-object/elements/canvas_spec.rb +6 -6
- data/spec/page-object/elements/check_box_spec.rb +9 -9
- data/spec/page-object/elements/div_spec.rb +3 -3
- data/spec/page-object/elements/element_spec.rb +21 -21
- data/spec/page-object/elements/file_field_spec.rb +4 -4
- data/spec/page-object/elements/form_spec.rb +3 -3
- data/spec/page-object/elements/heading_spec.rb +8 -8
- data/spec/page-object/elements/hidden_field_spec.rb +3 -3
- data/spec/page-object/elements/image_spec.rb +14 -14
- data/spec/page-object/elements/label_spec.rb +3 -3
- data/spec/page-object/elements/link_spec.rb +6 -6
- data/spec/page-object/elements/list_item_spec.rb +4 -3
- data/spec/page-object/elements/nested_element_spec.rb +47 -47
- data/spec/page-object/elements/option_spec.rb +1 -1
- data/spec/page-object/elements/ordered_list_spec.rb +33 -33
- data/spec/page-object/elements/paragraph_spec.rb +3 -4
- data/spec/page-object/elements/select_list_spec.rb +52 -52
- data/spec/page-object/elements/selenium/radio_button_spec.rb +7 -13
- data/spec/page-object/elements/selenium/text_field_spec.rb +7 -7
- data/spec/page-object/elements/selenium_element_spec.rb +53 -53
- data/spec/page-object/elements/span_spec.rb +3 -3
- data/spec/page-object/elements/table_cell_spec.rb +3 -3
- data/spec/page-object/elements/table_row_spec.rb +22 -22
- data/spec/page-object/elements/table_spec.rb +28 -28
- data/spec/page-object/elements/text_area_spec.rb +5 -5
- data/spec/page-object/elements/unordered_list_spec.rb +33 -34
- data/spec/page-object/elements/watir_element_spec.rb +47 -48
- data/spec/page-object/javascript_framework_facade_spec.rb +6 -6
- data/spec/page-object/loads_platform_spec.rb +4 -4
- data/spec/page-object/page-object_spec.rb +103 -102
- data/spec/page-object/page_factory_spec.rb +43 -61
- data/spec/page-object/page_populator_spec.rb +44 -50
- data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +15 -15
- data/spec/page-object/platforms/selenium_webdriver_spec.rb +6 -6
- data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +4 -4
- data/spec/page-object/platforms/watir_webdriver_spec.rb +1 -1
- data/spec/page-object/selenium_accessors_spec.rb +166 -153
- data/spec/page-object/watir_accessors_spec.rb +265 -245
- data/spec/page-object/widget_spec.rb +62 -30
- data/spec/spec_helper.rb +8 -8
- metadata +20 -10
@@ -8,14 +8,14 @@ describe PageObject::Elements::Area do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :index, :name, :xpath].each do |t|
|
10
10
|
identifier = area.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
16
|
[:class, :id, :index, :name, :xpath].each do |t|
|
17
17
|
key, value = area.selenium_identifier_for t => 'value'
|
18
|
-
key.
|
18
|
+
expect(key).to eql t
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -27,18 +27,18 @@ describe PageObject::Elements::Area do
|
|
27
27
|
let(:selenium_area) { PageObject::Elements::Area.new(area_element, :platform => :selenium_webdriver) }
|
28
28
|
|
29
29
|
it "should know its coords" do
|
30
|
-
area_element.
|
31
|
-
selenium_area.coords.
|
30
|
+
expect(area_element).to receive(:attribute).with(:coords).and_return("1,2,3,4")
|
31
|
+
expect(selenium_area.coords).to eql "1,2,3,4"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should know its shape" do
|
35
|
-
area_element.
|
36
|
-
selenium_area.shape.
|
35
|
+
expect(area_element).to receive(:attribute).with(:shape).and_return('circle')
|
36
|
+
expect(selenium_area.shape).to eql 'circle'
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should know its href" do
|
40
|
-
area_element.
|
41
|
-
selenium_area.href.
|
40
|
+
expect(area_element).to receive(:attribute).with(:href).and_return('twitter.com')
|
41
|
+
expect(selenium_area.href).to eql 'twitter.com'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'page-object/elements'
|
3
|
+
|
4
|
+
describe PageObject::Elements::Bold do
|
5
|
+
let(:bold) { PageObject::Elements::Bold }
|
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 = bold.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 = bold.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 :b" do
|
26
|
+
expect(::PageObject::Elements.element_class_for(:b)).to eql ::PageObject::Elements::Bold
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -8,14 +8,14 @@ describe PageObject::Elements::Button do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :index, :name, :value, :xpath, :src, :alt, :css].each do |t|
|
10
10
|
identifier = button.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
16
|
[:class, :id, :index, :name, :value, :xpath, :src, :alt, :css].each do |t|
|
17
17
|
key, value = button.selenium_identifier_for t => 'value'
|
18
|
-
key.
|
18
|
+
expect(key).to eql t
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -24,25 +24,25 @@ describe PageObject::Elements::Button do
|
|
24
24
|
let(:button_element) { double('button_element') }
|
25
25
|
|
26
26
|
it "should register with type :submit" do
|
27
|
-
::PageObject::Elements.element_class_for(:input, :submit).
|
27
|
+
expect(::PageObject::Elements.element_class_for(:input, :submit)).to eql ::PageObject::Elements::Button
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should register with type :image" do
|
31
|
-
::PageObject::Elements.element_class_for(:input, :image).
|
31
|
+
expect(::PageObject::Elements.element_class_for(:input, :image)).to eql ::PageObject::Elements::Button
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should register with type :button" do
|
35
|
-
::PageObject::Elements.element_class_for(:input, :button).
|
35
|
+
expect(::PageObject::Elements.element_class_for(:input, :button)).to eql ::PageObject::Elements::Button
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should retisger with type :reset" do
|
39
|
-
::PageObject::Elements.element_class_for(:input, :reset).
|
39
|
+
expect(::PageObject::Elements.element_class_for(:input, :reset)).to eql ::PageObject::Elements::Button
|
40
40
|
end
|
41
41
|
|
42
42
|
context "for selenium" do
|
43
43
|
it "should return error when asked for its' text" do
|
44
44
|
button = PageObject::Elements::Button.new(button_element, :platform => :selenium_webdriver)
|
45
|
-
lambda { button.text }.
|
45
|
+
expect(lambda { button.text }).to raise_error
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -8,14 +8,14 @@ describe PageObject::Elements::Canvas do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :index, :name, :xpath].each do |t|
|
10
10
|
identifier = area.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
16
|
[:class, :id, :index, :name, :xpath].each do |t|
|
17
17
|
key, value = area.selenium_identifier_for t => 'value'
|
18
|
-
key.
|
18
|
+
expect(key).to eql t
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -27,13 +27,13 @@ describe PageObject::Elements::Canvas do
|
|
27
27
|
let(:selenium_canvas) { PageObject::Elements::Canvas.new(canvas_element, :platform => :selenium_webdriver) }
|
28
28
|
|
29
29
|
it "should know its width" do
|
30
|
-
canvas_element.
|
31
|
-
selenium_canvas.width.
|
30
|
+
expect(canvas_element).to receive(:attribute).with(:width).and_return("400")
|
31
|
+
expect(selenium_canvas.width).to eql 400
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should know its height" do
|
35
|
-
canvas_element.
|
36
|
-
selenium_canvas.height.
|
35
|
+
expect(canvas_element).to receive(:attribute).with(:height).and_return("100")
|
36
|
+
expect(selenium_canvas.height).to eql 100
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -8,13 +8,13 @@ describe PageObject::Elements::CheckBox do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :index, :name, :xpath, :value].each do |t|
|
10
10
|
identifier = checkbox.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
it "should map selenium types to same" do
|
15
15
|
[:class, :id, :name, :xpath, :index, :value].each do |t|
|
16
16
|
key, value = checkbox.selenium_identifier_for t => 'value'
|
17
|
-
key.
|
17
|
+
expect(key).to eql t
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -24,25 +24,25 @@ describe PageObject::Elements::CheckBox do
|
|
24
24
|
let(:selenium_cb) { PageObject::Elements::CheckBox.new(check_box, :platform => :selenium_webdriver) }
|
25
25
|
|
26
26
|
it "should register with type :checkbox" do
|
27
|
-
::PageObject::Elements.element_class_for(:input, :checkbox).
|
27
|
+
expect(::PageObject::Elements.element_class_for(:input, :checkbox)).to eql ::PageObject::Elements::CheckBox
|
28
28
|
end
|
29
29
|
|
30
30
|
context "for selenium" do
|
31
31
|
it "should check" do
|
32
|
-
check_box.
|
33
|
-
check_box.
|
32
|
+
expect(check_box).to receive(:click)
|
33
|
+
expect(check_box).to receive(:selected?).and_return(false)
|
34
34
|
selenium_cb.check
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should uncheck" do
|
38
|
-
check_box.
|
39
|
-
check_box.
|
38
|
+
expect(check_box).to receive(:click)
|
39
|
+
expect(check_box).to receive(:selected?).and_return(true)
|
40
40
|
selenium_cb.uncheck
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should know if it is checked" do
|
44
|
-
check_box.
|
45
|
-
selenium_cb.
|
44
|
+
expect(check_box).to receive(:selected?).and_return(true)
|
45
|
+
expect(selenium_cb).to be_checked
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -8,20 +8,20 @@ describe PageObject::Elements::Div do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :text, :index, :xpath, :name, :title, :css].each do |t|
|
10
10
|
identifier = div.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
16
|
[:class, :id, :text, :index, :name, :xpath, :title, :css].each do |t|
|
17
17
|
key, value = div.selenium_identifier_for t => 'value'
|
18
|
-
key.
|
18
|
+
expect(key).to eql t
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "interface" do
|
23
23
|
it "should register with tag :div" do
|
24
|
-
::PageObject::Elements.element_class_for(:div).
|
24
|
+
expect(::PageObject::Elements.element_class_for(:div)).to eql ::PageObject::Elements::Div
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -9,7 +9,7 @@ describe "Element" do
|
|
9
9
|
['table', 'span', 'div', 'td', 'li', 'ol', 'ul'].each do |tag|
|
10
10
|
how = {:tag_name => tag, :name => 'blah'}
|
11
11
|
result = PageObject::Elements::Element.watir_identifier_for how
|
12
|
-
result[:xpath].
|
12
|
+
expect(result[:xpath]).to eql ".//#{tag}[@name='blah']"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -27,8 +27,8 @@ describe "Element" do
|
|
27
27
|
all_basic_elements.each do |tag|
|
28
28
|
identifier = {:tag_name => tag, :index => 1}
|
29
29
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
30
|
-
how.
|
31
|
-
what.
|
30
|
+
expect(how).to eql :xpath
|
31
|
+
expect(what).to eql "(.//#{tag})[2]"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -36,8 +36,8 @@ describe "Element" do
|
|
36
36
|
all_input_elements.each do |tag|
|
37
37
|
identifier = {:tag_name => 'input', :type => tag, :index => 1}
|
38
38
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
39
|
-
how.
|
40
|
-
what.
|
39
|
+
expect(how).to eql :xpath
|
40
|
+
expect(what).to include "(.//input[@type='#{tag}'])[2]"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,8 +45,8 @@ describe "Element" do
|
|
45
45
|
all_basic_elements.each do |tag|
|
46
46
|
identifier = {:tag_name => tag, :name => 'blah', :index => 0}
|
47
47
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
48
|
-
how.
|
49
|
-
what.
|
48
|
+
expect(how).to eql :xpath
|
49
|
+
expect(what).to eql "(.//#{tag}[@name='blah'])[1]"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,8 +54,8 @@ describe "Element" do
|
|
54
54
|
all_input_elements.each do |type|
|
55
55
|
identifier = {:tag_name => 'input', :type => "#{type}", :name => 'blah', :index => 0}
|
56
56
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
57
|
-
how.
|
58
|
-
what.
|
57
|
+
expect(how).to eql :xpath
|
58
|
+
expect(what).to include "(.//input[@type='#{type}' and @name='blah'])[1]"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -63,8 +63,8 @@ describe "Element" do
|
|
63
63
|
all_basic_elements.each do |tag|
|
64
64
|
identifier = {:tag_name => tag, :class => 'bar', :name => 'foo'}
|
65
65
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
66
|
-
how.
|
67
|
-
what.
|
66
|
+
expect(how).to eql :xpath
|
67
|
+
expect(what).to eql ".//#{tag}[@class='bar' and @name='foo']"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -72,7 +72,7 @@ describe "Element" do
|
|
72
72
|
all_input_elements.each do |type|
|
73
73
|
identifier = {:tag_name => 'input', :type => "#{type}", :class => 'bar', :name => 'foo'}
|
74
74
|
how, what = PageObject::Elements::Element.selenium_identifier_for identifier
|
75
|
-
what.
|
75
|
+
expect(what).to include ".//input[@type='#{type}' and @class='bar' and @name='foo']"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -82,33 +82,33 @@ describe "Element" do
|
|
82
82
|
let(:element) { PageObject::Elements::Element.new(native, :platform => :watir_webdriver) }
|
83
83
|
|
84
84
|
it "should check if native is enabled" do
|
85
|
-
native.
|
86
|
-
element.
|
85
|
+
expect(native).to receive(:enabled?).and_return(true)
|
86
|
+
expect(element).to be_enabled
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should click the native" do
|
90
|
-
native.
|
90
|
+
expect(native).to receive(:click)
|
91
91
|
element.click
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should double click the native" do
|
95
|
-
native.
|
95
|
+
expect(native).to receive(:double_click)
|
96
96
|
element.double_click
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should inspect the native" do
|
100
|
-
native.
|
100
|
+
expect(native).to receive(:inspect)
|
101
101
|
element.inspect
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should retrieve the native's style" do
|
105
|
-
native.
|
106
|
-
element.style('foo').
|
105
|
+
expect(native).to receive(:style).with('foo').and_return("cheezy_style")
|
106
|
+
expect(element.style('foo')).to eql 'cheezy_style'
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should know if a native is disabled" do
|
110
|
-
native.
|
111
|
-
element.
|
110
|
+
expect(native).to receive(:enabled?).and_return(false)
|
111
|
+
expect(element).to be_disabled
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -9,14 +9,14 @@ describe PageObject::Elements::FileField do
|
|
9
9
|
it "should map watir types to same" do
|
10
10
|
[:class, :id, :index, :name, :xpath, :title].each do |t|
|
11
11
|
identifier = filefield.watir_identifier_for t => 'value'
|
12
|
-
identifier.keys.first.
|
12
|
+
expect(identifier.keys.first).to eql t
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should map selenium types to same" do
|
17
17
|
[:class, :id, :index, :name, :xpath, :title].each do |t|
|
18
18
|
key, value = filefield.selenium_identifier_for t => 'value'
|
19
|
-
key.
|
19
|
+
expect(key).to eql t
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -25,13 +25,13 @@ describe PageObject::Elements::FileField do
|
|
25
25
|
let(:filefield) { double('file_field') }
|
26
26
|
|
27
27
|
it "should register as type :file" do
|
28
|
-
::PageObject::Elements.element_class_for(:input, :file).
|
28
|
+
expect(::PageObject::Elements.element_class_for(:input, :file)).to eql ::PageObject::Elements::FileField
|
29
29
|
end
|
30
30
|
|
31
31
|
context "for selenium" do
|
32
32
|
it "should set its' value" do
|
33
33
|
selenium_file_field = PageObject::Elements::FileField.new(filefield, :platform => :selenium_webdriver)
|
34
|
-
filefield.
|
34
|
+
expect(filefield).to receive(:send_keys).with('a file')
|
35
35
|
selenium_file_field.value = 'a file'
|
36
36
|
end
|
37
37
|
end
|
@@ -6,13 +6,13 @@ describe PageObject::Elements::Form do
|
|
6
6
|
let(:form_element) { double('form_element') }
|
7
7
|
|
8
8
|
it "should register with tag_name :form" do
|
9
|
-
::PageObject::Elements.element_class_for(:form).
|
9
|
+
expect(::PageObject::Elements.element_class_for(:form)).to eql ::PageObject::Elements::Form
|
10
10
|
end
|
11
11
|
|
12
12
|
context "for watir" do
|
13
13
|
it "should submit a form" do
|
14
14
|
form = PageObject::Elements::Form.new(form_element, :platform => :watir_webdriver)
|
15
|
-
form_element.
|
15
|
+
expect(form_element).to receive(:submit)
|
16
16
|
form.submit
|
17
17
|
end
|
18
18
|
end
|
@@ -20,7 +20,7 @@ describe PageObject::Elements::Form do
|
|
20
20
|
context "for selenium" do
|
21
21
|
it "should submit a form" do
|
22
22
|
form = PageObject::Elements::Form.new(form_element, :platform => :selenium_webdriver)
|
23
|
-
form_element.
|
23
|
+
expect(form_element).to receive(:submit)
|
24
24
|
form.submit
|
25
25
|
end
|
26
26
|
end
|
@@ -8,41 +8,41 @@ describe PageObject::Elements::Heading do
|
|
8
8
|
it "should map watir types to same" do
|
9
9
|
[:class, :id, :index, :name, :xpath].each do |t|
|
10
10
|
identifier = heading.watir_identifier_for t => 'value'
|
11
|
-
identifier.keys.first.
|
11
|
+
expect(identifier.keys.first).to eql t
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should map selenium types to same" do
|
16
16
|
[:class, :id, :index, :name, :xpath].each do |t|
|
17
17
|
key, value = heading.selenium_identifier_for t => 'value'
|
18
|
-
key.
|
18
|
+
expect(key).to eql t
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "interface" do
|
24
24
|
it "should register with tag :h1" do
|
25
|
-
::PageObject::Elements.element_class_for(:h1).
|
25
|
+
expect(::PageObject::Elements.element_class_for(:h1)).to eql ::PageObject::Elements::Heading
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should register with tag :h2" do
|
29
|
-
::PageObject::Elements.element_class_for(:h2).
|
29
|
+
expect(::PageObject::Elements.element_class_for(:h2)).to eql ::PageObject::Elements::Heading
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should register with tag :h3" do
|
33
|
-
::PageObject::Elements.element_class_for(:h3).
|
33
|
+
expect(::PageObject::Elements.element_class_for(:h3)).to eql ::PageObject::Elements::Heading
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should register with tag :h4" do
|
37
|
-
::PageObject::Elements.element_class_for(:h4).
|
37
|
+
expect(::PageObject::Elements.element_class_for(:h4)).to eql ::PageObject::Elements::Heading
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should register with tag :h5" do
|
41
|
-
::PageObject::Elements.element_class_for(:h5).
|
41
|
+
expect(::PageObject::Elements.element_class_for(:h5)).to eql ::PageObject::Elements::Heading
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should register with tag :h6" do
|
45
|
-
::PageObject::Elements.element_class_for(:h6).
|
45
|
+
expect(::PageObject::Elements.element_class_for(:h6)).to eql ::PageObject::Elements::Heading
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|