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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +1 -0
  4. data/ChangeLog +10 -0
  5. data/README.md +1 -1
  6. data/features/bold.feature +21 -0
  7. data/features/html/indexed_property.html +14 -0
  8. data/features/html/multi_elements.html +1 -1
  9. data/features/html/static_elements.html +1 -2
  10. data/features/indexed_property.feature +15 -0
  11. data/features/multi_elements.feature +6 -0
  12. data/features/step_definitions/async_steps.rb +1 -1
  13. data/features/step_definitions/bold_steps.rb +12 -0
  14. data/features/step_definitions/check_box_steps.rb +2 -2
  15. data/features/step_definitions/indexed_property_steps.rb +47 -1
  16. data/features/step_definitions/label_steps.rb +1 -1
  17. data/features/step_definitions/multi_elements_steps.rb +13 -0
  18. data/features/step_definitions/select_list_steps.rb +1 -1
  19. data/features/step_definitions/table_steps.rb +4 -0
  20. data/features/support/page.rb +9 -0
  21. data/features/table.feature +12 -4
  22. data/lib/page-object.rb +6 -5
  23. data/lib/page-object/accessors.rb +78 -58
  24. data/lib/page-object/elements.rb +1 -0
  25. data/lib/page-object/elements/bold.rb +11 -0
  26. data/lib/page-object/elements/element.rb +12 -1
  27. data/lib/page-object/elements/table.rb +12 -1
  28. data/lib/page-object/indexed_properties.rb +20 -21
  29. data/lib/page-object/javascript/angularjs.rb +14 -0
  30. data/lib/page-object/javascript_framework_facade.rb +4 -2
  31. data/lib/page-object/locator_generator.rb +1 -0
  32. data/lib/page-object/page_populator.rb +0 -1
  33. data/lib/page-object/platforms/selenium_webdriver/button.rb +1 -1
  34. data/lib/page-object/platforms/selenium_webdriver/element.rb +1 -1
  35. data/lib/page-object/platforms/selenium_webdriver/page_object.rb +26 -10
  36. data/lib/page-object/platforms/selenium_webdriver/radio_button.rb +0 -7
  37. data/lib/page-object/platforms/watir_webdriver/element.rb +1 -1
  38. data/lib/page-object/platforms/watir_webdriver/page_object.rb +23 -8
  39. data/lib/page-object/platforms/watir_webdriver/radio_button.rb +0 -7
  40. data/lib/page-object/version.rb +1 -1
  41. data/lib/page-object/widgets.rb +7 -0
  42. data/page-object.gemspec +3 -3
  43. data/spec/page-object/accessors_spec.rb +40 -0
  44. data/spec/page-object/element_locators_spec.rb +340 -305
  45. data/spec/page-object/elements/area_spec.rb +8 -8
  46. data/spec/page-object/elements/bold_spec.rb +29 -0
  47. data/spec/page-object/elements/button_spec.rb +7 -7
  48. data/spec/page-object/elements/canvas_spec.rb +6 -6
  49. data/spec/page-object/elements/check_box_spec.rb +9 -9
  50. data/spec/page-object/elements/div_spec.rb +3 -3
  51. data/spec/page-object/elements/element_spec.rb +21 -21
  52. data/spec/page-object/elements/file_field_spec.rb +4 -4
  53. data/spec/page-object/elements/form_spec.rb +3 -3
  54. data/spec/page-object/elements/heading_spec.rb +8 -8
  55. data/spec/page-object/elements/hidden_field_spec.rb +3 -3
  56. data/spec/page-object/elements/image_spec.rb +14 -14
  57. data/spec/page-object/elements/label_spec.rb +3 -3
  58. data/spec/page-object/elements/link_spec.rb +6 -6
  59. data/spec/page-object/elements/list_item_spec.rb +4 -3
  60. data/spec/page-object/elements/nested_element_spec.rb +47 -47
  61. data/spec/page-object/elements/option_spec.rb +1 -1
  62. data/spec/page-object/elements/ordered_list_spec.rb +33 -33
  63. data/spec/page-object/elements/paragraph_spec.rb +3 -4
  64. data/spec/page-object/elements/select_list_spec.rb +52 -52
  65. data/spec/page-object/elements/selenium/radio_button_spec.rb +7 -13
  66. data/spec/page-object/elements/selenium/text_field_spec.rb +7 -7
  67. data/spec/page-object/elements/selenium_element_spec.rb +53 -53
  68. data/spec/page-object/elements/span_spec.rb +3 -3
  69. data/spec/page-object/elements/table_cell_spec.rb +3 -3
  70. data/spec/page-object/elements/table_row_spec.rb +22 -22
  71. data/spec/page-object/elements/table_spec.rb +28 -28
  72. data/spec/page-object/elements/text_area_spec.rb +5 -5
  73. data/spec/page-object/elements/unordered_list_spec.rb +33 -34
  74. data/spec/page-object/elements/watir_element_spec.rb +47 -48
  75. data/spec/page-object/javascript_framework_facade_spec.rb +6 -6
  76. data/spec/page-object/loads_platform_spec.rb +4 -4
  77. data/spec/page-object/page-object_spec.rb +103 -102
  78. data/spec/page-object/page_factory_spec.rb +43 -61
  79. data/spec/page-object/page_populator_spec.rb +44 -50
  80. data/spec/page-object/platforms/selenium_webdriver/selenium_page_object_spec.rb +15 -15
  81. data/spec/page-object/platforms/selenium_webdriver_spec.rb +6 -6
  82. data/spec/page-object/platforms/watir_webdriver/watir_page_object_spec.rb +4 -4
  83. data/spec/page-object/platforms/watir_webdriver_spec.rb +1 -1
  84. data/spec/page-object/selenium_accessors_spec.rb +166 -153
  85. data/spec/page-object/watir_accessors_spec.rb +265 -245
  86. data/spec/page-object/widget_spec.rb +62 -30
  87. data/spec/spec_helper.rb +8 -8
  88. metadata +20 -10
@@ -55,5 +55,6 @@ require 'page-object/elements/canvas'
55
55
  require 'page-object/elements/media'
56
56
  require 'page-object/elements/audio'
57
57
  require 'page-object/elements/video'
58
+ require 'page-object/elements/bold'
58
59
 
59
60
 
@@ -0,0 +1,11 @@
1
+ module PageObject
2
+ module Elements
3
+ class Bold < Element
4
+
5
+ end
6
+
7
+ ::PageObject::Elements.tag_to_class[:b] = ::PageObject::Elements::Bold
8
+
9
+
10
+ end
11
+ end
@@ -59,6 +59,17 @@ module PageObject
59
59
  attribute 'class'
60
60
  end
61
61
 
62
+ #
63
+ # specify plural form of element
64
+ #
65
+ def self.plural_form
66
+ "#{self.to_s.split('::')[-1].
67
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
68
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
69
+ tr("-", "_").
70
+ downcase}s"
71
+ end
72
+
62
73
  # @private
63
74
  def self.watir_identifier_for identifier
64
75
  if should_build_watir_xpath(identifier)
@@ -107,7 +118,7 @@ module PageObject
107
118
  protected
108
119
 
109
120
  def self.should_build_watir_xpath identifier
110
- ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video'].include? identifier[:tag_name] and identifier[:name]
121
+ ['table', 'span', 'div', 'td', 'li', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'label', 'area', 'canvas', 'audio', 'video', 'b'].include? identifier[:tag_name] and identifier[:name]
111
122
  end
112
123
 
113
124
  def self.build_xpath_for identifier
@@ -1,4 +1,3 @@
1
-
2
1
  module PageObject
3
2
  module Elements
4
3
  class Table < Element
@@ -38,6 +37,18 @@ module PageObject
38
37
  self[-1]
39
38
  end
40
39
 
40
+ #
41
+ # return the table as hashes
42
+ #
43
+ # @return Hash
44
+ #
45
+ def hashes
46
+ headers = self.first_row.map(&:text)
47
+ self.entries[1..-1].map do |row|
48
+ Hash[headers.zip(row.map(&:text))]
49
+ end
50
+ end
51
+
41
52
  protected
42
53
 
43
54
  def child_xpath
@@ -1,25 +1,5 @@
1
1
  module PageObject
2
2
  module IndexedProperties
3
- class RowOfElements
4
- include PageObject
5
- include LoadsPlatform
6
- extend Accessors
7
-
8
- def initialize (browser, index, identifier_list)
9
- initialize_browser(browser)
10
-
11
- identifier_list.each do |identifier|
12
- type = identifier[0]
13
- name = identifier[1]
14
- how_and_what = identifier[2].clone # Cannot modify the original...
15
- how_and_what.each do |key, value|
16
- how_and_what[key] = value % index
17
- end
18
- self.class.send type, name, how_and_what unless self.class.instance_methods.include? name
19
- end
20
- end
21
- end
22
-
23
3
  class TableOfElements
24
4
  include PageObject
25
5
  include LoadsPlatform
@@ -27,10 +7,29 @@ module PageObject
27
7
  def initialize (browser, identifier_list)
28
8
  initialize_browser(browser)
29
9
  @identifier_list = identifier_list
10
+ @indexed_property_class = Class.new {
11
+ include PageObject
12
+ include LoadsPlatform
13
+ extend Accessors
14
+
15
+ def initialize (browser, index, identifier_list)
16
+ initialize_browser(browser)
17
+
18
+ identifier_list.each do |identifier|
19
+ type = identifier[0]
20
+ name = identifier[1]
21
+ how_and_what = identifier[2].clone # Cannot modify the original...
22
+ how_and_what.each do |key, value|
23
+ how_and_what[key] = value % index
24
+ end
25
+ self.class.send type, name, how_and_what unless self.class.instance_methods.include? name
26
+ end
27
+ end
28
+ }
30
29
  end
31
30
 
32
31
  def [] (index)
33
- RowOfElements.new(@browser, index, @identifier_list)
32
+ @indexed_property_class.new(@browser,index,@identifier_list)
34
33
  end
35
34
  end
36
35
  end
@@ -0,0 +1,14 @@
1
+ module PageObject
2
+ module Javascript
3
+
4
+ module AngularJS
5
+ #
6
+ # return the number of pending ajax requests
7
+ #
8
+ def self.pending_requests
9
+ 'return angular.element(document.body).injector().get(\'$http\').pendingRequests.length;'
10
+ end
11
+ end
12
+
13
+ end
14
+ end
@@ -1,6 +1,7 @@
1
1
  require 'page-object/javascript/jquery'
2
2
  require 'page-object/javascript/prototype'
3
3
  require 'page-object/javascript/yui'
4
+ require 'page-object/javascript/angularjs'
4
5
 
5
6
 
6
7
  module PageObject
@@ -19,8 +20,8 @@ module PageObject
19
20
  #
20
21
  # Set the framework to use.
21
22
  #
22
- # @param[Symbol] the framework to use. :jquery and :prototype
23
- # are supported
23
+ # @param[Symbol] the framework to use. :jquery, :prototype, :yui,
24
+ # and :angularjs are supported
24
25
  #
25
26
  def framework=(framework)
26
27
  initialize_script_builder unless @builder
@@ -63,6 +64,7 @@ module PageObject
63
64
  :jquery => ::PageObject::Javascript::JQuery,
64
65
  :prototype => ::PageObject::Javascript::Prototype,
65
66
  :yui => ::PageObject::Javascript::YUI,
67
+ :angularjs => ::PageObject::Javascript::AngularJS
66
68
  }
67
69
  end
68
70
 
@@ -101,6 +101,7 @@ module PageObject
101
101
  :canvas,
102
102
  :audio,
103
103
  :video,
104
+ :b,
104
105
  :svg]
105
106
 
106
107
  def self.generate_locators(target)
@@ -51,7 +51,6 @@ module PageObject
51
51
 
52
52
  def populate_radiobutton(key, value)
53
53
  return self.send "select_#{key}" if value
54
- return self.send "clear_#{key}"
55
54
  end
56
55
 
57
56
  def populate_radiobuttongroup(key, value)
@@ -4,7 +4,7 @@ module PageObject
4
4
  module Button
5
5
  #
6
6
  # Override PageObject::PLatforms::SeleniumElement#text because
7
- # #text does not reliabably return a value in Selenium
7
+ # #text does not reliably return a value in Selenium
8
8
  #
9
9
  def text
10
10
  raise "text is not available on button element in Selenium"
@@ -235,7 +235,7 @@ module PageObject
235
235
  #
236
236
  # @param [Integer] (defaults to: 5) seconds to wait before timing out
237
237
  # @param [String] the message to display if the event timeouts
238
- # @param the block to execute when the event occurrs
238
+ # @param the block to execute when the event occurs
239
239
  #
240
240
  def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)
241
241
  wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => message})
@@ -425,16 +425,6 @@ module PageObject
425
425
  end
426
426
  end
427
427
 
428
- #
429
- # platform method to clear a radio button
430
- # See PageObject::Accessors#radio_button
431
- #
432
- def clear_radio(identifier)
433
- process_selenium_call(identifier, Elements::RadioButton, 'input', :type => 'radio') do |how, what|
434
- @browser.find_element(how, what).click if @browser.find_element(how, what).selected?
435
- end
436
- end
437
-
438
428
  #
439
429
  # platform method to determine if a radio button is selected
440
430
  # See PageObject::Accessors#radio_button
@@ -1012,6 +1002,32 @@ module PageObject
1012
1002
  find_selenium_elements(identifier, Elements::Element, 'svg')
1013
1003
  end
1014
1004
 
1005
+
1006
+ #
1007
+ # platform method to retrieve the text from a b
1008
+ # See PageObject::Accessors#b
1009
+ #
1010
+ def b_text_for(identifier)
1011
+ process_selenium_call(identifier, Elements::Bold, 'b') do |how, what|
1012
+ @browser.find_element(how, what).text
1013
+ end
1014
+ end
1015
+
1016
+ #
1017
+ # platform method to retrieve the h1 element
1018
+ # See PageObject::Accessors#b
1019
+ #
1020
+ def b_for(identifier)
1021
+ find_selenium_element(identifier, Elements::Bold, 'b')
1022
+ end
1023
+
1024
+ #
1025
+ # platform method to retrieve all b elements
1026
+ #
1027
+ def bs_for(identifier)
1028
+ find_selenium_elements(identifier, Elements::Bold, 'b')
1029
+ end
1030
+
1015
1031
  private
1016
1032
 
1017
1033
  def process_selenium_call(identifier, type, tag, other=nil)
@@ -9,13 +9,6 @@ module PageObject
9
9
  def select
10
10
  element.click unless selected?
11
11
  end
12
-
13
- #
14
- # clear the radiobutton
15
- #
16
- def clear
17
- element.click if selected?
18
- end
19
12
 
20
13
  #
21
14
  # return if it is selected
@@ -200,7 +200,7 @@ module PageObject
200
200
  #
201
201
  # @param [Integer] (defaults to: 5) seconds to wait before timing out
202
202
  # @param [String] the message to display if the event timeouts
203
- # @param the block to execute when the event occurrs
203
+ # @param the block to execute when the event occurs
204
204
  #
205
205
  def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)
206
206
  Object::Watir::Wait.until(timeout, message, &block)
@@ -388,14 +388,6 @@ module PageObject
388
388
  process_watir_call("radio(identifier).set", Elements::RadioButton, identifier)
389
389
  end
390
390
 
391
- #
392
- # platform method to clear a radio button
393
- # See PageObject::Accessors#radio_button
394
- #
395
- def clear_radio(identifier)
396
- process_watir_call("radio(identifier).clear", Elements::RadioButton, identifier)
397
- end
398
-
399
391
  #
400
392
  # platform method to determine if a radio button is selected
401
393
  # See PageObject::Accessors#radio_button
@@ -938,6 +930,29 @@ module PageObject
938
930
  def svgs_for(identifier)
939
931
  find_watir_elements("element(identifier)", Elements::Element, identifier)
940
932
  end
933
+
934
+ #
935
+ # platform method to retrieve the text for a b
936
+ # See PageObject::Accessors#b
937
+ #
938
+ def b_text_for(identifier)
939
+ process_watir_call("b(identifier).text", Elements::Bold, identifier, nil, 'b')
940
+ end
941
+
942
+ #
943
+ # platform method to retrieve the b element
944
+ # See PageObject::Accessors#h1
945
+ #
946
+ def b_for(identifier)
947
+ find_watir_element("b(identifier)", Elements::Bold, identifier, 'b')
948
+ end
949
+
950
+ #
951
+ # platform method to retrieve an array of bs
952
+ #
953
+ def bs_for(identifier)
954
+ find_watir_elements("bs(identifier)", Elements::Bold, identifier, 'b')
955
+ end
941
956
 
942
957
  private
943
958
 
@@ -10,13 +10,6 @@ module PageObject
10
10
  element.set
11
11
  end
12
12
 
13
- #
14
- # clear the radiobutton
15
- #
16
- def clear
17
- element.clear
18
- end
19
-
20
13
  #
21
14
  # return if it is selected
22
15
  #
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
@@ -46,6 +46,13 @@ module PageObject
46
46
  widget_class.accessor_methods(self, name)
47
47
  end
48
48
  end
49
+ define_method widget_class.plural_form do |name, *identifier_args, &block|
50
+ define_method("#{name}_elements") do
51
+ return call_block(&block) unless block.nil?
52
+ platform_method = "#{widget_tag.to_s}s_for"
53
+ platform.send platform_method, (identifier_args.first ? identifier_args.first.clone : {})
54
+ end
55
+ end
49
56
  end
50
57
 
51
58
  base.send(:include, accessors_module)
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_dependency 'watir-webdriver', '>= 0.6.9'
24
- s.add_dependency 'selenium-webdriver', '>= 2.42.0'
23
+ s.add_dependency 'watir-webdriver', '>= 0.6.11'
24
+ s.add_dependency 'selenium-webdriver', '>= 2.44.0'
25
25
  s.add_dependency 'page_navigation', '>= 0.9'
26
26
 
27
- s.add_development_dependency 'rspec', '< 3.0'
27
+ s.add_development_dependency 'rspec'
28
28
  s.add_development_dependency 'cucumber', '>= 1.3.0'
29
29
  s.add_development_dependency 'yard', '>= 0.7.2'
30
30
  s.add_development_dependency 'rack', '>= 1.0'
@@ -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
@@ -12,677 +12,699 @@ describe PageObject::ElementLocators do
12
12
  let(:watir_page_object) { ElementLocatorsTestPageObject.new(watir_browser) }
13
13
 
14
14
  it "should find a button element" do
15
- watir_browser.should_receive(:button).with(:id => 'blah').and_return(watir_browser)
15
+ expect(watir_browser).to receive(:button).with(:id => 'blah').and_return(watir_browser)
16
16
  element = watir_page_object.button_element(:id => 'blah')
17
- element.should be_instance_of PageObject::Elements::Button
17
+ expect(element).to be_instance_of PageObject::Elements::Button
18
18
  end
19
19
 
20
20
  it "should find a button element using a default identifier" do
21
- watir_browser.should_receive(:button).with(:index => 0).and_return(watir_browser)
21
+ expect(watir_browser).to receive(:button).with(:index => 0).and_return(watir_browser)
22
22
  watir_page_object.button_element
23
23
  end
24
24
 
25
25
  it "should find all button elements" do
26
- watir_browser.should_receive(:buttons).with(:id => 'blah').and_return([watir_browser])
26
+ expect(watir_browser).to receive(:buttons).with(:id => 'blah').and_return([watir_browser])
27
27
  elements = watir_page_object.button_elements(:id => 'blah')
28
- elements[0].should be_instance_of PageObject::Elements::Button
28
+ expect(elements[0]).to be_instance_of PageObject::Elements::Button
29
29
  end
30
30
 
31
31
  it "should find all buttons with no identifier" do
32
- watir_browser.should_receive(:buttons).with({}).and_return([watir_browser])
32
+ expect(watir_browser).to receive(:buttons).with({}).and_return([watir_browser])
33
33
  watir_page_object.button_elements
34
34
  end
35
35
 
36
36
  it "should find a text field element" do
37
- watir_browser.should_receive(:text_field).with(:id => 'blah').and_return(watir_browser)
37
+ expect(watir_browser).to receive(:text_field).with(:id => 'blah').and_return(watir_browser)
38
38
  element = watir_page_object.text_field_element(:id => 'blah')
39
- element.should be_instance_of PageObject::Elements::TextField
39
+ expect(element).to be_instance_of PageObject::Elements::TextField
40
40
  end
41
41
 
42
42
  it "should find a text field element using a default identifier" do
43
- watir_browser.should_receive(:text_field).with(:index => 0).and_return(watir_browser)
43
+ expect(watir_browser).to receive(:text_field).with(:index => 0).and_return(watir_browser)
44
44
  watir_page_object.text_field_element
45
45
  end
46
46
 
47
47
  it "should find all text field elements" do
48
- watir_browser.should_receive(:text_fields).with(:id => 'blah').and_return([watir_browser])
49
- watir_browser.should_receive(:tag_name).and_return('input')
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
50
  elements = watir_page_object.text_field_elements(:id => 'blah')
51
- elements[0].should be_instance_of PageObject::Elements::TextField
51
+ expect(elements[0]).to be_instance_of PageObject::Elements::TextField
52
52
  end
53
53
 
54
54
  it "should find all text fields with no identifier" do
55
- watir_browser.should_receive(:text_fields).with({}).and_return([watir_browser])
56
- watir_browser.should_receive(:tag_name).and_return('input')
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
57
  watir_page_object.text_field_elements
58
58
  end
59
59
 
60
60
  it "should find a hidden field element" do
61
- watir_browser.should_receive(:hidden).with(:id => 'blah').and_return(watir_browser)
61
+ expect(watir_browser).to receive(:hidden).with(:id => 'blah').and_return(watir_browser)
62
62
  element = watir_page_object.hidden_field_element(:id => 'blah')
63
- element.should be_instance_of PageObject::Elements::HiddenField
63
+ expect(element).to be_instance_of PageObject::Elements::HiddenField
64
64
  end
65
65
 
66
66
  it "should find a hidden field using a default identifier" do
67
- watir_browser.should_receive(:hidden).with(:index => 0).and_return(watir_browser)
67
+ expect(watir_browser).to receive(:hidden).with(:index => 0).and_return(watir_browser)
68
68
  watir_page_object.hidden_field_element
69
69
  end
70
70
 
71
71
  it "should find all hidden field elements" do
72
- watir_browser.should_receive(:hiddens).with(:id => 'blah').and_return([watir_browser])
72
+ expect(watir_browser).to receive(:hiddens).with(:id => 'blah').and_return([watir_browser])
73
73
  elements = watir_page_object.hidden_field_elements(:id => 'blah')
74
- elements[0].should be_instance_of(PageObject::Elements::HiddenField)
74
+ expect(elements[0]).to be_instance_of(PageObject::Elements::HiddenField)
75
75
  end
76
76
 
77
77
  it "should find all hidden field elements using no identifier" do
78
- watir_browser.should_receive(:hiddens).with({}).and_return([watir_browser])
78
+ expect(watir_browser).to receive(:hiddens).with({}).and_return([watir_browser])
79
79
  watir_page_object.hidden_field_elements
80
80
  end
81
81
 
82
82
  it "should find a text area element" do
83
- watir_browser.should_receive(:textarea).with(:id => 'blah').and_return(watir_browser)
83
+ expect(watir_browser).to receive(:textarea).with(:id => 'blah').and_return(watir_browser)
84
84
  element = watir_page_object.text_area_element(:id => 'blah')
85
- element.should be_instance_of PageObject::Elements::TextArea
85
+ expect(element).to be_instance_of PageObject::Elements::TextArea
86
86
  end
87
87
 
88
88
  it "should find a text area using a default identifier" do
89
- watir_browser.should_receive(:textarea).with(:index => 0).and_return(watir_browser)
89
+ expect(watir_browser).to receive(:textarea).with(:index => 0).and_return(watir_browser)
90
90
  watir_page_object.text_area_element
91
91
  end
92
92
 
93
93
  it "should find all text area elements" do
94
- watir_browser.should_receive(:textareas).with(:id => 'blah').and_return([watir_browser])
94
+ expect(watir_browser).to receive(:textareas).with(:id => 'blah').and_return([watir_browser])
95
95
  elements = watir_page_object.text_area_elements(:id => 'blah')
96
- elements[0].should be_instance_of PageObject::Elements::TextArea
96
+ expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
97
97
  end
98
98
 
99
99
  it "should find all text area elements using no identifier" do
100
- watir_browser.should_receive(:textareas).with({}).and_return([watir_browser])
100
+ expect(watir_browser).to receive(:textareas).with({}).and_return([watir_browser])
101
101
  watir_page_object.text_area_elements
102
102
  end
103
103
 
104
104
  it "should find a select list element" do
105
- watir_browser.should_receive(:select_list).with(:id => 'blah').and_return(watir_browser)
105
+ expect(watir_browser).to receive(:select_list).with(:id => 'blah').and_return(watir_browser)
106
106
  element = watir_page_object.select_list_element(:id => 'blah')
107
- element.should be_instance_of PageObject::Elements::SelectList
107
+ expect(element).to be_instance_of PageObject::Elements::SelectList
108
108
  end
109
109
 
110
110
  it "should find a select list using a default identifier" do
111
- watir_browser.should_receive(:select_list).with(:index => 0).and_return(watir_browser)
111
+ expect(watir_browser).to receive(:select_list).with(:index => 0).and_return(watir_browser)
112
112
  watir_page_object.select_list_element
113
113
  end
114
114
 
115
115
  it "should find all select list elements" do
116
- watir_browser.should_receive(:select_lists).with(:id => 'blah').and_return([watir_browser])
116
+ expect(watir_browser).to receive(:select_lists).with(:id => 'blah').and_return([watir_browser])
117
117
  elements = watir_page_object.select_list_elements(:id => 'blah')
118
- elements[0].should be_instance_of PageObject::Elements::SelectList
118
+ expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
119
119
  end
120
120
 
121
121
  it "should find all select list elements using no identifier" do
122
- watir_browser.should_receive(:select_lists).with({}).and_return([watir_browser])
122
+ expect(watir_browser).to receive(:select_lists).with({}).and_return([watir_browser])
123
123
  watir_page_object.select_list_elements
124
124
  end
125
125
 
126
126
  it "should find a link element" do
127
- watir_browser.should_receive(:link).with(:id => 'blah').and_return(watir_browser)
127
+ expect(watir_browser).to receive(:link).with(:id => 'blah').and_return(watir_browser)
128
128
  element = watir_page_object.link_element(:id => 'blah')
129
- element.should be_instance_of PageObject::Elements::Link
129
+ expect(element).to be_instance_of PageObject::Elements::Link
130
130
  end
131
131
 
132
132
  it "should find a link element using a default identifier" do
133
- watir_browser.should_receive(:link).with(:index => 0).and_return(watir_browser)
133
+ expect(watir_browser).to receive(:link).with(:index => 0).and_return(watir_browser)
134
134
  watir_page_object.link_element
135
135
  end
136
136
 
137
137
  it "should find all link elements" do
138
- watir_browser.should_receive(:links).with(:id => 'blah').and_return([watir_browser])
138
+ expect(watir_browser).to receive(:links).with(:id => 'blah').and_return([watir_browser])
139
139
  elements = watir_page_object.link_elements(:id => 'blah')
140
- elements[0].should be_instance_of PageObject::Elements::Link
140
+ expect(elements[0]).to be_instance_of PageObject::Elements::Link
141
141
  end
142
142
 
143
143
  it "should find all links using no identifier" do
144
- watir_browser.should_receive(:links).with({}).and_return([watir_browser])
144
+ expect(watir_browser).to receive(:links).with({}).and_return([watir_browser])
145
145
  watir_page_object.link_elements
146
146
  end
147
147
 
148
148
  it "should find a check box" do
149
- watir_browser.should_receive(:checkbox).with(:id => 'blah').and_return(watir_browser)
149
+ expect(watir_browser).to receive(:checkbox).with(:id => 'blah').and_return(watir_browser)
150
150
  element = watir_page_object.checkbox_element(:id => 'blah')
151
- element.should be_instance_of PageObject::Elements::CheckBox
151
+ expect(element).to be_instance_of PageObject::Elements::CheckBox
152
152
  end
153
153
 
154
154
  it "should find a check box using a default identifier" do
155
- watir_browser.should_receive(:checkbox).with(:index => 0).and_return(watir_browser)
155
+ expect(watir_browser).to receive(:checkbox).with(:index => 0).and_return(watir_browser)
156
156
  watir_page_object.checkbox_element
157
157
  end
158
158
 
159
159
  it "should find all check box elements" do
160
- watir_browser.should_receive(:checkboxes).with(:id => 'blah').and_return([watir_browser])
160
+ expect(watir_browser).to receive(:checkboxes).with(:id => 'blah').and_return([watir_browser])
161
161
  elements = watir_page_object.checkbox_elements(:id => 'blah')
162
- elements[0].should be_instance_of PageObject::Elements::CheckBox
162
+ expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
163
163
  end
164
164
 
165
165
  it "should find all check box elements using no identifier" do
166
- watir_browser.should_receive(:checkboxes).with({}).and_return([watir_browser])
166
+ expect(watir_browser).to receive(:checkboxes).with({}).and_return([watir_browser])
167
167
  watir_page_object.checkbox_elements
168
168
  end
169
169
 
170
170
  it "should find a radio button" do
171
- watir_browser.should_receive(:radio).with(:id => 'blah').and_return(watir_browser)
171
+ expect(watir_browser).to receive(:radio).with(:id => 'blah').and_return(watir_browser)
172
172
  element = watir_page_object.radio_button_element(:id => 'blah')
173
- element.should be_instance_of PageObject::Elements::RadioButton
173
+ expect(element).to be_instance_of PageObject::Elements::RadioButton
174
174
  end
175
175
 
176
176
  it "should find a radio button using a default identifier" do
177
- watir_browser.should_receive(:radio).with(:index => 0).and_return(watir_browser)
177
+ expect(watir_browser).to receive(:radio).with(:index => 0).and_return(watir_browser)
178
178
  watir_page_object.radio_button_element
179
179
  end
180
180
 
181
181
  it "should find all radio buttons" do
182
- watir_browser.should_receive(:radios).with(:id => 'blah').and_return([watir_browser])
182
+ expect(watir_browser).to receive(:radios).with(:id => 'blah').and_return([watir_browser])
183
183
  elements = watir_page_object.radio_button_elements(:id => 'blah')
184
- elements[0].should be_instance_of PageObject::Elements::RadioButton
184
+ expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
185
185
  end
186
186
 
187
187
  it "should find all radio buttons using no identifier" do
188
- watir_browser.should_receive(:radios).with({}).and_return([watir_browser])
188
+ expect(watir_browser).to receive(:radios).with({}).and_return([watir_browser])
189
189
  watir_page_object.radio_button_elements
190
190
  end
191
191
 
192
192
  it "should find a div" do
193
- watir_browser.should_receive(:div).with(:id => 'blah').and_return(watir_browser)
193
+ expect(watir_browser).to receive(:div).with(:id => 'blah').and_return(watir_browser)
194
194
  element = watir_page_object.div_element(:id => 'blah')
195
- element.should be_instance_of PageObject::Elements::Div
195
+ expect(element).to be_instance_of PageObject::Elements::Div
196
196
  end
197
197
 
198
198
  it "should find a div using a default identifier" do
199
- watir_browser.should_receive(:div).with(:index => 0).and_return(watir_browser)
199
+ expect(watir_browser).to receive(:div).with(:index => 0).and_return(watir_browser)
200
200
  watir_page_object.div_element
201
201
  end
202
202
 
203
203
  it "should find all div elements" do
204
- watir_browser.should_receive(:divs).with(:id => 'blah').and_return([watir_browser])
204
+ expect(watir_browser).to receive(:divs).with(:id => 'blah').and_return([watir_browser])
205
205
  elements = watir_page_object.div_elements(:id => 'blah')
206
- elements[0].should be_instance_of PageObject::Elements::Div
206
+ expect(elements[0]).to be_instance_of PageObject::Elements::Div
207
207
  end
208
208
 
209
209
  it "should find all div elements using no identifier" do
210
- watir_browser.should_receive(:divs).with({}).and_return([watir_browser])
210
+ expect(watir_browser).to receive(:divs).with({}).and_return([watir_browser])
211
211
  watir_page_object.div_elements
212
212
  end
213
213
 
214
214
  it "should find a span" do
215
- watir_browser.should_receive(:span).with(:id => 'blah').and_return(watir_browser)
215
+ expect(watir_browser).to receive(:span).with(:id => 'blah').and_return(watir_browser)
216
216
  element = watir_page_object.span_element(:id => 'blah')
217
- element.should be_instance_of PageObject::Elements::Span
217
+ expect(element).to be_instance_of PageObject::Elements::Span
218
218
  end
219
219
 
220
220
  it "should find a span using a default identifier" do
221
- watir_browser.should_receive(:span).with(:index => 0).and_return(watir_browser)
221
+ expect(watir_browser).to receive(:span).with(:index => 0).and_return(watir_browser)
222
222
  watir_page_object.span_element
223
223
  end
224
224
 
225
225
  it "should find all span elements" do
226
- watir_browser.should_receive(:spans).with(:id => 'blah').and_return([watir_browser])
226
+ expect(watir_browser).to receive(:spans).with(:id => 'blah').and_return([watir_browser])
227
227
  elements = watir_page_object.span_elements(:id => 'blah')
228
- elements[0].should be_instance_of PageObject::Elements::Span
228
+ expect(elements[0]).to be_instance_of PageObject::Elements::Span
229
229
  end
230
230
 
231
231
  it "should find all span elements using no identifier" do
232
- watir_browser.should_receive(:spans).with({}).and_return([watir_browser])
232
+ expect(watir_browser).to receive(:spans).with({}).and_return([watir_browser])
233
233
  watir_page_object.span_elements
234
234
  end
235
235
 
236
236
  it "should find a table" do
237
- watir_browser.should_receive(:table).with(:id => 'blah').and_return(watir_browser)
237
+ expect(watir_browser).to receive(:table).with(:id => 'blah').and_return(watir_browser)
238
238
  element = watir_page_object.table_element(:id => 'blah')
239
- element.should be_instance_of PageObject::Elements::Table
239
+ expect(element).to be_instance_of PageObject::Elements::Table
240
240
  end
241
241
 
242
242
  it "should find a table using a default identifier" do
243
- watir_browser.should_receive(:table).with(:index => 0).and_return(watir_browser)
243
+ expect(watir_browser).to receive(:table).with(:index => 0).and_return(watir_browser)
244
244
  watir_page_object.table_element
245
245
  end
246
246
 
247
247
  it "should find all table elements" do
248
- watir_browser.should_receive(:tables).with(:id => 'blah').and_return([watir_browser])
248
+ expect(watir_browser).to receive(:tables).with(:id => 'blah').and_return([watir_browser])
249
249
  elements = watir_page_object.table_elements(:id => 'blah')
250
- elements[0].should be_instance_of PageObject::Elements::Table
250
+ expect(elements[0]).to be_instance_of PageObject::Elements::Table
251
251
  end
252
252
 
253
253
  it "should find all table elements using no identifier" do
254
- watir_browser.should_receive(:tables).with({}).and_return([watir_browser])
254
+ expect(watir_browser).to receive(:tables).with({}).and_return([watir_browser])
255
255
  watir_page_object.table_elements
256
256
  end
257
257
 
258
258
  it "should find a table cell" do
259
- watir_browser.should_receive(:td).with(:id => 'blah').and_return(watir_browser)
259
+ expect(watir_browser).to receive(:td).with(:id => 'blah').and_return(watir_browser)
260
260
  element = watir_page_object.cell_element(:id => 'blah')
261
- element.should be_instance_of PageObject::Elements::TableCell
261
+ expect(element).to be_instance_of PageObject::Elements::TableCell
262
262
  end
263
263
 
264
264
  it "should find a table cell using a default identifier" do
265
- watir_browser.should_receive(:td).with(:index => 0).and_return(watir_browser)
265
+ expect(watir_browser).to receive(:td).with(:index => 0).and_return(watir_browser)
266
266
  watir_page_object.cell_element
267
267
  end
268
268
 
269
269
  it "should find all table cells" do
270
- watir_browser.should_receive(:tds).with(:id => 'blah').and_return([watir_browser])
270
+ expect(watir_browser).to receive(:tds).with(:id => 'blah').and_return([watir_browser])
271
271
  elements = watir_page_object.cell_elements(:id => 'blah')
272
- elements[0].should be_instance_of PageObject::Elements::TableCell
272
+ expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
273
273
  end
274
274
 
275
275
  it "should find all table cells using no identifier" do
276
- watir_browser.should_receive(:tds).with({}).and_return([watir_browser])
276
+ expect(watir_browser).to receive(:tds).with({}).and_return([watir_browser])
277
277
  watir_page_object.cell_elements
278
278
  end
279
279
 
280
280
  it "should find an image" do
281
- watir_browser.should_receive(:image).with(:id => 'blah').and_return(watir_browser)
281
+ expect(watir_browser).to receive(:image).with(:id => 'blah').and_return(watir_browser)
282
282
  element = watir_page_object.image_element(:id => 'blah')
283
- element.should be_instance_of PageObject::Elements::Image
283
+ expect(element).to be_instance_of PageObject::Elements::Image
284
284
  end
285
285
 
286
286
  it "should find an image using a default identifier" do
287
- watir_browser.should_receive(:image).with(:index => 0).and_return(watir_browser)
287
+ expect(watir_browser).to receive(:image).with(:index => 0).and_return(watir_browser)
288
288
  watir_page_object.image_element
289
289
  end
290
290
 
291
291
  it "should find all images" do
292
- watir_browser.should_receive(:images).with(:id => 'blah').and_return([watir_browser])
292
+ expect(watir_browser).to receive(:images).with(:id => 'blah').and_return([watir_browser])
293
293
  elements = watir_page_object.image_elements(:id => 'blah')
294
- elements[0].should be_instance_of PageObject::Elements::Image
294
+ expect(elements[0]).to be_instance_of PageObject::Elements::Image
295
295
  end
296
296
 
297
297
  it "should find all images using no identifier" do
298
- watir_browser.should_receive(:images).with({}).and_return([watir_browser])
298
+ expect(watir_browser).to receive(:images).with({}).and_return([watir_browser])
299
299
  watir_page_object.image_elements
300
300
  end
301
301
 
302
302
  it "should find a form" do
303
- watir_browser.should_receive(:form).with(:id => 'blah').and_return(watir_browser)
303
+ expect(watir_browser).to receive(:form).with(:id => 'blah').and_return(watir_browser)
304
304
  element = watir_page_object.form_element(:id => 'blah')
305
- element.should be_instance_of PageObject::Elements::Form
305
+ expect(element).to be_instance_of PageObject::Elements::Form
306
306
  end
307
307
 
308
308
  it "should find a form using a default identifier" do
309
- watir_browser.should_receive(:form).with(:index => 0).and_return(watir_browser)
309
+ expect(watir_browser).to receive(:form).with(:index => 0).and_return(watir_browser)
310
310
  watir_page_object.form_element
311
311
  end
312
312
 
313
313
  it "should find all forms" do
314
- watir_browser.should_receive(:forms).with(:id => 'blah').and_return([watir_browser])
314
+ expect(watir_browser).to receive(:forms).with(:id => 'blah').and_return([watir_browser])
315
315
  elements = watir_page_object.form_elements(:id => 'blah')
316
- elements[0].should be_instance_of PageObject::Elements::Form
316
+ expect(elements[0]).to be_instance_of PageObject::Elements::Form
317
317
  end
318
318
 
319
319
  it "should find all forms using no identifier" do
320
- watir_browser.should_receive(:forms).with({}).and_return([watir_browser])
320
+ expect(watir_browser).to receive(:forms).with({}).and_return([watir_browser])
321
321
  watir_page_object.form_elements
322
322
  end
323
323
 
324
324
  it "should find a list item" do
325
- watir_browser.should_receive(:li).with(:id => 'blah').and_return(watir_browser)
325
+ expect(watir_browser).to receive(:li).with(:id => 'blah').and_return(watir_browser)
326
326
  element = watir_page_object.list_item_element(:id => 'blah')
327
- element.should be_instance_of PageObject::Elements::ListItem
327
+ expect(element).to be_instance_of PageObject::Elements::ListItem
328
328
  end
329
329
 
330
330
  it "should find a list item using a default identifier" do
331
- watir_browser.should_receive(:li).with(:index => 0).and_return(watir_browser)
331
+ expect(watir_browser).to receive(:li).with(:index => 0).and_return(watir_browser)
332
332
  watir_page_object.list_item_element
333
333
  end
334
334
 
335
335
  it "should find all list items" do
336
- watir_browser.should_receive(:lis).with(:id => 'blah').and_return([watir_browser])
336
+ expect(watir_browser).to receive(:lis).with(:id => 'blah').and_return([watir_browser])
337
337
  elements = watir_page_object.list_item_elements(:id => 'blah')
338
- elements[0].should be_instance_of PageObject::Elements::ListItem
338
+ expect(elements[0]).to be_instance_of PageObject::Elements::ListItem
339
339
  end
340
340
 
341
341
  it "should find all list items using no parameter" do
342
- watir_browser.should_receive(:lis).with({}).and_return([watir_browser])
342
+ expect(watir_browser).to receive(:lis).with({}).and_return([watir_browser])
343
343
  watir_page_object.list_item_elements
344
344
  end
345
345
 
346
346
  it "should find an unordered list" do
347
- watir_browser.should_receive(:ul).with(:id => 'blah').and_return(watir_browser)
347
+ expect(watir_browser).to receive(:ul).with(:id => 'blah').and_return(watir_browser)
348
348
  element = watir_page_object.unordered_list_element(:id => 'blah')
349
- element.should be_instance_of PageObject::Elements::UnorderedList
349
+ expect(element).to be_instance_of PageObject::Elements::UnorderedList
350
350
  end
351
351
 
352
352
  it "should find an unordered list using a default identifier" do
353
- watir_browser.should_receive(:ul).with(:index => 0).and_return(watir_browser)
353
+ expect(watir_browser).to receive(:ul).with(:index => 0).and_return(watir_browser)
354
354
  watir_page_object.unordered_list_element
355
355
  end
356
356
 
357
357
  it "should find all unordered lists" do
358
- watir_browser.should_receive(:uls).with(:id => 'blah').and_return([watir_browser])
358
+ expect(watir_browser).to receive(:uls).with(:id => 'blah').and_return([watir_browser])
359
359
  elements = watir_page_object.unordered_list_elements(:id => 'blah')
360
- elements[0].should be_instance_of PageObject::Elements::UnorderedList
360
+ expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
361
361
  end
362
362
 
363
363
  it "should find all unordered lists using no parameters" do
364
- watir_browser.should_receive(:uls).with({}).and_return([watir_browser])
364
+ expect(watir_browser).to receive(:uls).with({}).and_return([watir_browser])
365
365
  watir_page_object.unordered_list_elements
366
366
  end
367
367
 
368
368
  it "should find an ordered list" do
369
- watir_browser.should_receive(:ol).with(:id => 'blah').and_return(watir_browser)
369
+ expect(watir_browser).to receive(:ol).with(:id => 'blah').and_return(watir_browser)
370
370
  element = watir_page_object.ordered_list_element(:id => 'blah')
371
- element.should be_instance_of PageObject::Elements::OrderedList
371
+ expect(element).to be_instance_of PageObject::Elements::OrderedList
372
372
  end
373
373
 
374
374
  it "should find an orderd list using a default identifier" do
375
- watir_browser.should_receive(:ol).with(:index => 0).and_return(watir_browser)
375
+ expect(watir_browser).to receive(:ol).with(:index => 0).and_return(watir_browser)
376
376
  watir_page_object.ordered_list_element
377
377
  end
378
378
 
379
379
  it "should find all ordered lists" do
380
- watir_browser.should_receive(:ols).with(:id => 'blah').and_return([watir_browser])
380
+ expect(watir_browser).to receive(:ols).with(:id => 'blah').and_return([watir_browser])
381
381
  elements = watir_page_object.ordered_list_elements(:id => 'blah')
382
- elements[0].should be_instance_of PageObject::Elements::OrderedList
382
+ expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
383
383
  end
384
384
 
385
385
  it "should find all orderd lists using no parameters" do
386
- watir_browser.should_receive(:ols).with({}).and_return([watir_browser])
386
+ expect(watir_browser).to receive(:ols).with({}).and_return([watir_browser])
387
387
  watir_page_object.ordered_list_elements
388
388
  end
389
389
 
390
390
  it "should find a h1 element" do
391
- watir_browser.should_receive(:h1).with(:id => 'blah').and_return(watir_browser)
391
+ expect(watir_browser).to receive(:h1).with(:id => 'blah').and_return(watir_browser)
392
392
  element = watir_page_object.h1_element(:id => 'blah')
393
- element.should be_instance_of PageObject::Elements::Heading
393
+ expect(element).to be_instance_of PageObject::Elements::Heading
394
394
  end
395
395
 
396
396
  it "should find a h1 element using a default identifier" do
397
- watir_browser.should_receive(:h1).with(:index => 0).and_return(watir_browser)
397
+ expect(watir_browser).to receive(:h1).with(:index => 0).and_return(watir_browser)
398
398
  watir_page_object.h1_element
399
399
  end
400
400
 
401
401
  it "should find all h1 elements" do
402
- watir_browser.should_receive(:h1s).with(:id => 'blah').and_return([watir_browser])
402
+ expect(watir_browser).to receive(:h1s).with(:id => 'blah').and_return([watir_browser])
403
403
  elements = watir_page_object.h1_elements(:id => 'blah')
404
- elements[0].should be_instance_of PageObject::Elements::Heading
404
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
405
405
  end
406
406
 
407
407
  it "should find all h1 elements using no parameters" do
408
- watir_browser.should_receive(:h1s).with({}).and_return([watir_browser])
408
+ expect(watir_browser).to receive(:h1s).with({}).and_return([watir_browser])
409
409
  watir_page_object.h1_elements
410
410
  end
411
411
 
412
412
  it "should find a h2 element" do
413
- watir_browser.should_receive(:h2).with(:id => 'blah').and_return(watir_browser)
413
+ expect(watir_browser).to receive(:h2).with(:id => 'blah').and_return(watir_browser)
414
414
  element = watir_page_object.h2_element(:id => 'blah')
415
- element.should be_instance_of PageObject::Elements::Heading
415
+ expect(element).to be_instance_of PageObject::Elements::Heading
416
416
  end
417
417
 
418
418
  it "should find a h2 element using default identifier" do
419
- watir_browser.should_receive(:h2).with(:index => 0).and_return(watir_browser)
419
+ expect(watir_browser).to receive(:h2).with(:index => 0).and_return(watir_browser)
420
420
  watir_page_object.h2_element
421
421
  end
422
422
 
423
423
  it "should find all h2 elements" do
424
- watir_browser.should_receive(:h2s).with(:id => 'blah').and_return([watir_browser])
424
+ expect(watir_browser).to receive(:h2s).with(:id => 'blah').and_return([watir_browser])
425
425
  elements = watir_page_object.h2_elements(:id => 'blah')
426
- elements[0].should be_instance_of PageObject::Elements::Heading
426
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
427
427
  end
428
428
 
429
429
  it "should find all h2 elements using no identifier" do
430
- watir_browser.should_receive(:h2s).with({}).and_return([watir_browser])
430
+ expect(watir_browser).to receive(:h2s).with({}).and_return([watir_browser])
431
431
  watir_page_object.h2_elements
432
432
  end
433
433
 
434
434
  it "should find a h3 element" do
435
- watir_browser.should_receive(:h3).with(:id => 'blah').and_return(watir_browser)
435
+ expect(watir_browser).to receive(:h3).with(:id => 'blah').and_return(watir_browser)
436
436
  element = watir_page_object.h3_element(:id => 'blah')
437
- element.should be_instance_of PageObject::Elements::Heading
437
+ expect(element).to be_instance_of PageObject::Elements::Heading
438
438
  end
439
439
 
440
440
  it "should find a h3 element using a default identifier" do
441
- watir_browser.should_receive(:h3).with(:index => 0).and_return(watir_browser)
441
+ expect(watir_browser).to receive(:h3).with(:index => 0).and_return(watir_browser)
442
442
  watir_page_object.h3_element
443
443
  end
444
444
 
445
445
  it "should find all h3 elements" do
446
- watir_browser.should_receive(:h3s).with(:id => 'blah').and_return([watir_browser])
446
+ expect(watir_browser).to receive(:h3s).with(:id => 'blah').and_return([watir_browser])
447
447
  elements = watir_page_object.h3_elements(:id => 'blah')
448
- elements[0].should be_instance_of PageObject::Elements::Heading
448
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
449
449
  end
450
450
 
451
451
  it "should find all h3 elements using no identifiers" do
452
- watir_browser.should_receive(:h3s).with({}).and_return([watir_browser])
452
+ expect(watir_browser).to receive(:h3s).with({}).and_return([watir_browser])
453
453
  watir_page_object.h3_elements
454
454
  end
455
455
 
456
456
  it "should find a h4 element" do
457
- watir_browser.should_receive(:h4).with(:id => 'blah').and_return(watir_browser)
457
+ expect(watir_browser).to receive(:h4).with(:id => 'blah').and_return(watir_browser)
458
458
  element = watir_page_object.h4_element(:id => 'blah')
459
- element.should be_instance_of PageObject::Elements::Heading
459
+ expect(element).to be_instance_of PageObject::Elements::Heading
460
460
  end
461
461
 
462
462
  it "should find a h4 element using a default identifier" do
463
- watir_browser.should_receive(:h4).with(:index => 0).and_return(watir_browser)
463
+ expect(watir_browser).to receive(:h4).with(:index => 0).and_return(watir_browser)
464
464
  watir_page_object.h4_element
465
465
  end
466
466
 
467
467
  it "should find all h4 elements" do
468
- watir_browser.should_receive(:h4s).with(:id => 'blah').and_return([watir_browser])
468
+ expect(watir_browser).to receive(:h4s).with(:id => 'blah').and_return([watir_browser])
469
469
  elements = watir_page_object.h4_elements(:id => 'blah')
470
- elements[0].should be_instance_of PageObject::Elements::Heading
470
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
471
471
  end
472
472
 
473
473
  it "should find all h4 elements using no identifier" do
474
- watir_browser.should_receive(:h4s).with({}).and_return([watir_browser])
474
+ expect(watir_browser).to receive(:h4s).with({}).and_return([watir_browser])
475
475
  watir_page_object.h4_elements
476
476
  end
477
477
 
478
478
  it "should find a h5 element" do
479
- watir_browser.should_receive(:h5).with(:id => 'blah').and_return(watir_browser)
479
+ expect(watir_browser).to receive(:h5).with(:id => 'blah').and_return(watir_browser)
480
480
  element = watir_page_object.h5_element(:id => 'blah')
481
- element.should be_instance_of PageObject::Elements::Heading
481
+ expect(element).to be_instance_of PageObject::Elements::Heading
482
482
  end
483
483
 
484
484
  it "should find a h5 element using a default identifier" do
485
- watir_browser.should_receive(:h5).with(:index => 0).and_return(watir_browser)
485
+ expect(watir_browser).to receive(:h5).with(:index => 0).and_return(watir_browser)
486
486
  watir_page_object.h5_element
487
487
  end
488
488
 
489
489
  it "should find all h5 elements" do
490
- watir_browser.should_receive(:h5s).with(:id => 'blah').and_return([watir_browser])
490
+ expect(watir_browser).to receive(:h5s).with(:id => 'blah').and_return([watir_browser])
491
491
  elements = watir_page_object.h5_elements(:id => 'blah')
492
- elements[0].should be_instance_of PageObject::Elements::Heading
492
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
493
493
  end
494
494
 
495
495
  it "should find all h5 elements using no identifier" do
496
- watir_browser.should_receive(:h5s).with({}).and_return([watir_browser])
496
+ expect(watir_browser).to receive(:h5s).with({}).and_return([watir_browser])
497
497
  watir_page_object.h5_elements
498
498
  end
499
499
 
500
500
  it "should find a h6 element" do
501
- watir_browser.should_receive(:h6).with(:id => 'blah').and_return(watir_browser)
501
+ expect(watir_browser).to receive(:h6).with(:id => 'blah').and_return(watir_browser)
502
502
  element = watir_page_object.h6_element(:id => 'blah')
503
- element.should be_instance_of PageObject::Elements::Heading
503
+ expect(element).to be_instance_of PageObject::Elements::Heading
504
504
  end
505
505
 
506
506
  it "should find a h6 element using a default identifier" do
507
- watir_browser.should_receive(:h6).with(:index => 0).and_return(watir_browser)
507
+ expect(watir_browser).to receive(:h6).with(:index => 0).and_return(watir_browser)
508
508
  watir_page_object.h6_element
509
509
  end
510
510
 
511
511
  it "should find all h6 elements" do
512
- watir_browser.should_receive(:h6s).with(:id => 'blah').and_return([watir_browser])
512
+ expect(watir_browser).to receive(:h6s).with(:id => 'blah').and_return([watir_browser])
513
513
  elements = watir_page_object.h6_elements(:id => 'blah')
514
- elements[0].should be_instance_of PageObject::Elements::Heading
514
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
515
515
  end
516
516
 
517
517
  it "should find all h6 elements using no identifier" do
518
- watir_browser.should_receive(:h6s).with({}).and_return([watir_browser])
518
+ expect(watir_browser).to receive(:h6s).with({}).and_return([watir_browser])
519
519
  watir_page_object.h6_elements
520
520
  end
521
521
 
522
522
  it "should find a paragraph element" do
523
- watir_browser.should_receive(:p).with(:id => 'blah').and_return(watir_browser)
523
+ expect(watir_browser).to receive(:p).with(:id => 'blah').and_return(watir_browser)
524
524
  element = watir_page_object.paragraph_element(:id => 'blah')
525
- element.should be_instance_of PageObject::Elements::Paragraph
525
+ expect(element).to be_instance_of PageObject::Elements::Paragraph
526
526
  end
527
527
 
528
528
  it "should find a paragraph element using a default identifier" do
529
- watir_browser.should_receive(:p).with(:index => 0).and_return(watir_browser)
529
+ expect(watir_browser).to receive(:p).with(:index => 0).and_return(watir_browser)
530
530
  watir_page_object.paragraph_element
531
531
  end
532
532
 
533
533
  it "should find all paragraph elements" do
534
- watir_browser.should_receive(:ps).with(:id => 'blah').and_return([watir_browser])
534
+ expect(watir_browser).to receive(:ps).with(:id => 'blah').and_return([watir_browser])
535
535
  elements = watir_page_object.paragraph_elements(:id => 'blah')
536
- elements[0].should be_instance_of PageObject::Elements::Paragraph
536
+ expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
537
537
  end
538
538
 
539
539
  it "should find all paragraph elements using no identifier" do
540
- watir_browser.should_receive(:ps).with({}).and_return([watir_browser])
540
+ expect(watir_browser).to receive(:ps).with({}).and_return([watir_browser])
541
541
  watir_page_object.paragraph_elements
542
542
  end
543
543
 
544
544
  it "should find a label" do
545
- watir_browser.should_receive(:label).with(:id => 'blah').and_return(watir_browser)
545
+ expect(watir_browser).to receive(:label).with(:id => 'blah').and_return(watir_browser)
546
546
  element = watir_page_object.label_element(:id => 'blah')
547
- element.should be_instance_of PageObject::Elements::Label
547
+ expect(element).to be_instance_of PageObject::Elements::Label
548
548
  end
549
549
 
550
550
  it "should find a label element using default parameters" do
551
- watir_browser.should_receive(:label).with(:index => 0).and_return(watir_browser)
551
+ expect(watir_browser).to receive(:label).with(:index => 0).and_return(watir_browser)
552
552
  watir_page_object.label_element
553
553
  end
554
554
 
555
555
  it "should find all label elements" do
556
- watir_browser.should_receive(:labels).with(:id => 'blah').and_return([watir_browser])
556
+ expect(watir_browser).to receive(:labels).with(:id => 'blah').and_return([watir_browser])
557
557
  elements = watir_page_object.label_elements(:id => 'blah')
558
- elements[0].should be_instance_of PageObject::Elements::Label
558
+ expect(elements[0]).to be_instance_of PageObject::Elements::Label
559
559
  end
560
560
 
561
561
  it "should find all label elements using no parameters" do
562
- watir_browser.should_receive(:labels).with({}).and_return([watir_browser])
562
+ expect(watir_browser).to receive(:labels).with({}).and_return([watir_browser])
563
563
  watir_page_object.label_elements
564
564
  end
565
565
 
566
566
  it "should find a file field element" do
567
- watir_browser.should_receive(:file_field).with(:id => 'blah').and_return(watir_browser)
567
+ expect(watir_browser).to receive(:file_field).with(:id => 'blah').and_return(watir_browser)
568
568
  element = watir_page_object.file_field_element(:id => 'blah')
569
- element.should be_instance_of PageObject::Elements::FileField
569
+ expect(element).to be_instance_of PageObject::Elements::FileField
570
570
  end
571
571
 
572
572
  it "should find a file field element using a default identifier" do
573
- watir_browser.should_receive(:file_field).with(:index => 0).and_return(watir_browser)
573
+ expect(watir_browser).to receive(:file_field).with(:index => 0).and_return(watir_browser)
574
574
  watir_page_object.file_field_element
575
575
  end
576
576
 
577
577
  it "should find all file field elements" do
578
- watir_browser.should_receive(:file_fields).with(:id => 'blah').and_return([watir_browser])
578
+ expect(watir_browser).to receive(:file_fields).with(:id => 'blah').and_return([watir_browser])
579
579
  element = watir_page_object.file_field_elements(:id => 'blah')
580
- element[0].should be_instance_of PageObject::Elements::FileField
580
+ expect(element[0]).to be_instance_of PageObject::Elements::FileField
581
581
  end
582
582
 
583
583
  it "should find all file fields using no identifier" do
584
- watir_browser.should_receive(:file_fields).with({}).and_return([watir_browser])
584
+ expect(watir_browser).to receive(:file_fields).with({}).and_return([watir_browser])
585
585
  watir_page_object.file_field_elements
586
586
  end
587
587
 
588
588
  it "should find an area element" do
589
- watir_browser.should_receive(:area).with(:id => 'blah').and_return(watir_browser)
589
+ expect(watir_browser).to receive(:area).with(:id => 'blah').and_return(watir_browser)
590
590
  element = watir_page_object.area_element(:id => 'blah')
591
- element.should be_instance_of PageObject::Elements::Area
591
+ expect(element).to be_instance_of PageObject::Elements::Area
592
592
  end
593
593
 
594
594
  it "should find an area element using a default identifier" do
595
- watir_browser.should_receive(:area).with(:index => 0).and_return(watir_browser)
595
+ expect(watir_browser).to receive(:area).with(:index => 0).and_return(watir_browser)
596
596
  watir_page_object.area_element
597
597
  end
598
598
 
599
599
  it "should find all area elements" do
600
- watir_browser.should_receive(:areas).with(:id => 'blah').and_return([watir_browser])
600
+ expect(watir_browser).to receive(:areas).with(:id => 'blah').and_return([watir_browser])
601
601
  elements = watir_page_object.area_elements(:id => 'blah')
602
- elements[0].should be_instance_of PageObject::Elements::Area
602
+ expect(elements[0]).to be_instance_of PageObject::Elements::Area
603
603
  end
604
604
 
605
605
  it "should find all areas with no identifier" do
606
- watir_browser.should_receive(:areas).with({}).and_return([watir_browser])
606
+ expect(watir_browser).to receive(:areas).with({}).and_return([watir_browser])
607
607
  watir_page_object.area_elements
608
608
  end
609
609
 
610
610
  it "should find a canvas element" do
611
- watir_browser.should_receive(:canvas).with(:id => 'blah').and_return(watir_browser)
611
+ expect(watir_browser).to receive(:canvas).with(:id => 'blah').and_return(watir_browser)
612
612
  element = watir_page_object.canvas_element(:id => 'blah')
613
- element.should be_instance_of PageObject::Elements::Canvas
613
+ expect(element).to be_instance_of PageObject::Elements::Canvas
614
614
  end
615
615
 
616
616
  it "should find a canvas element using a default identifier" do
617
- watir_browser.should_receive(:canvas).with(:index => 0).and_return(watir_browser)
617
+ expect(watir_browser).to receive(:canvas).with(:index => 0).and_return(watir_browser)
618
618
  watir_page_object.canvas_element
619
619
  end
620
620
 
621
621
  it "should find all canvas elements" do
622
- watir_browser.should_receive(:canvases).with(:id => 'blah').and_return([watir_browser])
622
+ expect(watir_browser).to receive(:canvases).with(:id => 'blah').and_return([watir_browser])
623
623
  elements = watir_page_object.canvas_elements(:id => 'blah')
624
- elements[0].should be_instance_of PageObject::Elements::Canvas
624
+ expect(elements[0]).to be_instance_of PageObject::Elements::Canvas
625
625
  end
626
626
 
627
627
  it "should find all canvases with no identifier" do
628
- watir_browser.should_receive(:canvases).with({}).and_return([watir_browser])
628
+ expect(watir_browser).to receive(:canvases).with({}).and_return([watir_browser])
629
629
  watir_page_object.canvas_elements
630
630
  end
631
631
 
632
632
  it "should find an audio element" do
633
- watir_browser.should_receive(:audio).with(:id => 'blah').and_return(watir_browser)
633
+ expect(watir_browser).to receive(:audio).with(:id => 'blah').and_return(watir_browser)
634
634
  element = watir_page_object.audio_element(:id => 'blah')
635
- element.should be_instance_of PageObject::Elements::Audio
635
+ expect(element).to be_instance_of PageObject::Elements::Audio
636
636
  end
637
637
 
638
638
  it "should find an audio element using a default identifier" do
639
- watir_browser.should_receive(:audio).with(:index => 0).and_return(watir_browser)
639
+ expect(watir_browser).to receive(:audio).with(:index => 0).and_return(watir_browser)
640
640
  watir_page_object.audio_element
641
641
  end
642
642
 
643
643
  it "should find all audio elements" do
644
- watir_browser.should_receive(:audios).with(:id => 'blah').and_return([watir_browser])
644
+ expect(watir_browser).to receive(:audios).with(:id => 'blah').and_return([watir_browser])
645
645
  elements = watir_page_object.audio_elements(:id => 'blah')
646
- elements[0].should be_instance_of PageObject::Elements::Audio
646
+ expect(elements[0]).to be_instance_of PageObject::Elements::Audio
647
647
  end
648
648
 
649
649
  it "should find all audio elements with no identifier" do
650
- watir_browser.should_receive(:audios).with({}).and_return([watir_browser])
650
+ expect(watir_browser).to receive(:audios).with({}).and_return([watir_browser])
651
651
  watir_page_object.audio_elements
652
652
  end
653
653
 
654
654
  it "should find a video element" do
655
- watir_browser.should_receive(:video).with(:id => 'blah').and_return(watir_browser)
655
+ expect(watir_browser).to receive(:video).with(:id => 'blah').and_return(watir_browser)
656
656
  element = watir_page_object.video_element(:id => 'blah')
657
- element.should be_instance_of PageObject::Elements::Video
657
+ expect(element).to be_instance_of PageObject::Elements::Video
658
658
  end
659
659
 
660
660
  it "should find a video element using a default identifier" do
661
- watir_browser.should_receive(:video).with(:index => 0).and_return(watir_browser)
661
+ expect(watir_browser).to receive(:video).with(:index => 0).and_return(watir_browser)
662
662
  watir_page_object.video_element
663
663
  end
664
664
 
665
665
  it "should find all video elements" do
666
- watir_browser.should_receive(:videos).with(:id => 'blah').and_return([watir_browser])
666
+ expect(watir_browser).to receive(:videos).with(:id => 'blah').and_return([watir_browser])
667
667
  elements = watir_page_object.video_elements(:id => 'blah')
668
- elements[0].should be_instance_of PageObject::Elements::Video
668
+ expect(elements[0]).to be_instance_of PageObject::Elements::Video
669
669
  end
670
670
 
671
671
  it "should find all video elements with no identifier" do
672
- watir_browser.should_receive(:videos).with({}).and_return([watir_browser])
672
+ expect(watir_browser).to receive(:videos).with({}).and_return([watir_browser])
673
673
  watir_page_object.video_elements
674
674
  end
675
675
 
676
676
  it "should find an element" do
677
- watir_browser.should_receive(:audio).with(:id => 'blah').and_return(watir_browser)
677
+ expect(watir_browser).to receive(:audio).with(:id => 'blah').and_return(watir_browser)
678
678
  element = watir_page_object.element(:audio, :id => 'blah')
679
- element.should be_instance_of PageObject::Elements::Element
679
+ expect(element).to be_instance_of PageObject::Elements::Element
680
680
  end
681
681
 
682
682
  it "should find an element using a default identifier" do
683
- watir_browser.should_receive(:audio).with(:index => 0).and_return(watir_browser)
683
+ expect(watir_browser).to receive(:audio).with(:index => 0).and_return(watir_browser)
684
684
  watir_page_object.element(:audio)
685
685
  end
686
+
687
+ it "should find a b element" do
688
+ expect(watir_browser).to receive(:b).with(:id => 'blah').and_return(watir_browser)
689
+ element = watir_page_object.b_element(:id => 'blah')
690
+ expect(element).to be_instance_of PageObject::Elements::Bold
691
+ end
692
+
693
+ it "should find a b element using a default identifier" do
694
+ expect(watir_browser).to receive(:b).with(:index => 0).and_return(watir_browser)
695
+ watir_page_object.b_element
696
+ end
697
+
698
+ it "should find all b elements" do
699
+ expect(watir_browser).to receive(:bs).with(:id => 'blah').and_return([watir_browser])
700
+ elements = watir_page_object.b_elements(:id => 'blah')
701
+ expect(elements[0]).to be_instance_of PageObject::Elements::Bold
702
+ end
703
+
704
+ it "should find all b elements using no parameters" do
705
+ expect(watir_browser).to receive(:bs).with({}).and_return([watir_browser])
706
+ watir_page_object.b_elements
707
+ end
686
708
  end
687
709
 
688
710
  context "when using Selenium" do
@@ -690,376 +712,389 @@ describe PageObject::ElementLocators do
690
712
  let(:selenium_page_object) { ElementLocatorsTestPageObject.new(selenium_browser) }
691
713
 
692
714
  it "should find a button element" do
693
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
715
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
694
716
  element = selenium_page_object.button_element(:id => 'blah')
695
- element.should be_instance_of PageObject::Elements::Button
717
+ expect(element).to be_instance_of PageObject::Elements::Button
696
718
  end
697
719
 
698
720
  it "should find all button elements" do
699
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
721
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
700
722
  elements = selenium_page_object.button_elements(:id => 'blah')
701
- elements[0].should be_instance_of PageObject::Elements::Button
723
+ expect(elements[0]).to be_instance_of PageObject::Elements::Button
702
724
  end
703
725
 
704
726
  it "should find a text field element" do
705
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
727
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
706
728
  element = selenium_page_object.text_field_element(:id => 'blah')
707
- element.should be_instance_of PageObject::Elements::TextField
729
+ expect(element).to be_instance_of PageObject::Elements::TextField
708
730
  end
709
731
 
710
732
  it "should find all text field elements" do
711
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
733
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
712
734
  elements = selenium_page_object.text_field_elements(:id => 'blah')
713
- elements[0].should be_instance_of PageObject::Elements::TextField
735
+ expect(elements[0]).to be_instance_of PageObject::Elements::TextField
714
736
  end
715
737
 
716
738
  it "should find a hidden field element" do
717
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
739
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
718
740
  element = selenium_page_object.hidden_field_element(:id => 'blah')
719
- element.should be_instance_of PageObject::Elements::HiddenField
741
+ expect(element).to be_instance_of PageObject::Elements::HiddenField
720
742
  end
721
743
 
722
744
  it "should find all hidden field elements" do
723
- selenium_browser.should_receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
745
+ expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
724
746
  elements = selenium_page_object.hidden_field_elements(:id => 'blah')
725
- elements[0].should be_instance_of PageObject::Elements::HiddenField
747
+ expect(elements[0]).to be_instance_of PageObject::Elements::HiddenField
726
748
 
727
749
  end
728
750
 
729
751
  it "should find a text area element" do
730
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
752
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
731
753
  element = selenium_page_object.text_area_element(:id => 'blah')
732
- element.should be_instance_of PageObject::Elements::TextArea
754
+ expect(element).to be_instance_of PageObject::Elements::TextArea
733
755
  end
734
756
 
735
757
  it "should find all text area elements" do
736
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
758
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
737
759
  elements = selenium_page_object.text_area_elements(:id => 'blah')
738
- elements[0].should be_instance_of PageObject::Elements::TextArea
760
+ expect(elements[0]).to be_instance_of PageObject::Elements::TextArea
739
761
  end
740
762
 
741
763
  it "should find a select list element" do
742
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
764
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
743
765
  element = selenium_page_object.select_list_element(:id => 'blah')
744
- element.should be_instance_of PageObject::Elements::SelectList
766
+ expect(element).to be_instance_of PageObject::Elements::SelectList
745
767
  end
746
768
 
747
769
  it "should find all select list elements" do
748
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
770
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
749
771
  elements = selenium_page_object.select_list_elements(:id => 'blah')
750
- elements[0].should be_instance_of PageObject::Elements::SelectList
772
+ expect(elements[0]).to be_instance_of PageObject::Elements::SelectList
751
773
  end
752
774
 
753
775
  it "should find a link element" do
754
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
776
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
755
777
  element = selenium_page_object.link_element(:id => 'blah')
756
- element.should be_instance_of PageObject::Elements::Link
778
+ expect(element).to be_instance_of PageObject::Elements::Link
757
779
  end
758
780
 
759
781
  it "should find all link elements" do
760
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
782
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
761
783
  elements = selenium_page_object.link_elements(:id => 'blah')
762
- elements[0].should be_instance_of PageObject::Elements::Link
784
+ expect(elements[0]).to be_instance_of PageObject::Elements::Link
763
785
  end
764
786
 
765
787
  it "should find a check box" do
766
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
788
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
767
789
  element = selenium_page_object.checkbox_element(:id => 'blah')
768
- element.should be_instance_of PageObject::Elements::CheckBox
790
+ expect(element).to be_instance_of PageObject::Elements::CheckBox
769
791
  end
770
792
 
771
793
  it "should find all checkbox elements" do
772
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
794
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
773
795
  elements = selenium_page_object.checkbox_elements(:id => 'blah')
774
- elements[0].should be_instance_of PageObject::Elements::CheckBox
796
+ expect(elements[0]).to be_instance_of PageObject::Elements::CheckBox
775
797
  end
776
798
 
777
799
  it "should find a radio button" do
778
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
800
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
779
801
  element = selenium_page_object.radio_button_element(:id => 'blah')
780
- element.should be_instance_of PageObject::Elements::RadioButton
802
+ expect(element).to be_instance_of PageObject::Elements::RadioButton
781
803
  end
782
804
 
783
805
  it "should find all radio button elements" do
784
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
806
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
785
807
  elements = selenium_page_object.radio_button_elements(:id => 'blah')
786
- elements[0].should be_instance_of PageObject::Elements::RadioButton
808
+ expect(elements[0]).to be_instance_of PageObject::Elements::RadioButton
787
809
  end
788
810
 
789
811
  it "should find a div" do
790
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
812
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
791
813
  element = selenium_page_object.div_element(:id => 'blah')
792
- element.should be_instance_of PageObject::Elements::Div
814
+ expect(element).to be_instance_of PageObject::Elements::Div
793
815
  end
794
816
 
795
817
  it "should find all div elements" do
796
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
818
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
797
819
  elements = selenium_page_object.div_elements(:id => 'blah')
798
- elements[0].should be_instance_of PageObject::Elements::Div
820
+ expect(elements[0]).to be_instance_of PageObject::Elements::Div
799
821
  end
800
822
 
801
823
  it "should find a span" do
802
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
824
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
803
825
  element = selenium_page_object.span_element(:id => 'blah')
804
- element.should be_instance_of PageObject::Elements::Span
826
+ expect(element).to be_instance_of PageObject::Elements::Span
805
827
  end
806
828
 
807
829
  it "should find all span elements" do
808
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
830
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
809
831
  elements = selenium_page_object.span_elements(:id => 'blah')
810
- elements[0].should be_instance_of PageObject::Elements::Span
832
+ expect(elements[0]).to be_instance_of PageObject::Elements::Span
811
833
  end
812
834
 
813
835
  it "should find a table" do
814
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
836
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
815
837
  element = selenium_page_object.table_element(:id => 'blah')
816
- element.should be_instance_of PageObject::Elements::Table
838
+ expect(element).to be_instance_of PageObject::Elements::Table
817
839
  end
818
840
 
819
841
  it "should find all table elements" do
820
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
842
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
821
843
  elements = selenium_page_object.table_elements(:id => 'blah')
822
- elements[0].should be_instance_of PageObject::Elements::Table
844
+ expect(elements[0]).to be_instance_of PageObject::Elements::Table
823
845
  end
824
846
 
825
847
  it "should find a table cell" do
826
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
848
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
827
849
  element = selenium_page_object.cell_element(:id => 'blah')
828
- element.should be_instance_of PageObject::Elements::TableCell
850
+ expect(element).to be_instance_of PageObject::Elements::TableCell
829
851
  end
830
852
 
831
853
  it "should find all table cell elements" do
832
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
854
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
833
855
  elements = selenium_page_object.cell_elements(:id => 'blah')
834
- elements[0].should be_instance_of PageObject::Elements::TableCell
856
+ expect(elements[0]).to be_instance_of PageObject::Elements::TableCell
835
857
  end
836
858
 
837
859
  it "should find an image" do
838
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
860
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
839
861
  element = selenium_page_object.image_element(:id => 'blah')
840
- element.should be_instance_of PageObject::Elements::Image
862
+ expect(element).to be_instance_of PageObject::Elements::Image
841
863
  end
842
864
 
843
865
  it "should find all image elements" do
844
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
866
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
845
867
  elements = selenium_page_object.image_elements(:id => 'blah')
846
- elements[0].should be_instance_of PageObject::Elements::Image
868
+ expect(elements[0]).to be_instance_of PageObject::Elements::Image
847
869
  end
848
870
 
849
871
  it "should find a form" do
850
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
872
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
851
873
  element = selenium_page_object.form_element(:id => 'blah')
852
- element.should be_instance_of PageObject::Elements::Form
874
+ expect(element).to be_instance_of PageObject::Elements::Form
853
875
  end
854
876
 
855
877
  it "should find all forms" do
856
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
878
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
857
879
  elements = selenium_page_object.form_elements(:id => 'blah')
858
- elements[0].should be_instance_of PageObject::Elements::Form
880
+ expect(elements[0]).to be_instance_of PageObject::Elements::Form
859
881
  end
860
882
 
861
883
  it "should find a list item" do
862
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
884
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
863
885
  element = selenium_page_object.list_item_element(:id => 'blah')
864
- element.should be_instance_of PageObject::Elements::ListItem
886
+ expect(element).to be_instance_of PageObject::Elements::ListItem
865
887
  end
866
888
 
867
889
  it "should find all list items" do
868
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
890
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
869
891
  element = selenium_page_object.list_item_elements(:id => 'blah')
870
- element[0].should be_instance_of PageObject::Elements::ListItem
892
+ expect(element[0]).to be_instance_of PageObject::Elements::ListItem
871
893
  end
872
894
 
873
895
  it "should find an unordered list" do
874
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
896
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
875
897
  element = selenium_page_object.unordered_list_element(:id => 'blah')
876
- element.should be_instance_of PageObject::Elements::UnorderedList
898
+ expect(element).to be_instance_of PageObject::Elements::UnorderedList
877
899
  end
878
900
 
879
901
  it "should find all unordered lists" do
880
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
902
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
881
903
  elements = selenium_page_object.unordered_list_elements(:id => 'blah')
882
- elements[0].should be_instance_of PageObject::Elements::UnorderedList
904
+ expect(elements[0]).to be_instance_of PageObject::Elements::UnorderedList
883
905
  end
884
906
 
885
907
  it "should find an ordered list" do
886
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
908
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
887
909
  element = selenium_page_object.ordered_list_element(:id => 'blah')
888
- element.should be_instance_of PageObject::Elements::OrderedList
910
+ expect(element).to be_instance_of PageObject::Elements::OrderedList
889
911
  end
890
912
 
891
913
  it "should find all orderd list elements" do
892
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
914
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
893
915
  elements = selenium_page_object.ordered_list_elements(:id => 'blah')
894
- elements[0].should be_instance_of PageObject::Elements::OrderedList
916
+ expect(elements[0]).to be_instance_of PageObject::Elements::OrderedList
895
917
  end
896
918
 
897
919
  it "should find a h1 element" do
898
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
920
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
899
921
  element = selenium_page_object.h1_element(:id => 'blah')
900
- element.should be_instance_of PageObject::Elements::Heading
922
+ expect(element).to be_instance_of PageObject::Elements::Heading
901
923
  end
902
924
 
903
925
  it "should find all h1 elements" do
904
- selenium_browser.should_receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
926
+ expect(selenium_browser).to receive(:find_elements).with(:id, "blah").and_return([selenium_browser])
905
927
  elements = selenium_page_object.h1_elements(:id => 'blah')
906
- elements[0].should be_instance_of PageObject::Elements::Heading
928
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
907
929
  end
908
930
 
909
931
  it "should find a h2 element" do
910
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
932
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
911
933
  element = selenium_page_object.h2_element(:id => 'blah')
912
- element.should be_instance_of PageObject::Elements::Heading
934
+ expect(element).to be_instance_of PageObject::Elements::Heading
913
935
  end
914
936
 
915
937
  it "should find all h2 elements" do
916
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
938
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
917
939
  elements = selenium_page_object.h2_elements(:id => 'blah')
918
- elements[0].should be_instance_of PageObject::Elements::Heading
940
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
919
941
  end
920
942
 
921
943
  it "should find a h3 element" do
922
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
944
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
923
945
  element = selenium_page_object.h3_element(:id => 'blah')
924
- element.should be_instance_of PageObject::Elements::Heading
946
+ expect(element).to be_instance_of PageObject::Elements::Heading
925
947
  end
926
948
 
927
949
  it "should find all h3 elements" do
928
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
950
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
929
951
  elements = selenium_page_object.h3_elements(:id => 'blah')
930
- elements[0].should be_instance_of PageObject::Elements::Heading
952
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
931
953
  end
932
954
 
933
955
  it "should find a h4 element" do
934
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
956
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
935
957
  element = selenium_page_object.h4_element(:id => 'blah')
936
- element.should be_instance_of PageObject::Elements::Heading
958
+ expect(element).to be_instance_of PageObject::Elements::Heading
937
959
  end
938
960
 
939
961
  it "should find all h4 elements" do
940
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
962
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
941
963
  elements = selenium_page_object.h4_elements(:id => 'blah')
942
- elements[0].should be_instance_of PageObject::Elements::Heading
964
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
943
965
  end
944
966
 
945
967
  it "should find a h5 element" do
946
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
968
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
947
969
  element = selenium_page_object.h5_element(:id => 'blah')
948
- element.should be_instance_of PageObject::Elements::Heading
970
+ expect(element).to be_instance_of PageObject::Elements::Heading
949
971
  end
950
972
 
951
973
  it "should find all h5 elements" do
952
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
974
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
953
975
  elements = selenium_page_object.h5_elements(:id => 'blah')
954
- elements[0].should be_instance_of PageObject::Elements::Heading
976
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
955
977
  end
956
978
 
957
979
  it "should find a h6 element" do
958
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
980
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
959
981
  element = selenium_page_object.h6_element(:id => 'blah')
960
- element.should be_instance_of PageObject::Elements::Heading
982
+ expect(element).to be_instance_of PageObject::Elements::Heading
961
983
  end
962
984
 
963
985
  it "should find all h6 elements" do
964
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
986
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
965
987
  elements = selenium_page_object.h6_elements(:id => 'blah')
966
- elements[0].should be_instance_of PageObject::Elements::Heading
988
+ expect(elements[0]).to be_instance_of PageObject::Elements::Heading
967
989
  end
968
990
 
969
991
  it "should find a paragraph element" do
970
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
992
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
971
993
  element = selenium_page_object.paragraph_element(:id => 'blah')
972
- element.should be_instance_of PageObject::Elements::Paragraph
994
+ expect(element).to be_instance_of PageObject::Elements::Paragraph
973
995
  end
974
996
 
975
997
  it "should find all paragraph elements" do
976
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
998
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
977
999
  elements = selenium_page_object.paragraph_elements(:id => 'blah')
978
- elements[0].should be_instance_of PageObject::Elements::Paragraph
1000
+ expect(elements[0]).to be_instance_of PageObject::Elements::Paragraph
979
1001
  end
980
1002
 
981
1003
  it "should find a label" do
982
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1004
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
983
1005
  element = selenium_page_object.label_element(:id => 'blah')
984
- element.should be_instance_of PageObject::Elements::Label
1006
+ expect(element).to be_instance_of PageObject::Elements::Label
985
1007
  end
986
1008
 
987
1009
  it "should find all label elements" do
988
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1010
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
989
1011
  elements = selenium_page_object.label_elements(:id => 'blah')
990
- elements[0].should be_instance_of PageObject::Elements::Label
1012
+ expect(elements[0]).to be_instance_of PageObject::Elements::Label
991
1013
  end
992
1014
 
993
1015
  it "should find a file field element" do
994
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1016
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
995
1017
  element = selenium_page_object.file_field_element(:id => 'blah')
996
- element.should be_instance_of PageObject::Elements::FileField
1018
+ expect(element).to be_instance_of PageObject::Elements::FileField
997
1019
  end
998
1020
 
999
1021
  it "should find an area element" do
1000
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1022
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1001
1023
  element = selenium_page_object.area_element(:id => 'blah')
1002
- element.should be_instance_of PageObject::Elements::Area
1024
+ expect(element).to be_instance_of PageObject::Elements::Area
1003
1025
  end
1004
1026
 
1005
1027
  it "should find an area element using a default identifier" do
1006
- selenium_browser.should_receive(:find_element).with(:xpath, '(.//area)[1]').and_return(selenium_browser)
1028
+ expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//area)[1]').and_return(selenium_browser)
1007
1029
  selenium_page_object.area_element
1008
1030
  end
1009
1031
 
1010
1032
  it "should find all area elements" do
1011
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1033
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1012
1034
  elements = selenium_page_object.area_elements(:id => 'blah')
1013
- elements[0].should be_instance_of PageObject::Elements::Area
1035
+ expect(elements[0]).to be_instance_of PageObject::Elements::Area
1014
1036
  end
1015
1037
 
1016
1038
  it "should find all areas with no identifier" do
1017
- selenium_browser.should_receive(:find_elements).with(:tag_name, 'area').and_return([selenium_browser])
1039
+ expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'area').and_return([selenium_browser])
1018
1040
  selenium_page_object.area_elements
1019
1041
  end
1020
1042
 
1021
1043
  it "should find a canvas element" do
1022
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1044
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1023
1045
  element = selenium_page_object.canvas_element(:id => 'blah')
1024
- element.should be_instance_of PageObject::Elements::Canvas
1046
+ expect(element).to be_instance_of PageObject::Elements::Canvas
1025
1047
  end
1026
1048
 
1027
1049
  it "should find a canvas element using a default identifier" do
1028
- selenium_browser.should_receive(:find_element).with(:xpath, '(.//canvas)[1]').and_return(selenium_browser)
1050
+ expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//canvas)[1]').and_return(selenium_browser)
1029
1051
  selenium_page_object.canvas_element
1030
1052
  end
1031
1053
 
1032
1054
  it "should find all canvas elements" do
1033
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1055
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1034
1056
  elements = selenium_page_object.canvas_elements(:id => 'blah')
1035
- elements[0].should be_instance_of PageObject::Elements::Canvas
1057
+ expect(elements[0]).to be_instance_of PageObject::Elements::Canvas
1036
1058
  end
1037
1059
 
1038
1060
  it "should find all canvases with no identifier" do
1039
- selenium_browser.should_receive(:find_elements).with(:tag_name, 'canvas').and_return([selenium_browser])
1061
+ expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'canvas').and_return([selenium_browser])
1040
1062
  selenium_page_object.canvas_elements
1041
1063
  end
1042
1064
 
1043
1065
  it "should find an audio element" do
1044
- selenium_browser.should_receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1066
+ expect(selenium_browser).to receive(:find_element).with(:id, 'blah').and_return(selenium_browser)
1045
1067
  element = selenium_page_object.audio_element(:id => 'blah')
1046
- element.should be_instance_of PageObject::Elements::Audio
1068
+ expect(element).to be_instance_of PageObject::Elements::Audio
1047
1069
  end
1048
1070
 
1049
1071
  it "should find an audio element using a default identifier" do
1050
- selenium_browser.should_receive(:find_element).with(:xpath, '(.//audio)[1]').and_return(selenium_browser)
1072
+ expect(selenium_browser).to receive(:find_element).with(:xpath, '(.//audio)[1]').and_return(selenium_browser)
1051
1073
  selenium_page_object.audio_element
1052
1074
  end
1053
1075
 
1054
1076
  it "should find all audio elements" do
1055
- selenium_browser.should_receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1077
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1056
1078
  elements = selenium_page_object.audio_elements(:id => 'blah')
1057
- elements[0].should be_instance_of PageObject::Elements::Audio
1079
+ expect(elements[0]).to be_instance_of PageObject::Elements::Audio
1058
1080
  end
1059
1081
 
1060
1082
  it "should find all audio elements with no identifier" do
1061
- selenium_browser.should_receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
1083
+ expect(selenium_browser).to receive(:find_elements).with(:tag_name, 'audio').and_return([selenium_browser])
1062
1084
  selenium_page_object.audio_elements
1063
1085
  end
1086
+ it "should find a b element" do
1087
+ expect(selenium_browser).to receive(:find_element).with(:id,'blah').and_return(selenium_browser)
1088
+ element = selenium_page_object.b_element(:id => 'blah')
1089
+ expect(element).to be_instance_of PageObject::Elements::Bold
1090
+ end
1091
+
1092
+
1093
+ it "should find all b elements" do
1094
+ expect(selenium_browser).to receive(:find_elements).with(:id, 'blah').and_return([selenium_browser])
1095
+ elements = selenium_page_object.b_elements(:id => 'blah')
1096
+ expect(elements[0]).to be_instance_of PageObject::Elements::Bold
1097
+ end
1098
+
1064
1099
  end
1065
1100
  end