page-object 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/.travis.yml +7 -2
  5. data/ChangeLog +14 -1
  6. data/Gemfile +4 -2
  7. data/README.md +2 -0
  8. data/Rakefile +5 -1
  9. data/features/async.feature +3 -12
  10. data/features/audio.feature +10 -14
  11. data/features/element.feature +21 -0
  12. data/features/gxt_table_extension.feature +1 -2
  13. data/features/html/multi_elements.html +11 -10
  14. data/features/html/static_elements.html +3 -16
  15. data/features/html/widgets.html +20 -0
  16. data/features/italic.feature +21 -0
  17. data/features/multi_elements.feature +28 -22
  18. data/features/sample-app/public/audio_video.html +23 -0
  19. data/features/step_definitions/audio_steps.rb +6 -6
  20. data/features/step_definitions/element_steps.rb +28 -0
  21. data/features/step_definitions/gxt_table_steps.rb +1 -6
  22. data/features/step_definitions/italic_steps.rb +12 -0
  23. data/features/step_definitions/multi_elements_steps.rb +13 -0
  24. data/features/step_definitions/page_traversal_steps.rb +4 -0
  25. data/features/step_definitions/table_row_steps.rb +23 -0
  26. data/features/step_definitions/video_steps.rb +3 -3
  27. data/features/support/audio_video_page.rb +24 -0
  28. data/features/support/page.rb +20 -20
  29. data/features/support/url_helper.rb +4 -0
  30. data/features/table_row.feature +43 -0
  31. data/features/video.feature +1 -5
  32. data/lib/page-object.rb +4 -0
  33. data/lib/page-object/accessors.rb +88 -4
  34. data/lib/page-object/elements.rb +2 -1
  35. data/lib/page-object/elements/element.rb +5 -5
  36. data/lib/page-object/elements/italic.rb +11 -0
  37. data/lib/page-object/elements/ordered_list.rb +1 -1
  38. data/lib/page-object/elements/unordered_list.rb +1 -1
  39. data/lib/page-object/locator_generator.rb +2 -0
  40. data/lib/page-object/platforms/selenium_webdriver/element.rb +37 -0
  41. data/lib/page-object/platforms/selenium_webdriver/ordered_list.rb +10 -8
  42. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +51 -1
  43. data/lib/page-object/platforms/selenium_webdriver/unordered_list.rb +7 -9
  44. data/lib/page-object/platforms/watir_webdriver/element.rb +45 -1
  45. data/lib/page-object/platforms/watir_webdriver/ordered_list.rb +9 -4
  46. data/lib/page-object/platforms/watir_webdriver/page_object.rb +81 -50
  47. data/lib/page-object/platforms/watir_webdriver/unordered_list.rb +11 -5
  48. data/lib/page-object/version.rb +1 -1
  49. data/lib/page-object/widgets.rb +1 -1
  50. data/page-object.gemspec +1 -0
  51. data/spec/page-object/element_locators_spec.rb +124 -80
  52. data/spec/page-object/elements/element_spec.rb +83 -1
  53. data/spec/page-object/elements/italic_spec.rb +29 -0
  54. data/spec/page-object/elements/media_spec.rb +63 -0
  55. data/spec/page-object/elements/ordered_list_spec.rb +6 -22
  56. data/spec/page-object/elements/selenium_element_spec.rb +41 -0
  57. data/spec/page-object/elements/unordered_list_spec.rb +4 -21
  58. data/spec/page-object/elements/video_spec.rb +27 -0
  59. data/spec/page-object/elements/watir_element_spec.rb +48 -0
  60. data/spec/page-object/selenium_accessors_spec.rb +28 -9
  61. data/spec/page-object/watir_accessors_spec.rb +57 -1
  62. data/spec/spec_helper.rb +3 -6
  63. metadata +39 -3
@@ -78,7 +78,8 @@ describe "Element" do
78
78
  end
79
79
 
80
80
  context "interaction with native element" do
81
- let(:native) { double('') }
81
+ let(:wd) { double('') }
82
+ let(:native) { double(wd: wd) }
82
83
  let(:element) { PageObject::Elements::Element.new(native, :platform => :watir_webdriver) }
83
84
 
84
85
  it "should check if native is enabled" do
@@ -110,5 +111,86 @@ describe "Element" do
110
111
  expect(native).to receive(:enabled?).and_return(false)
111
112
  expect(element).to be_disabled
112
113
  end
114
+
115
+ it "should know if a native is visible" do
116
+ expect(native).to receive(:present?).and_return(false)
117
+ expect(element.visible?).to eq(false)
118
+ end
119
+
120
+ it "should know if a native exists" do
121
+ expect(native).to receive(:exists?).and_return(true)
122
+ expect(element).to exist
123
+ end
124
+
125
+ it "should flash the native" do
126
+ expect(native).to receive(:flash)
127
+ element.flash
128
+ end
129
+
130
+ it "should inspect the native's text" do
131
+ expect(native).to receive(:text).and_return('My value is 42')
132
+ expect(element.text).to eq('My value is 42')
133
+ end
134
+
135
+ it "should inspect the native's html" do
136
+ expect(native).to receive(:html).and_return('<p>42</p>')
137
+ expect(element.html).to eq('<p>42</p>')
138
+ end
139
+
140
+ it "should inspect the native's value" do
141
+ expect(native).to receive(:html).and_return('42')
142
+ expect(element.html).to eq('42')
143
+ end
144
+
145
+ it "should inspect the native's tag name" do
146
+ expect(native).to receive(:attribute_value).and_return('bar')
147
+ expect(element.attribute('foo')).to eq('bar')
148
+ end
149
+
150
+ it "should fire the native's event" do
151
+ expect(native).to receive(:fire_event).with('hello')
152
+ element.fire_event('hello')
153
+ end
154
+
155
+ it "should hover" do
156
+ expect(native).to receive(:hover)
157
+ element.hover
158
+ end
159
+
160
+ it "should focus" do
161
+ expect(native).to receive(:focus)
162
+ element.focus
163
+ end
164
+
165
+ it "should select the native's text" do
166
+ expect(native).to receive(:select_text).with('hello')
167
+ element.select_text('hello')
168
+ end
169
+
170
+ it "should wait until present" do
171
+ expect(native).to receive(:wait_until_present).with(42)
172
+ element.wait_until_present(42)
173
+ end
174
+
175
+ it "should send keys" do
176
+ expect(native).to receive(:send_keys).with('foo bar')
177
+ element.send_keys('foo bar')
178
+ end
179
+
180
+ it "should clear" do
181
+ expect(native).to receive(:clear)
182
+ element.clear
183
+ end
184
+
185
+ it "should inspect the native's id" do
186
+ expect(native).to receive(:id).and_return('element123')
187
+ expect(element.id).to eq('element123')
188
+ end
189
+
190
+ it "should inspect the native's id" do
191
+ expect(wd).to receive(:location_once_scrolled_into_view)
192
+ expect(native).to receive(:wd).and_return(wd)
193
+ element.scroll_into_view
194
+ end
113
195
  end
114
196
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'page-object/elements'
3
+
4
+ describe PageObject::Elements::Italic do
5
+ let(:italic) { PageObject::Elements::Italic }
6
+
7
+ describe "when mapping how to find an element" do
8
+ it "should map watir types to same" do
9
+ [:class, :id, :index, :name, :xpath].each do |t|
10
+ identifier = italic.watir_identifier_for t => 'value'
11
+ expect(identifier.keys.first).to eql t
12
+ end
13
+ end
14
+
15
+ it "should map selenium types to same" do
16
+ [:class, :id, :index, :name, :xpath].each do |t|
17
+ key, value = italic.selenium_identifier_for t => 'value'
18
+ expect(key).to eql t
19
+ end
20
+ end
21
+ end
22
+
23
+ describe "interface" do
24
+
25
+ it "should register with tag :i" do
26
+ expect(::PageObject::Elements.element_class_for(:i)).to eql ::PageObject::Elements::Italic
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+ require 'page-object/elements'
3
+
4
+ describe PageObject::Elements::Media do
5
+
6
+ let(:media) { PageObject::Elements::Media.new(double(''), :platform => :watir_webdriver) }
7
+
8
+ it "should return autoplay" do
9
+ expect(media).to receive(:attribute).with(:autoplay).and_return(true)
10
+ expect(media.autoplay?).to eq(true)
11
+ end
12
+
13
+ it "should return controls" do
14
+ expect(media).to receive(:attribute).with(:controls).and_return(true)
15
+ expect(media.has_controls?).to eq(true)
16
+ end
17
+
18
+ it "should return paused" do
19
+ expect(media).to receive(:attribute).with(:paused).and_return(true)
20
+ expect(media.paused?).to eq(true)
21
+ end
22
+
23
+ it "should not return duration when not present" do
24
+ expect(media).to receive(:attribute).with(:duration).and_return(nil)
25
+ expect(media.duration).to eq(nil)
26
+ end
27
+
28
+ it "should return duration when present" do
29
+ expect(media).to receive(:attribute).with(:duration).and_return('1.405')
30
+ expect(media.duration).to eq(1.405)
31
+ end
32
+
33
+ it "should not return volume when not present" do
34
+ expect(media).to receive(:attribute).with(:volume).and_return(nil)
35
+ expect(media.volume).to eq(nil)
36
+ end
37
+
38
+ it "should return volume when present" do
39
+ expect(media).to receive(:attribute).with(:volume).and_return('3')
40
+ expect(media.volume).to eq(3)
41
+ end
42
+
43
+ it "should return ended" do
44
+ expect(media).to receive(:attribute).with(:ended).and_return(true)
45
+ expect(media.ended?).to eq(true)
46
+ end
47
+
48
+ it "should return seeking" do
49
+ expect(media).to receive(:attribute).with(:seeking).and_return(true)
50
+ expect(media.seeking?).to eq(true)
51
+ end
52
+
53
+ it "should return loop" do
54
+ expect(media).to receive(:attribute).with(:loop).and_return(true)
55
+ expect(media.loop?).to eq(true)
56
+ end
57
+
58
+ it "should return muted" do
59
+ expect(media).to receive(:attribute).with(:muted).and_return(true)
60
+ expect(media.muted?).to eq(true)
61
+ end
62
+
63
+ end
@@ -30,23 +30,14 @@ describe PageObject::Elements::OrderedList do
30
30
  context "for watir" do
31
31
  it "should return a list item when indexed" do
32
32
  ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :watir_webdriver)
33
- allow(ol_element).to receive(:ols).and_return([ol_element])
34
- allow(ol_element).to receive(:find_elements).and_return(ol_element)
35
- allow(ol_element).to receive(:map).and_return([ol_element])
36
- allow(ol_element).to receive(:parent).and_return(ol_element)
37
- allow(ol_element).to receive(:element).and_return(ol_element)
38
- allow(ol_element).to receive(:==).and_return(true)
33
+ expect(ol_element).to receive(:find_elements).
34
+ and_return([ol_element, ol_element])
39
35
  ol[1]
40
36
  end
41
37
 
42
38
  it "should know how many list items it contains" do
43
39
  ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :watir_webdriver)
44
- allow(ol_element).to receive(:ols).and_return([ol_element])
45
- allow(ol_element).to receive(:find_elements).and_return(ol_element)
46
- allow(ol_element).to receive(:map).and_return([ol_element])
47
- allow(ol_element).to receive(:parent).and_return(ol_element)
48
- allow(ol_element).to receive(:element).and_return(ol_element)
49
- allow(ol_element).to receive(:==).and_return(true)
40
+ expect(ol_element).to receive(:find_elements).and_return([ol_element])
50
41
  expect(ol.items).to eql 1
51
42
  end
52
43
 
@@ -63,21 +54,14 @@ describe PageObject::Elements::OrderedList do
63
54
  context "for selenium" do
64
55
  it "should return a list item when indexed" do
65
56
  ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :selenium_webdriver)
66
- expect(ol_element).to receive(:find_elements).and_return(ol_element)
67
- expect(ol_element).to receive(:map).and_return([ol_element])
68
- expect(ol_element).to receive(:parent).and_return(ol_element)
69
- expect(ol_element).to receive(:element).and_return(ol_element)
70
- expect(ol_element).to receive(:==).and_return(true)
57
+ expect(ol_element).to receive(:find_elements).
58
+ and_return([ol_element, ol_element])
71
59
  ol[1]
72
60
  end
73
61
 
74
62
  it "should know how many list items it contains" do
75
63
  ol = PageObject::Elements::OrderedList.new(ol_element, :platform => :selenium_webdriver)
76
- expect(ol_element).to receive(:find_elements).and_return(ol_element)
77
- expect(ol_element).to receive(:map).and_return([ol_element])
78
- expect(ol_element).to receive(:parent).and_return(ol_element)
79
- expect(ol_element).to receive(:element).and_return(ol_element)
80
- expect(ol_element).to receive(:==).and_return(true)
64
+ expect(ol_element).to receive(:find_elements).and_return([ol_element])
81
65
  expect(ol.items).to eql 1
82
66
  end
83
67
 
@@ -174,4 +174,45 @@ describe "Element for Selenium" do
174
174
  expect(@selenium_driver).to receive(:location_once_scrolled_into_view)
175
175
  @selenium_element.scroll_into_view
176
176
  end
177
+
178
+ it "should have a location" do
179
+ expect(@selenium_driver).to receive(:location)
180
+ @selenium_element.location
181
+ end
182
+
183
+ it "should have a size" do
184
+ expect(@selenium_driver).to receive(:size)
185
+ @selenium_element.size
186
+ end
187
+
188
+ it "should have a height" do
189
+ expect(@selenium_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
190
+ expect(@selenium_element.height).to eql 20
191
+ end
192
+
193
+ it "should have a width" do
194
+ expect(@selenium_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
195
+ expect(@selenium_element.width).to eql 30
196
+ end
197
+
198
+ it "should have a centre" do
199
+ expect(@selenium_driver).to receive(:location).and_return({'y' => 80, 'x' => 40})
200
+ expect(@selenium_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
201
+ expect(@selenium_element.centre).to include(
202
+ 'y' => 90,
203
+ 'x' => 55
204
+ )
205
+ end
206
+
207
+ it "should have a centre greater than y position" do
208
+ expect(@selenium_driver).to receive(:location).and_return({'y' => 80, 'x' => 40}).twice
209
+ expect(@selenium_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
210
+ expect(@selenium_element.centre['y']).to be > @selenium_element.location['y']
211
+ end
212
+
213
+ it "should have a centre greater than x position" do
214
+ expect(@selenium_driver).to receive(:location).and_return({'y' => 80, 'x' => 40}).twice
215
+ expect(@selenium_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
216
+ expect(@selenium_element.centre['x']).to be > @selenium_element.location['x']
217
+ end
177
218
  end
@@ -30,23 +30,14 @@ describe PageObject::Elements::UnorderedList do
30
30
  context "for watir" do
31
31
  it "should return a list item when indexed" do
32
32
  ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :watir_webdriver)
33
- allow(ul_element).to receive(:uls).and_return([ul_element])
34
33
  allow(ul_element).to receive(:find_elements).and_return(ul_element)
35
- allow(ul_element).to receive(:map).and_return([ul_element])
36
- allow(ul_element).to receive(:parent).and_return(ul_element)
37
- allow(ul_element).to receive(:element).and_return(ul_element)
38
- allow(ul_element).to receive(:==).and_return(true)
34
+ expect(ul_element).to receive(:[])
39
35
  ul[1]
40
36
  end
41
37
 
42
38
  it "should know how many items it contains" do
43
39
  ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :watir_webdriver)
44
- allow(ul_element).to receive(:uls).and_return([ul_element])
45
- allow(ul_element).to receive(:find_elements).and_return(ul_element)
46
- allow(ul_element).to receive(:map).and_return([ul_element])
47
- allow(ul_element).to receive(:parent).and_return(ul_element)
48
- allow(ul_element).to receive(:element).and_return(ul_element)
49
- allow(ul_element).to receive(:==).and_return(true)
40
+ allow(ul_element).to receive(:find_elements).and_return([ul_element])
50
41
  expect(ul.items).to eql 1
51
42
  end
52
43
 
@@ -63,21 +54,13 @@ describe PageObject::Elements::UnorderedList do
63
54
  context "for selenium" do
64
55
  it "should return a list item when indexed" do
65
56
  ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :selenium_webdriver)
66
- expect(ul_element).to receive(:find_elements).and_return(ul_element)
67
- expect(ul_element).to receive(:map).and_return([ul_element])
68
- expect(ul_element).to receive(:parent).and_return(ul_element)
69
- expect(ul_element).to receive(:element).and_return(ul_element)
70
- expect(ul_element).to receive(:==).and_return(true)
57
+ expect(ul_element).to receive(:find_elements).and_return([ul_element, ul_element])
71
58
  ul[1]
72
59
  end
73
60
 
74
61
  it "should know how many items it contains" do
75
62
  ul = PageObject::Elements::UnorderedList.new(ul_element, :platform => :selenium_webdriver)
76
- expect(ul_element).to receive(:find_elements).and_return(ul_element)
77
- expect(ul_element).to receive(:map).and_return([ul_element])
78
- expect(ul_element).to receive(:parent).and_return(ul_element)
79
- expect(ul_element).to receive(:element).and_return(ul_element)
80
- expect(ul_element).to receive(:==).and_return(true)
63
+ expect(ul_element).to receive(:find_elements).and_return([ul_element])
81
64
  expect(ul.items).to eql 1
82
65
  end
83
66
 
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'page-object/elements'
3
+
4
+ describe PageObject::Elements::ListItem do
5
+
6
+ let(:video) { PageObject::Elements::Video.new(double(''), :platform => :watir_webdriver) }
7
+
8
+ it "should return height when present" do
9
+ expect(video).to receive(:attribute).with(:height).and_return("20")
10
+ expect(video.height).to eq(20)
11
+ end
12
+
13
+ it "should not return height when not present" do
14
+ expect(video).to receive(:attribute).with(:height).and_return(nil)
15
+ expect(video.height).to eq(nil)
16
+ end
17
+
18
+ it "should return width when present" do
19
+ expect(video).to receive(:attribute).with(:width).and_return("20")
20
+ expect(video.width).to eq(20)
21
+ end
22
+
23
+ it "should not return width when not present" do
24
+ expect(video).to receive(:attribute).with(:width).and_return(nil)
25
+ expect(video.width).to eq(nil)
26
+ end
27
+ end
@@ -142,4 +142,52 @@ describe "Element for Watir" do
142
142
  expect(watir_driver).to receive(:location_once_scrolled_into_view)
143
143
  watir_element.scroll_into_view
144
144
  end
145
+
146
+ it "should know its location" do
147
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
148
+ expect(watir_driver).to receive(:location)
149
+ watir_element.location
150
+ end
151
+
152
+ it "should know its size" do
153
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
154
+ expect(watir_driver).to receive(:size)
155
+ watir_element.size
156
+ end
157
+
158
+ it "should have a height" do
159
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
160
+ expect(watir_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
161
+ expect(watir_element.height).to eql 20
162
+ end
163
+
164
+ it "should have a width" do
165
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
166
+ expect(watir_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
167
+ expect(watir_element.width).to eql 30
168
+ end
169
+
170
+ it "should have a centre" do
171
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
172
+ expect(watir_driver).to receive(:location).and_return({'y' => 80, 'x' => 40})
173
+ expect(watir_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
174
+ expect(watir_element.centre).to include(
175
+ 'y' => 90,
176
+ 'x' => 55
177
+ )
178
+ end
179
+
180
+ it "should have a centre greater than y position" do
181
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
182
+ expect(watir_driver).to receive(:location).and_return({'y' => 80, 'x' => 40}).twice
183
+ expect(watir_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
184
+ expect(watir_element.centre['y']).to be > watir_element.location['y']
185
+ end
186
+
187
+ it "should have a centre greater than x position" do
188
+ allow(watir_driver).to receive(:wd).and_return(watir_driver)
189
+ expect(watir_driver).to receive(:location).and_return({'y' => 80, 'x' => 40}).twice
190
+ expect(watir_driver).to receive(:size).and_return({'width' => 30, 'height' => 20})
191
+ expect(watir_element.centre['x']).to be > watir_element.location['x']
192
+ end
145
193
  end
@@ -35,7 +35,8 @@ class SeleniumAccessorsTestPageObject
35
35
  canvas(:my_canvas, :id => 'canvas')
36
36
  audio(:acdc, :id => 'audio_id')
37
37
  video(:movie, :id => 'movie_id')
38
- b(:bold, :id=>'bold')
38
+ b(:bold, :id => 'bold')
39
+ i(:italic, :id => 'italic')
39
40
  end
40
41
 
41
42
  class SeleniumBlockPageObject
@@ -134,13 +135,17 @@ class SeleniumBlockPageObject
134
135
  b :bold do |element|
135
136
  'b'
136
137
  end
138
+
139
+ i :italic do |element|
140
+ 'i'
141
+ end
137
142
  end
138
143
 
139
144
  describe PageObject::Accessors do
140
145
  let(:selenium_browser) { mock_selenium_browser }
141
146
  let(:selenium_page_object) { SeleniumAccessorsTestPageObject.new(selenium_browser) }
142
147
  let(:block_page_object) { SeleniumBlockPageObject.new(selenium_browser) }
143
-
148
+
144
149
  before(:each) do
145
150
  allow(selenium_browser).to receive(:switch_to).and_return(selenium_browser)
146
151
  allow(selenium_browser).to receive(:default_content)
@@ -241,7 +246,7 @@ describe PageObject::Accessors do
241
246
  element = selenium_page_object.state_element
242
247
  expect(element).to be_instance_of PageObject::Elements::SelectList
243
248
  end
244
-
249
+
245
250
  it "should return list of selection options" do
246
251
  option1 = double('option')
247
252
  option2 = double('option')
@@ -251,10 +256,10 @@ describe PageObject::Accessors do
251
256
  select_element = double("select")
252
257
  expect(select_element).to receive(:options).twice.and_return([option1, option2])
253
258
  expect(selenium_page_object).to receive(:state_element).and_return(select_element)
254
-
259
+
255
260
  expect(selenium_page_object.state_options).to eql ["CA","OH"]
256
261
  end
257
-
262
+
258
263
  end
259
264
 
260
265
 
@@ -417,21 +422,21 @@ describe PageObject::Accessors do
417
422
  expect(element).to be_instance_of PageObject::Elements::OrderedList
418
423
  end
419
424
  end
420
-
425
+
421
426
  describe "h1 accessors" do
422
427
  it "should retrieve the text from the h1" do
423
428
  expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
424
429
  expect(selenium_browser).to receive(:text).and_return("value")
425
430
  expect(selenium_page_object.heading1).to eql "value"
426
431
  end
427
-
432
+
428
433
  it "should retrieve the element from the page" do
429
434
  expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
430
435
  element = selenium_page_object.heading1_element
431
436
  expect(element).to be_instance_of PageObject::Elements::Heading
432
437
  end
433
438
  end
434
-
439
+
435
440
  describe "h2 accessors" do
436
441
  it "should retrieve the text from the h2" do
437
442
  expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
@@ -567,7 +572,7 @@ describe PageObject::Accessors do
567
572
  end
568
573
  end
569
574
  end
570
-
575
+
571
576
  describe "audio accessors" do
572
577
  context "when called on a page object" do
573
578
  it "should generate accessor methods" do
@@ -606,4 +611,18 @@ describe PageObject::Accessors do
606
611
  end
607
612
  end
608
613
 
614
+ describe "i accessors" do
615
+ it "should retrieve the text from the i" do
616
+ expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
617
+ expect(selenium_browser).to receive(:text).and_return("value")
618
+ expect(selenium_page_object.italic).to eql "value"
619
+ end
620
+
621
+ it "should retrieve the element from the page" do
622
+ expect(selenium_browser).to receive(:find_element).and_return(selenium_browser)
623
+ element = selenium_page_object.italic_element
624
+ expect(element).to be_instance_of PageObject::Elements::Italic
625
+ end
626
+ end
627
+
609
628
  end