page-object 1.2.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/ChangeLog +10 -0
  4. data/Rakefile +4 -4
  5. data/cucumber.yml +1 -1
  6. data/lib/page-object.rb +3 -3
  7. data/lib/page-object/loads_platform.rb +1 -1
  8. data/lib/page-object/platforms.rb +1 -1
  9. data/lib/page-object/platforms/selenium_webdriver/element.rb +9 -2
  10. data/lib/page-object/platforms/{watir_webdriver.rb → watir.rb} +3 -3
  11. data/lib/page-object/platforms/{watir_webdriver → watir}/check_box.rb +0 -0
  12. data/lib/page-object/platforms/{watir_webdriver → watir}/element.rb +13 -11
  13. data/lib/page-object/platforms/{watir_webdriver → watir}/file_field.rb +0 -0
  14. data/lib/page-object/platforms/{watir_webdriver → watir}/form.rb +0 -0
  15. data/lib/page-object/platforms/{watir_webdriver → watir}/image.rb +0 -0
  16. data/lib/page-object/platforms/{watir_webdriver → watir}/link.rb +0 -0
  17. data/lib/page-object/platforms/{watir_webdriver → watir}/ordered_list.rb +1 -1
  18. data/lib/page-object/platforms/{watir_webdriver → watir}/page_object.rb +3 -3
  19. data/lib/page-object/platforms/{watir_webdriver → watir}/radio_button.rb +0 -0
  20. data/lib/page-object/platforms/{watir_webdriver → watir}/select_list.rb +0 -0
  21. data/lib/page-object/platforms/{watir_webdriver → watir}/table.rb +0 -0
  22. data/lib/page-object/platforms/{watir_webdriver → watir}/table_row.rb +0 -0
  23. data/lib/page-object/platforms/{watir_webdriver → watir}/text_area.rb +0 -0
  24. data/lib/page-object/platforms/{watir_webdriver → watir}/text_field.rb +0 -0
  25. data/lib/page-object/platforms/{watir_webdriver → watir}/unordered_list.rb +1 -1
  26. data/lib/page-object/version.rb +1 -1
  27. data/lib/page-object/widgets.rb +1 -1
  28. data/page-object.gemspec +17 -2
  29. metadata +38 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3d2034dbff53c42fded74c511a9a8aa23bd61a9
4
- data.tar.gz: cc1b2933090ed29a3e985be60cf10a3d5d1c5ea6
3
+ metadata.gz: bd4df22c84861242c7966223ea92954fadee7da8
4
+ data.tar.gz: 02756b9b394d920567793cf474ed2c175428c79b
5
5
  SHA512:
6
- metadata.gz: 10dd2880b3f32b28f2f3a1e2d6901920c4fd2cc73baee209b2c8535ffd3395c6a0be298e1a46c600c01a5050dc47b8fb188158e740731be319453347ee4c4d62
7
- data.tar.gz: c5dc09715ec9f42c0e5f95e58c6f2385d6d18ad90c223227cf18e151e205c73c0fbba81250d98be5678bf64243862e809820984b7da41ddd1fed80428d08226e
6
+ metadata.gz: 8d067360ea72b18ba508339efb5504d631b31fb55ef8a67d0cdb582b627fb57196d5818cd76fae440094d00ecd0ca1f19e1a426581ecdd887d7965d9ed6f89b4
7
+ data.tar.gz: 87c90ae9d1602f49c4cc203a5b1f2e4b1699412383f244deee88cdf1a94f4a07077f668459ee4ac2c34448e8ef72d9671aa06d96ddfc1baf68aecaa6136bc3fd
@@ -21,5 +21,5 @@ before_script:
21
21
  script: bundle exec rake $RAKE_TASK
22
22
  env:
23
23
  - RAKE_TASK=spec
24
- - RAKE_TASK=features:watir_webdriver WATIR_BRANCH=master
25
- - RAKE_TASK=features:selenium_webdriver
24
+ - RAKE_TASK=features:watir WATIR_BRANCH=master
25
+ - RAKE_TASK=features:selenium
data/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ Version 2.0.0 / 2016-11-22
2
+ * Enhancements
3
+ * Added focused? method on element. (Thanks Joe Schulte)
4
+ * Updated to use Watir 6 instead of Watir-Webdriver (Thanks Robert MacCracken)
5
+ This change requires updates to your project. You will need to update your
6
+ Gemfile to use 'watir' instead of 'watir-webdriver' and you will need to
7
+ update any require statement you might have. Also, Watir 6 is more strick
8
+ with text_field and text_area. You will have to use the proper one or it
9
+ will not locate the element.
10
+
1
11
  Version 1.2.2 / 2016-11-17
2
12
  * Fixes
3
13
  * Fixed a bug that was introduced in the latest release
data/Rakefile CHANGED
@@ -15,16 +15,16 @@ end
15
15
  task :spec
16
16
 
17
17
  namespace :features do
18
- Cucumber::Rake::Task.new(:watir_webdriver, "Run features with Watir") do |t|
19
- t.profile = "watir_webdriver"
18
+ Cucumber::Rake::Task.new(:watir, "Run features with Watir") do |t|
19
+ t.profile = "watir"
20
20
  end
21
21
 
22
- Cucumber::Rake::Task.new(:selenium_webdriver, "Run features with Selenium") do |t|
22
+ Cucumber::Rake::Task.new(:selenium, "Run features with Selenium") do |t|
23
23
  t.profile = "selenium_webdriver"
24
24
  end
25
25
 
26
26
  desc 'Run all features'
27
- task :all => [:watir_webdriver, :selenium_webdriver]
27
+ task :all => [:watir, :selenium]
28
28
  end
29
29
 
30
30
  desc 'Run all specs and cukes'
@@ -3,7 +3,7 @@ std_opts = "--no-source --color --format pretty" # Cucumber::Formatter::Fuubar"
3
3
  %>
4
4
 
5
5
  default: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
6
- watir_webdriver: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
6
+ watir: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only
7
7
  selenium_webdriver: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only
8
8
  focus: DRIVER=WATIR <%= std_opts %> --tags ~@selenium_only --tags @focus
9
9
  #focus: DRIVER=SELENIUM <%= std_opts %> --tags ~@watir_only --tags @focus
@@ -10,9 +10,9 @@ require 'page-object/indexed_properties'
10
10
  require 'page-object/section_collection'
11
11
  require 'page-object/widgets'
12
12
 
13
- require 'watir-webdriver'
14
- require 'page-object/platforms/watir_webdriver/element'
15
- require 'page-object/platforms/watir_webdriver/page_object'
13
+ require 'watir'
14
+ require 'page-object/platforms/watir/element'
15
+ require 'page-object/platforms/watir/page_object'
16
16
  require 'page-object/platforms/selenium_webdriver/element'
17
17
  require 'page-object/platforms/selenium_webdriver/page_object'
18
18
 
@@ -8,7 +8,7 @@ module PageObject
8
8
  # Determines which platform the Page Object should use based upon browser
9
9
  #
10
10
  # @example
11
- # platform = load_platform(watir_webdriver_browser, PageObject.Adapters.list).send(:new, watir_webdriver_browser)
11
+ # platform = load_platform(watir_browser, PageObject.Adapters.list).send(:new, watir_browser)
12
12
  #
13
13
  # @param [Object] A browser driver that has a supported adapter
14
14
  # @param [adapters] a list of adapters that are currently supported
@@ -13,6 +13,6 @@ module PageObject
13
13
  end
14
14
  end
15
15
  end
16
- require 'page-object/platforms/watir_webdriver'
16
+ require 'page-object/platforms/watir'
17
17
  require 'page-object/platforms/selenium_webdriver'
18
18
 
@@ -1,4 +1,4 @@
1
- require 'watir-webdriver/atoms'
1
+ require 'watir/atoms'
2
2
 
3
3
  module PageObject
4
4
  module Platforms
@@ -156,6 +156,13 @@ module PageObject
156
156
  bridge.execute_script("return arguments[0].focus()", element)
157
157
  end
158
158
 
159
+ #
160
+ # return true if an element is focused
161
+ #
162
+ def focused?
163
+ element == bridge.active_element
164
+ end
165
+
159
166
  #
160
167
  # Select the provided text
161
168
  #
@@ -320,7 +327,7 @@ module PageObject
320
327
  private
321
328
 
322
329
  def bridge
323
- bridge = element.instance_variable_get(:@bridge)
330
+ element.instance_variable_get(:@bridge)
324
331
  end
325
332
  end
326
333
  end
@@ -7,7 +7,7 @@ module PageObject
7
7
  end
8
8
 
9
9
  def self.is_for?(browser)
10
- require 'watir-webdriver'
10
+ require 'watir'
11
11
  browser.is_a?(::Watir::Browser) || browser.is_a?(::Watir::HTMLElement)
12
12
  end
13
13
 
@@ -17,7 +17,7 @@ module PageObject
17
17
  end
18
18
 
19
19
  def self.root_element_for root
20
- Elements::Element.new root, :platform => :watir_webdriver if root.is_a? ::Watir::HTMLElement
20
+ Elements::Element.new root, :platform => :watir if root.is_a? ::Watir::HTMLElement
21
21
  end
22
22
 
23
23
  def self.browser_root_for browser
@@ -27,4 +27,4 @@ module PageObject
27
27
  end
28
28
  end
29
29
 
30
- PageObject::Platforms.register(:watir_webdriver, PageObject::Platforms::WatirWebDriver)
30
+ PageObject::Platforms.register(:watir, PageObject::Platforms::WatirWebDriver)
@@ -1,4 +1,4 @@
1
- require 'watir-webdriver/extensions/select_text'
1
+ require 'watir/extensions/select_text'
2
2
 
3
3
  module PageObject
4
4
  module Platforms
@@ -144,6 +144,13 @@ module PageObject
144
144
  element.focus
145
145
  end
146
146
 
147
+ #
148
+ # return true if an element is focused
149
+ #
150
+ def focused?
151
+ element.focused?
152
+ end
153
+
147
154
  #
148
155
  # Select the provided text
149
156
  #
@@ -164,7 +171,7 @@ module PageObject
164
171
  # @param [Integer] (defaults to: 5) seconds to wait before timing out
165
172
  #
166
173
  def when_present(timeout=::PageObject.default_element_wait)
167
- element.wait_until_present(timeout)
174
+ element.wait_until(timeout: timeout, message: "Element not present in #{timeout} seconds", &:present?)
168
175
  self
169
176
  end
170
177
 
@@ -175,7 +182,7 @@ module PageObject
175
182
  # timing out
176
183
  #
177
184
  def when_not_present(timeout=::PageObject.default_element_wait)
178
- element.wait_while_present(timeout)
185
+ element.wait_while(timeout: timeout, message: "Element still present in #{timeout} seconds", &:present?)
179
186
  end
180
187
 
181
188
  #
@@ -184,9 +191,7 @@ module PageObject
184
191
  # @param [Integer] (defaults to: 5) seconds to wait before timing out
185
192
  #
186
193
  def when_visible(timeout=::PageObject.default_element_wait)
187
- Object::Watir::Wait.until(timeout, "Element was not visible in #{timeout} seconds") do
188
- visible?
189
- end
194
+ element.wait_until(timeout: timeout, message: "Element not visible in #{timeout} seconds", &:visible?)
190
195
  self
191
196
  end
192
197
 
@@ -196,10 +201,7 @@ module PageObject
196
201
  # @param [Integer] (defaults to: 5) seconds to wait before timing out
197
202
  #
198
203
  def when_not_visible(timeout=::PageObject.default_element_wait)
199
- Object::Watir::Wait.while(timeout, "Element still visible after #{timeout} seconds") do
200
- visible?
201
- end
202
- self
204
+ element.wait_while(timeout: timeout, message: "Element still visible after #{timeout} seconds", &:visible?)
203
205
  end
204
206
 
205
207
  #
@@ -210,7 +212,7 @@ module PageObject
210
212
  # @param the block to execute when the event occurs
211
213
  #
212
214
  def wait_until(timeout=::PageObject.default_element_wait, message=nil, &block)
213
- Object::Watir::Wait.until(timeout, message, &block)
215
+ Object::Watir::Wait.until(timeout: timeout, message: message, &block)
214
216
  end
215
217
 
216
218
  #
@@ -25,7 +25,7 @@ module PageObject
25
25
  #
26
26
  def list_items
27
27
  children.collect do |obj|
28
- Object::PageObject::Elements::ListItem.new(obj, :platform => :watir_webdriver)
28
+ Object::PageObject::Elements::ListItem.new(obj, :platform => :watir)
29
29
  end
30
30
  end
31
31
 
@@ -14,7 +14,7 @@ module PageObject
14
14
  class PageObject
15
15
  attr_reader :browser
16
16
 
17
- PLATFORM_NAME = :watir_webdriver
17
+ PLATFORM_NAME = :watir
18
18
 
19
19
  def self.define_widget_accessors(widget_tag, widget_class, base_element_tag)
20
20
  define_widget_singular_accessor(base_element_tag, widget_class, widget_tag)
@@ -69,7 +69,7 @@ module PageObject
69
69
  # platform method to wait for a block to return true
70
70
  # See PageObject#wait_until
71
71
  def wait_until(timeout, message = nil, &block)
72
- @browser.wait_until(timeout, message, &block)
72
+ @browser.wait_until(timeout: timeout, message: message, &block)
73
73
  end
74
74
 
75
75
  #
@@ -139,7 +139,7 @@ module PageObject
139
139
  element = browser.execute_script("return document.activeElement")
140
140
  type = element.type.to_sym if element.tag_name.to_sym == :input
141
141
  cls = ::PageObject::Elements.element_class_for(element.tag_name, type)
142
- # cls.new(element, :platform => :watir_webdriver)
142
+ # cls.new(element, :platform => :watir)
143
143
  cls.new(element, :platform => self.class::PLATFORM_NAME)
144
144
  end
145
145
 
@@ -26,7 +26,7 @@ module PageObject
26
26
  #
27
27
  def list_items
28
28
  children.collect do |obj|
29
- Object::PageObject::Elements::ListItem.new(obj, :platform => :watir_webdriver)
29
+ Object::PageObject::Elements::ListItem.new(obj, :platform => :watir)
30
30
  end
31
31
  end
32
32
 
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "1.2.2"
3
+ VERSION = "2.0.0"
4
4
  end
@@ -1,6 +1,6 @@
1
1
  require 'page-object/elements'
2
2
  require 'page-object/platforms/selenium_webdriver/page_object'
3
- require 'page-object/platforms/watir_webdriver/page_object'
3
+ require 'page-object/platforms/watir/page_object'
4
4
 
5
5
  module PageObject
6
6
  module Widgets
@@ -2,6 +2,19 @@
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "page-object/version"
4
4
 
5
+ message =
6
+ """
7
+ This version of the gem moves to using the new Watir gem and away from
8
+ using Watir Webdriver. You will need to update you Gemfile to use `watir`
9
+ instead of `watir-webdriver` and update any `require` statements in your
10
+ code.
11
+
12
+ This is an important move as Watir Webdriver will not be supported any
13
+ longer. All new development has been moved to Watir. There are also
14
+ significant benefits to this move. See the Watir site at
15
+ https://watir.github.io for more details.
16
+ """
17
+
5
18
  Gem::Specification.new do |s|
6
19
  s.name = "page-object"
7
20
  s.version = PageObject::VERSION
@@ -16,8 +29,10 @@ Gem::Specification.new do |s|
16
29
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(pkg|spec|features|coverage)/}) }
17
30
  s.require_paths = ["lib"]
18
31
 
19
- s.add_dependency 'watir-webdriver', ['>= 0.6.11', '< 0.9.9']
20
- s.add_dependency 'selenium-webdriver', '>= 2.53.0'
32
+ s.post_install_message = message
33
+
34
+ s.add_dependency 'watir', '~> 6.0'
35
+ s.add_dependency 'selenium-webdriver', '~> 3.0'
21
36
  s.add_dependency 'page_navigation', '>= 0.9'
22
37
  s.add_dependency 'net-http-persistent', '~> 2.9.4'
23
38
 
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: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
@@ -9,42 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-18 00:00:00.000000000 Z
12
+ date: 2016-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: watir-webdriver
15
+ name: watir
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 0.6.11
21
- - - "<"
18
+ - - "~>"
22
19
  - !ruby/object:Gem::Version
23
- version: 0.9.9
20
+ version: '6.0'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 0.6.11
31
- - - "<"
25
+ - - "~>"
32
26
  - !ruby/object:Gem::Version
33
- version: 0.9.9
27
+ version: '6.0'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: selenium-webdriver
36
30
  requirement: !ruby/object:Gem::Requirement
37
31
  requirements:
38
- - - ">="
32
+ - - "~>"
39
33
  - !ruby/object:Gem::Version
40
- version: 2.53.0
34
+ version: '3.0'
41
35
  type: :runtime
42
36
  prerelease: false
43
37
  version_requirements: !ruby/object:Gem::Requirement
44
38
  requirements:
45
- - - ">="
39
+ - - "~>"
46
40
  - !ruby/object:Gem::Version
47
- version: 2.53.0
41
+ version: '3.0'
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: page_navigation
50
44
  requirement: !ruby/object:Gem::Requirement
@@ -230,22 +224,22 @@ files:
230
224
  - lib/page-object/platforms/selenium_webdriver/text_area.rb
231
225
  - lib/page-object/platforms/selenium_webdriver/text_field.rb
232
226
  - lib/page-object/platforms/selenium_webdriver/unordered_list.rb
233
- - lib/page-object/platforms/watir_webdriver.rb
234
- - lib/page-object/platforms/watir_webdriver/check_box.rb
235
- - lib/page-object/platforms/watir_webdriver/element.rb
236
- - lib/page-object/platforms/watir_webdriver/file_field.rb
237
- - lib/page-object/platforms/watir_webdriver/form.rb
238
- - lib/page-object/platforms/watir_webdriver/image.rb
239
- - lib/page-object/platforms/watir_webdriver/link.rb
240
- - lib/page-object/platforms/watir_webdriver/ordered_list.rb
241
- - lib/page-object/platforms/watir_webdriver/page_object.rb
242
- - lib/page-object/platforms/watir_webdriver/radio_button.rb
243
- - lib/page-object/platforms/watir_webdriver/select_list.rb
244
- - lib/page-object/platforms/watir_webdriver/table.rb
245
- - lib/page-object/platforms/watir_webdriver/table_row.rb
246
- - lib/page-object/platforms/watir_webdriver/text_area.rb
247
- - lib/page-object/platforms/watir_webdriver/text_field.rb
248
- - lib/page-object/platforms/watir_webdriver/unordered_list.rb
227
+ - lib/page-object/platforms/watir.rb
228
+ - lib/page-object/platforms/watir/check_box.rb
229
+ - lib/page-object/platforms/watir/element.rb
230
+ - lib/page-object/platforms/watir/file_field.rb
231
+ - lib/page-object/platforms/watir/form.rb
232
+ - lib/page-object/platforms/watir/image.rb
233
+ - lib/page-object/platforms/watir/link.rb
234
+ - lib/page-object/platforms/watir/ordered_list.rb
235
+ - lib/page-object/platforms/watir/page_object.rb
236
+ - lib/page-object/platforms/watir/radio_button.rb
237
+ - lib/page-object/platforms/watir/select_list.rb
238
+ - lib/page-object/platforms/watir/table.rb
239
+ - lib/page-object/platforms/watir/table_row.rb
240
+ - lib/page-object/platforms/watir/text_area.rb
241
+ - lib/page-object/platforms/watir/text_field.rb
242
+ - lib/page-object/platforms/watir/unordered_list.rb
249
243
  - lib/page-object/section_collection.rb
250
244
  - lib/page-object/version.rb
251
245
  - lib/page-object/widgets.rb
@@ -255,7 +249,17 @@ homepage: http://github.com/cheezy/page-object
255
249
  licenses:
256
250
  - MIT
257
251
  metadata: {}
258
- post_install_message:
252
+ post_install_message: |2
253
+
254
+ This version of the gem moves to using the new Watir gem and away from
255
+ using Watir Webdriver. You will need to update you Gemfile to use `watir`
256
+ instead of `watir-webdriver` and update any `require` statements in your
257
+ code.
258
+
259
+ This is an important move as Watir Webdriver will not be supported any
260
+ longer. All new development has been moved to Watir. There are also
261
+ significant benefits to this move. See the Watir site at
262
+ https://watir.github.io for more details.
259
263
  rdoc_options: []
260
264
  require_paths:
261
265
  - lib