page-object 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57c5a8da1b4a77ac97b046eb45e31f31c722f582
4
- data.tar.gz: c8d6294e1bcef01a78de3a5e838797e1849ebb0e
3
+ metadata.gz: 6c01b813ea17360d98a97206dd1dc24a8928c9dd
4
+ data.tar.gz: 9cc17aafde0461e9c883e97415ae0d642e979f7f
5
5
  SHA512:
6
- metadata.gz: 183517e15ac353352f873991c8291c57f9ffb90be4675888870781c83c402ab876fcbc36258a59f84aa0689b37fff6803befd9a45d8f1837d87ddd4a65b8588b
7
- data.tar.gz: bc21e0e935391523de3ce529cdc33c865ee7cd3b037bba146b9535c471ac4da9249a4e74f9598ecabff71029bc9781d9cf585ef76d76ed489296b015e9b849af
6
+ metadata.gz: 8de08d4d39d7fb91fdaf4fa9d38a430a649502c1d0ffb47eb92d20e60ec5699c60ea73801828eb4e5a90ccd5774379dd4649151b844f7f4dc166e8589467957f
7
+ data.tar.gz: ff1478fc9c7438771b0ac4e427a00230950e47e2933c259ebae7ea8a3c7a61b573e010b90b6653d67af2edd7b03b0f9ab413c06d3f1a1717a7c202469ac71272
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ === Version 0.9.2 / 2013-8-23
2
+ * Enhancements
3
+ * Added elements method to accessor so one can gen methods for generic collections of elements
4
+ * Updated to use the latest selenium-webdriver 2.35.0
5
+
1
6
  === Version 0.9.1 / 2013-7-16
2
7
  * Enhancements
3
8
  * Added css locator support for Image (Thanks Elben Shira)
data/README.md CHANGED
@@ -9,7 +9,7 @@ A simple gem that assists in creating flexible page objects for testing browser
9
9
 
10
10
  The project [wiki](https://github.com/cheezy/page-object/wiki/page-object) is the first place to go to learn about how to use page-object.
11
11
 
12
- The rdocs for this project can be found at [rubydoc.info](http://rubydoc.info/github/cheezy/page-object/master/frames).
12
+ The rdocs for this project can be found at [rubydoc.info](http://rubydoc.info/gems/page-object/frames).
13
13
 
14
14
  To see the changes from release to release please look at the [ChangeLog](https://raw.github.com/cheezy/page-object/master/ChangeLog)
15
15
 
@@ -477,3 +477,11 @@ Feature: Multi Elements
477
477
  And the title for file field 1 should be "File Field 1"
478
478
  And the title for file field 2 should be "File Field 2"
479
479
  And the title for file field 3 should be "File Field 3"
480
+
481
+ @focus
482
+ Scenario: Selecting multple generic element types
483
+ When I select the multiple elements with a tag label
484
+ Then I should have 3 labels
485
+ And the text for label 1 should be "Label 1"
486
+ And the text for label 2 should be "Label 2"
487
+ And the text for label 3 should be "Label 3"
@@ -30,6 +30,7 @@ class MultiElementsPage
30
30
  paragraphs(:the_paragraphs, :class => 'p')
31
31
  labels(:the_labels, :class => 'label')
32
32
  file_fields(:the_file_fields, :class => 'file_field_class')
33
+ elements(:generic_label, :label, :class => 'label')
33
34
  end
34
35
 
35
36
 
@@ -521,3 +522,7 @@ end
521
522
  When /^I select the divs using a block$/ do
522
523
  @elements = @page.block_divs_elements
523
524
  end
525
+
526
+ When(/^I select the multiple elements with a tag label$/) do
527
+ @elements = @page.generic_label_elements
528
+ end
@@ -1001,6 +1001,30 @@ module PageObject
1001
1001
  standard_methods(name, identifier, 'video_for', &block)
1002
1002
  end
1003
1003
 
1004
+ #
1005
+ # adds two methods - one to retrieve a svg, and another to check
1006
+ # the svg's existence.
1007
+ #
1008
+ # @example
1009
+ # svg(:circle, :id => 'circle')
1010
+ # # will generate 'circle_element', and 'circle?' methods
1011
+ #
1012
+ # @param [Symbol] the name used for the generated methods
1013
+ # @param [Hash] identifier how we find a svg. You can use a multiple paramaters
1014
+ # by combining of any of the following except xpath. The valid keys are:
1015
+ # * :class => Watir and Selenium
1016
+ # * :css => Selenium only
1017
+ # * :id => Watir and Selenium
1018
+ # * :index => Watir and Selenium
1019
+ # * :name => Watir and Selenium
1020
+ # * :xpath => Watir and Selenium
1021
+ # @param optional block to be invoked when element method is called
1022
+ #
1023
+ def svg(name, identifier={:index => 0}, &block)
1024
+ standard_methods(name, identifier, 'svg_for', &block)
1025
+ end
1026
+
1027
+
1004
1028
  #
1005
1029
  # adds three methods - one to retrieve the text of an element, another
1006
1030
  # to retrieve an element, and another to check the element's existence.
@@ -1035,15 +1059,16 @@ module PageObject
1035
1059
  end
1036
1060
 
1037
1061
  #
1038
- # adds two methods - one to retrieve a svg, and another to check
1039
- # the svg's existence.
1062
+ # adds a method to return a collection of generic Element objects
1063
+ # for a specific tag.
1040
1064
  #
1041
1065
  # @example
1042
- # svg(:circle, :id => 'circle')
1043
- # # will generate 'circle_element', and 'circle?' methods
1066
+ # elements(:title, :header, :id => 'title')
1067
+ # # will generate ''title_elements'
1044
1068
  #
1045
1069
  # @param [Symbol] the name used for the generated methods
1046
- # @param [Hash] identifier how we find a svg. You can use a multiple paramaters
1070
+ # @param [Symbol] the name of the tag for the element
1071
+ # @param [Hash] identifier how we find an element. You can use a multiple paramaters
1047
1072
  # by combining of any of the following except xpath. The valid keys are:
1048
1073
  # * :class => Watir and Selenium
1049
1074
  # * :css => Selenium only
@@ -1053,18 +1078,22 @@ module PageObject
1053
1078
  # * :xpath => Watir and Selenium
1054
1079
  # @param optional block to be invoked when element method is called
1055
1080
  #
1056
- def svg(name, identifier={:index => 0}, &block)
1057
- standard_methods(name, identifier, 'svg_for', &block)
1081
+ def elements(name, tag, identifier={:index => 0}, &block)
1082
+ define_method("#{name}_elements") do
1083
+ return call_block(&block) if block_given?
1084
+ platform.elements_for(tag, identifier.clone)
1085
+ end
1058
1086
  end
1059
1087
 
1060
-
1061
1088
  #
1062
1089
  # methods to generate accessors for types that follow the same
1063
1090
  # pattern as element
1064
1091
  #
1065
1092
  # @example
1066
- # address(:home_address, :id => "home_address")
1067
- # will generate 'home_address', 'home_address_element' and 'home_address?'
1093
+ # article(:my_article, :id => "article_id")
1094
+ # will generate 'my_article', 'my_article_element' and 'my_article?'
1095
+ # articles(:my_article, :id => 'article_id')
1096
+ # will generate 'my_article_elements'
1068
1097
  #
1069
1098
  # @param [Symbol] the name used for the generated methods
1070
1099
  # @param [Symbol] the name of the tag for the element
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "0.9.1"
3
+ VERSION = "0.9.2"
4
4
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
 
23
23
  s.add_dependency 'watir-webdriver', '>= 0.6.4'
24
- s.add_dependency 'selenium-webdriver', '>= 2.33.0'
24
+ s.add_dependency 'selenium-webdriver', '>= 2.35.0'
25
25
  s.add_dependency 'page_navigation', '>= 0.8'
26
26
 
27
27
  s.add_development_dependency 'rspec', '>= 2.12.0'
@@ -17,28 +17,28 @@ require 'page-object'
17
17
 
18
18
  def mock_watir_browser
19
19
  watir_browser = double('watir')
20
- watir_browser.stub!(:is_a?).with(anything()).and_return(false)
21
- watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
20
+ watir_browser.stub(:is_a?).with(anything()).and_return(false)
21
+ watir_browser.stub(:is_a?).with(Watir::Browser).and_return(true)
22
22
  watir_browser
23
23
  end
24
24
 
25
25
 
26
26
  def mock_selenium_browser
27
27
  selenium_browser = double('selenium')
28
- selenium_browser.stub!(:is_a?).with(Watir::Browser).and_return(false)
29
- selenium_browser.stub!(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
28
+ selenium_browser.stub(:is_a?).with(Watir::Browser).and_return(false)
29
+ selenium_browser.stub(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
30
30
  selenium_browser
31
31
  end
32
32
 
33
33
 
34
34
  def mock_adapter(browser, page_object)
35
35
  adapter = double('adapter')
36
- adapter.stub!(:is_for?).with(anything()).and_return false
37
- adapter.stub!(:is_for?).with(browser).and_return true
38
- adapter.stub!(:create_page_object).and_return page_object
36
+ adapter.stub(:is_for?).with(anything()).and_return false
37
+ adapter.stub(:is_for?).with(browser).and_return true
38
+ adapter.stub(:create_page_object).and_return page_object
39
39
  adapter
40
40
  end
41
41
 
42
42
  def mock_adapters(adapters)
43
- PageObject::Platforms.stub!(:get).and_return adapters
43
+ PageObject::Platforms.stub(:get).and_return adapters
44
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2013-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.33.0
33
+ version: 2.35.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.33.0
40
+ version: 2.35.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: page_navigation
43
43
  requirement: !ruby/object:Gem::Requirement