page-object 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -1
  3. data/.gitignore +8 -8
  4. data/.rspec +2 -2
  5. data/.ruby-gemset +1 -1
  6. data/.ruby-version +1 -1
  7. data/.travis.yml +17 -17
  8. data/ChangeLog +923 -916
  9. data/Gemfile +13 -13
  10. data/Guardfile +20 -20
  11. data/LICENSE +20 -20
  12. data/README.md +114 -114
  13. data/Rakefile +29 -29
  14. data/cucumber.yml +8 -8
  15. data/lib/page-object.rb +431 -420
  16. data/lib/page-object/accessors.rb +1201 -1175
  17. data/lib/page-object/element_locators.rb +21 -21
  18. data/lib/page-object/elements.rb +62 -61
  19. data/lib/page-object/elements/area.rb +9 -9
  20. data/lib/page-object/elements/audio.rb +9 -9
  21. data/lib/page-object/elements/bold.rb +9 -9
  22. data/lib/page-object/elements/button.rb +12 -12
  23. data/lib/page-object/elements/canvas.rb +10 -10
  24. data/lib/page-object/elements/check_box.rb +9 -9
  25. data/lib/page-object/elements/date_field.rb +10 -0
  26. data/lib/page-object/elements/div.rb +9 -9
  27. data/lib/page-object/elements/element.rb +212 -209
  28. data/lib/page-object/elements/file_field.rb +9 -9
  29. data/lib/page-object/elements/form.rb +9 -9
  30. data/lib/page-object/elements/heading.rb +14 -14
  31. data/lib/page-object/elements/hidden_field.rb +9 -9
  32. data/lib/page-object/elements/image.rb +10 -10
  33. data/lib/page-object/elements/italic.rb +9 -9
  34. data/lib/page-object/elements/label.rb +9 -9
  35. data/lib/page-object/elements/link.rb +9 -9
  36. data/lib/page-object/elements/list_item.rb +9 -9
  37. data/lib/page-object/elements/media.rb +11 -11
  38. data/lib/page-object/elements/option.rb +9 -9
  39. data/lib/page-object/elements/ordered_list.rb +43 -43
  40. data/lib/page-object/elements/paragraph.rb +9 -9
  41. data/lib/page-object/elements/radio_button.rb +9 -9
  42. data/lib/page-object/elements/select_list.rb +42 -42
  43. data/lib/page-object/elements/span.rb +9 -9
  44. data/lib/page-object/elements/table.rb +85 -85
  45. data/lib/page-object/elements/table_cell.rb +10 -10
  46. data/lib/page-object/elements/table_row.rb +52 -52
  47. data/lib/page-object/elements/text_area.rb +9 -9
  48. data/lib/page-object/elements/text_field.rb +10 -10
  49. data/lib/page-object/elements/unordered_list.rb +42 -42
  50. data/lib/page-object/elements/video.rb +9 -9
  51. data/lib/page-object/indexed_properties.rb +41 -41
  52. data/lib/page-object/javascript/angularjs.rb +14 -14
  53. data/lib/page-object/javascript/jquery.rb +14 -14
  54. data/lib/page-object/javascript/prototype.rb +14 -14
  55. data/lib/page-object/javascript/yui.rb +18 -18
  56. data/lib/page-object/javascript_framework_facade.rb +80 -80
  57. data/lib/page-object/locator_generator.rb +183 -182
  58. data/lib/page-object/nested_elements.rb +17 -17
  59. data/lib/page-object/page_factory.rb +108 -108
  60. data/lib/page-object/page_populator.rb +105 -105
  61. data/lib/page-object/platforms/watir.rb +50 -50
  62. data/lib/page-object/platforms/watir/page_object.rb +1155 -1124
  63. data/lib/page-object/section_collection.rb +16 -16
  64. data/lib/page-object/version.rb +4 -4
  65. data/lib/page-object/widgets.rb +98 -98
  66. data/page-object.gemspec +32 -32
  67. metadata +8 -7
@@ -1,16 +1,16 @@
1
- module PageObject
2
- class SectionCollection < Array
3
- def find_by(values_hash)
4
- find do |section|
5
- values_hash.all? { |key, value| value === section.public_send(key) }
6
- end
7
- end
8
-
9
- def select_by(values_hash)
10
- matches = select do |section|
11
- values_hash.all? { |key, value| value === section.public_send(key) }
12
- end
13
- self.class[*matches]
14
- end
15
- end
16
- end
1
+ module PageObject
2
+ class SectionCollection < Array
3
+ def find_by(values_hash)
4
+ find do |section|
5
+ values_hash.all? { |key, value| value === section.public_send(key) }
6
+ end
7
+ end
8
+
9
+ def select_by(values_hash)
10
+ matches = select do |section|
11
+ values_hash.all? { |key, value| value === section.public_send(key) }
12
+ end
13
+ self.class[*matches]
14
+ end
15
+ end
16
+ end
@@ -1,4 +1,4 @@
1
- module PageObject
2
- # @private
3
- VERSION = "2.2.6"
4
- end
1
+ module PageObject
2
+ # @private
3
+ VERSION = "2.3.0"
4
+ end
@@ -1,98 +1,98 @@
1
- require 'page-object/elements'
2
- require 'page-object/platforms/watir/page_object'
3
-
4
- module PageObject
5
- module Widgets
6
-
7
- #
8
- # Module that allows for the registration of widget classes which extend the functionality of PageObject
9
- # Allows any classes which extend PageObject::Element to be used as PageObject elements.
10
- # This allows such widgets to be created using the defined tags.
11
- #
12
- # @param [Symbol] defines the symbol which will be used as an accessor name.
13
- # @param [Class] the widget class extending PageObject::Elements::Element
14
- # @param [Symbol] the symbol of the html element used when searching for this widget.
15
- #
16
- #
17
- def self.register_widget(widget_tag, widget_class, base_element_tag)
18
- if widget_class.ancestors.include? Elements::Element
19
- define_accessors(Accessors, widget_tag, widget_class)
20
- define_nested_elements(Elements::Element, widget_tag)
21
- define_locators(PageObject, widget_tag)
22
-
23
- PageObject::Platforms::Watir::PageObject.define_widget_accessors(widget_tag, widget_class, base_element_tag)
24
- end
25
- end
26
-
27
- private
28
-
29
- def self.define_accessors(base, widget_tag, widget_class)
30
- accessors_module = Module.new do
31
- define_method widget_tag do |name, *identifier_args, &block|
32
-
33
- identifier = identifier_args.first
34
- identifier = {:index => 0} if identifier.nil?
35
-
36
- define_method("#{name}_element") do
37
- return call_block(&block) if block
38
- platform.send("#{widget_tag}_for", identifier.clone)
39
- end
40
- define_method("#{name}?") do
41
- return call_block(&block).exists? if block
42
- platform.send("#{widget_tag}_for", identifier.clone).exists?
43
- end
44
- if widget_class.respond_to? :accessor_methods
45
- widget_class.accessor_methods(self, name)
46
- end
47
- end
48
- define_method widget_class.plural_form do |name, *identifier_args, &block|
49
- define_method("#{name}_elements") do
50
- return call_block(&block) unless block.nil?
51
- platform_method = "#{widget_tag.to_s}s_for"
52
- platform.send platform_method, (identifier_args.first ? identifier_args.first.clone : {})
53
- end
54
- end
55
- end
56
-
57
- base.send(:include, accessors_module)
58
- end
59
-
60
- def self.define_nested_elements(base, widget_tag)
61
- define_singular_nested_accessor(base, widget_tag)
62
- define_multiple_nested_accessor(base, widget_tag)
63
- end
64
-
65
- def self.define_multiple_nested_accessor(base, widget_tag)
66
- base.send(:define_method, "#{widget_tag}_elements") do |*args|
67
- identifier = args[0] ? args[0] : {}
68
- @platform.send("#{widget_tag}s_for", identifier.clone)
69
- end
70
- end
71
-
72
- def self.define_singular_nested_accessor(base, widget_tag)
73
- base.send(:define_method, "#{widget_tag}_element") do |*args|
74
- identifier = args[0] ? args[0] : {:index => 0}
75
- @platform.send("#{widget_tag}_for", identifier.clone)
76
- end
77
- end
78
-
79
- def self.define_locators(base, widget_tag)
80
- define_singular_locator(base, widget_tag)
81
- define_multiple_locator(base, widget_tag)
82
- end
83
-
84
- def self.define_multiple_locator(base, widget_tag)
85
- base.send(:define_method, "#{widget_tag}_elements") do |*args|
86
- identifier = args[0] ? args[0] : {}
87
- platform.send("#{widget_tag}s_for", identifier.clone)
88
- end
89
- end
90
-
91
- def self.define_singular_locator(base, widget_tag)
92
- base.send(:define_method, "#{widget_tag}_element") do |*args|
93
- identifier = args[0] ? args[0] : {:index => 0}
94
- platform.send("#{widget_tag}_for", identifier.clone)
95
- end
96
- end
97
- end
98
- end
1
+ require 'page-object/elements'
2
+ require 'page-object/platforms/watir/page_object'
3
+
4
+ module PageObject
5
+ module Widgets
6
+
7
+ #
8
+ # Module that allows for the registration of widget classes which extend the functionality of PageObject
9
+ # Allows any classes which extend PageObject::Element to be used as PageObject elements.
10
+ # This allows such widgets to be created using the defined tags.
11
+ #
12
+ # @param [Symbol] defines the symbol which will be used as an accessor name.
13
+ # @param [Class] the widget class extending PageObject::Elements::Element
14
+ # @param [Symbol] the symbol of the html element used when searching for this widget.
15
+ #
16
+ #
17
+ def self.register_widget(widget_tag, widget_class, base_element_tag)
18
+ if widget_class.ancestors.include? Elements::Element
19
+ define_accessors(Accessors, widget_tag, widget_class)
20
+ define_nested_elements(Elements::Element, widget_tag)
21
+ define_locators(PageObject, widget_tag)
22
+
23
+ PageObject::Platforms::Watir::PageObject.define_widget_accessors(widget_tag, widget_class, base_element_tag)
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def self.define_accessors(base, widget_tag, widget_class)
30
+ accessors_module = Module.new do
31
+ define_method widget_tag do |name, *identifier_args, &block|
32
+
33
+ identifier = identifier_args.first
34
+ identifier = {:index => 0} if identifier.nil?
35
+
36
+ define_method("#{name}_element") do
37
+ return call_block(&block) if block
38
+ platform.send("#{widget_tag}_for", identifier.clone)
39
+ end
40
+ define_method("#{name}?") do
41
+ return call_block(&block).exists? if block
42
+ platform.send("#{widget_tag}_for", identifier.clone).exists?
43
+ end
44
+ if widget_class.respond_to? :accessor_methods
45
+ widget_class.accessor_methods(self, name)
46
+ end
47
+ end
48
+ define_method widget_class.plural_form do |name, *identifier_args, &block|
49
+ define_method("#{name}_elements") do
50
+ return call_block(&block) unless block.nil?
51
+ platform_method = "#{widget_tag.to_s}s_for"
52
+ platform.send platform_method, (identifier_args.first ? identifier_args.first.clone : {})
53
+ end
54
+ end
55
+ end
56
+
57
+ base.send(:include, accessors_module)
58
+ end
59
+
60
+ def self.define_nested_elements(base, widget_tag)
61
+ define_singular_nested_accessor(base, widget_tag)
62
+ define_multiple_nested_accessor(base, widget_tag)
63
+ end
64
+
65
+ def self.define_multiple_nested_accessor(base, widget_tag)
66
+ base.send(:define_method, "#{widget_tag}_elements") do |*args|
67
+ identifier = args[0] ? args[0] : {}
68
+ @platform.send("#{widget_tag}s_for", identifier.clone)
69
+ end
70
+ end
71
+
72
+ def self.define_singular_nested_accessor(base, widget_tag)
73
+ base.send(:define_method, "#{widget_tag}_element") do |*args|
74
+ identifier = args[0] ? args[0] : {:index => 0}
75
+ @platform.send("#{widget_tag}_for", identifier.clone)
76
+ end
77
+ end
78
+
79
+ def self.define_locators(base, widget_tag)
80
+ define_singular_locator(base, widget_tag)
81
+ define_multiple_locator(base, widget_tag)
82
+ end
83
+
84
+ def self.define_multiple_locator(base, widget_tag)
85
+ base.send(:define_method, "#{widget_tag}_elements") do |*args|
86
+ identifier = args[0] ? args[0] : {}
87
+ platform.send("#{widget_tag}s_for", identifier.clone)
88
+ end
89
+ end
90
+
91
+ def self.define_singular_locator(base, widget_tag)
92
+ base.send(:define_method, "#{widget_tag}_element") do |*args|
93
+ identifier = args[0] ? args[0] : {:index => 0}
94
+ platform.send("#{widget_tag}_for", identifier.clone)
95
+ end
96
+ end
97
+ end
98
+ end
data/page-object.gemspec CHANGED
@@ -1,32 +1,32 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "page-object/version"
4
-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "page-object"
8
- s.version = PageObject::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ["Jeff Morgan", 'Alexis Andersen']
11
- s.email = ["jeff.morgan@leandog.com", 'alexis.t.andersen@gmail.com']
12
- s.license = 'MIT'
13
- s.homepage = "http://github.com/cheezy/page-object"
14
- s.summary = %q{Page Object DSL for browser testing}
15
- s.description = %q{Page Object DSL that works with both Watir and Selenium}
16
-
17
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(pkg|spec|features|coverage)/}) }
18
- s.require_paths = ["lib"]
19
-
20
- s.add_dependency 'watir', '~> 6.8'
21
- s.add_dependency 'selenium-webdriver', '~> 3.0'
22
- s.add_dependency 'page_navigation', '>= 0.10'
23
-
24
- s.add_development_dependency 'rspec', '~> 3.0'
25
- s.add_development_dependency 'cucumber', '~> 2.0'
26
- s.add_development_dependency 'yard', '>= 0.7.2'
27
- s.add_development_dependency 'rack', '~> 1.0'
28
- s.add_development_dependency 'coveralls', '~> 0.8.1'
29
- s.add_development_dependency 'net-http-persistent'
30
- s.add_development_dependency 'webdrivers'
31
-
32
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "page-object/version"
4
+
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "page-object"
8
+ s.version = PageObject::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Jeff Morgan", 'Alexis Andersen']
11
+ s.email = ["jeff.morgan@leandog.com", 'alexis.t.andersen@gmail.com']
12
+ s.license = 'MIT'
13
+ s.homepage = "http://github.com/cheezy/page-object"
14
+ s.summary = %q{Page Object DSL for browser testing}
15
+ s.description = %q{Page Object DSL that works with both Watir and Selenium}
16
+
17
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(pkg|spec|features|coverage)/}) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'watir', '>= 6.10.3'
21
+ s.add_dependency 'selenium-webdriver', '~> 3.0'
22
+ s.add_dependency 'page_navigation', '>= 0.10'
23
+
24
+ s.add_development_dependency 'rspec', '~> 3.0'
25
+ s.add_development_dependency 'cucumber', '~> 2.0'
26
+ s.add_development_dependency 'yard', '>= 0.7.2'
27
+ s.add_development_dependency 'rack', '~> 1.0'
28
+ s.add_development_dependency 'coveralls', '~> 0.8.1'
29
+ s.add_development_dependency 'net-http-persistent'
30
+ s.add_development_dependency 'webdrivers'
31
+
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.6
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-03-19 00:00:00.000000000 Z
12
+ date: 2021-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: watir
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '6.8'
20
+ version: 6.10.3
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '6.8'
27
+ version: 6.10.3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: selenium-webdriver
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -182,6 +182,7 @@ files:
182
182
  - lib/page-object/elements/button.rb
183
183
  - lib/page-object/elements/canvas.rb
184
184
  - lib/page-object/elements/check_box.rb
185
+ - lib/page-object/elements/date_field.rb
185
186
  - lib/page-object/elements/div.rb
186
187
  - lib/page-object/elements/element.rb
187
188
  - lib/page-object/elements/file_field.rb
@@ -243,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
244
  - !ruby/object:Gem::Version
244
245
  version: '0'
245
246
  requirements: []
246
- rubygems_version: 3.0.1
247
+ rubygems_version: 3.1.2
247
248
  signing_key:
248
249
  specification_version: 4
249
250
  summary: Page Object DSL for browser testing