angular_webdriver 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bddebdc5e0805f1a225634f2472d982f3e29d7f5
4
- data.tar.gz: 4725e12aef7fc193b367dc393d397b46149befb2
3
+ metadata.gz: 58db555e9c61c2ac98f01a0f922028cedd06a7bb
4
+ data.tar.gz: 0690ef7884d1dd4f96e8b1652fd8130c5d9545e2
5
5
  SHA512:
6
- metadata.gz: 881b3dac4df7917e4dd36dccc99349148ec86d90abf80d204fc76bfe5af181c42f02e32cfb6a80c71852b9e685ac0b56f3104eea682456ce1df8fbc2fb8fe940
7
- data.tar.gz: 0d4ccf98664fe02f9708bae8b3f2556968c5b0b594a4141594cf4b7d8cba5c0ea064a51a31895a55bc285027e043af1411bdd1e79c3213154e7c2b233321a323
6
+ metadata.gz: 4803748675e7324fd817f3af6475245eee262e00a4a0ec72ebf162e58837155894b933f71980e4105c7cf2c3b579b72f1eeb43e89d3f7e45638669c5239767c9
7
+ data.tar.gz: 101732bf8cdd661a9393128b7526ea5c0ebebf1b60be0b91b73a80a771f8a349846c258a01c3bbea203aa39aef4ff779d6ec3486b9a7e3cae37ed365fb313d5d
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'thor' # enable: bundle exec thor spec
6
+ gem 'coveralls', require: false
@@ -19,12 +19,12 @@ Gem::Specification.new do |s|
19
19
  # exact versions of both are used.
20
20
  s.add_runtime_dependency 'selenium-webdriver', '= 2.46.2'
21
21
  s.add_runtime_dependency 'watir-webdriver', '= 0.7.0'
22
- s.add_runtime_dependency 'webdriver_utils', '>= 0.0.6'
22
+ s.add_runtime_dependency 'webdriver_utils', '>= 1.0.2'
23
23
 
24
- s.add_development_dependency 'rspec', '>= 3.2.0'
25
- s.add_development_dependency 'appium_thor', '>= 0.0.7'
24
+ s.add_development_dependency 'rspec', '>= 3.3.0'
25
+ s.add_development_dependency 'appium_thor', '>= 1.0.1'
26
26
  s.add_development_dependency 'pry', '>= 0.10.1'
27
- s.add_development_dependency 'trace_files', '~> 0.0.2'
27
+ s.add_development_dependency 'trace_files', '>= 1.0.0'
28
28
 
29
29
  s.files = `git ls-files -z`.split("\x0").reject do |f|
30
30
  f.match(%r{^(gen|test|spec|features|protractor)/})
@@ -67,7 +67,7 @@ class Protractor
67
67
  return @base_url = nil unless url
68
68
 
69
69
  uri = URI.parse(url) rescue false
70
- raise "Invalid URL #{url.inspect}. Must contain scheme and host." unless uri && uri.scheme && uri.host
70
+ fail ArgumentError, "Invalid URL #{url.inspect}. Must contain scheme and host." unless uri && uri.scheme && uri.host
71
71
  @base_url = url
72
72
  end
73
73
 
@@ -111,10 +111,10 @@ class Protractor
111
111
 
112
112
  timeout = opt_timeout
113
113
 
114
- raise "Invalid timeout #{timeout}" unless timeout.is_a?(Numeric)
114
+ fail ArgumentError, "Invalid timeout #{timeout}" unless timeout.is_a?(Numeric)
115
115
 
116
116
  unless destination.is_a?(String) || destination.is_a?(URI)
117
- raise "Invalid destination #{destination}"
117
+ fail ArgumentError, "Invalid destination #{destination}"
118
118
  end
119
119
 
120
120
  # http://about:blank doesn't work. it must be exactly about:blank
@@ -157,7 +157,7 @@ class Protractor
157
157
  url = executeScript_('return window.location.href;', msg.call('get url'))
158
158
  not_on_reset_url = url != reset_url
159
159
  destination_is_reset = destination == reset_url
160
- raise 'still on reset url' unless not_on_reset_url || destination_is_reset
160
+ fail 'still on reset url' unless not_on_reset_url || destination_is_reset
161
161
  end
162
162
 
163
163
  # now that the url has changed, make sure Angular has loaded
@@ -181,13 +181,13 @@ class Protractor
181
181
  #
182
182
  # @param opt_timeout [Integer] Number of seconds to wait for Angular to start.
183
183
  #
184
- def refresh opt_timeout
185
- timeout = opt_timeout || 10
184
+ def refresh opt_timeout=10
185
+ timeout = opt_timeout
186
186
 
187
187
  return driver.navigate.refresh if ignore_sync
188
188
 
189
- executeScript_('return window.location.href;',
190
- 'Protractor.refresh() - getUrl')
189
+ href = executeScript_('return window.location.href;',
190
+ 'Protractor.refresh() - getUrl')
191
191
 
192
192
  get(href, timeout)
193
193
  end
@@ -240,7 +240,7 @@ class Protractor
240
240
  @watir = opts[:watir]
241
241
 
242
242
  valid_watir = defined?(Watir::Browser) && @watir.is_a?(Watir::Browser)
243
- raise "Driver must be a Watir::Browser not #{@driver.class}" unless valid_watir
243
+ fail ArgumentError, "Driver must be a Watir::Browser not #{@driver.class}" unless valid_watir
244
244
  @driver = @watir.driver
245
245
 
246
246
  unless Selenium::WebDriver::SearchContext::FINDERS.keys.include?(NEW_FINDERS_KEYS)
@@ -290,15 +290,9 @@ class Protractor
290
290
  #
291
291
  # toplevel self enables by/element from within pry. rspec helpers enables
292
292
  # by/element within rspec tests when used with install_rspec_helpers.
293
- toplevel_main = eval('self', TOPLEVEL_BINDING)
294
- [toplevel_main, AngularWebdriver::RSpecHelpers].each do |obj|
295
- # define singleton on toplevel main, otherwise use regular define method
296
- # if we use define singleton on the rspec helpers, then rspec won't
297
- # be able to handle block parameters.
298
- #
299
- # Also rspec requires config.include AngularWebdriver::RSpecHelpers
300
- # for the no_wait helper to accept the block parameter.
301
- method_type = obj == toplevel_main ? :define_singleton_method : :define_method
293
+ toplevel_main = TOPLEVEL_BINDING.eval('self')
294
+ [toplevel_main, ::AngularWebdriver::RSpecHelpers].each do |obj|
295
+ method_type = :define_singleton_method
302
296
 
303
297
  obj.send method_type, :element do |*args|
304
298
  protractor_element.element *args
@@ -5,15 +5,46 @@ module AngularWebdriver
5
5
  module RSpecHelpers
6
6
  end
7
7
 
8
- # call within before(:all) in rspec config after invoking Protractor.new
9
- def self.install_rspec_helpers
10
- context = RSpec::Core::ExampleGroup
11
- helpers = AngularWebdriver::RSpecHelpers
12
- helpers.singleton_methods.each do |method_symbol|
13
- context.send(:define_method, method_symbol) do |*args|
14
- args.length == 0 ? helpers.send(method_symbol) :
15
- helpers.send(method_symbol, *args)
8
+ class << self
9
+ # call after invoking Protractor.new. Installs by/element/no_wait
10
+ def install_rspec_helpers context = RSpec::Core::ExampleGroup
11
+ helpers = AngularWebdriver::RSpecHelpers
12
+ helpers.singleton_methods(false).each do |method_symbol|
13
+ context.send(:define_method, method_symbol) do |*args, &block|
14
+ args.length == 0 ? helpers.send(method_symbol, &block) :
15
+ helpers.send(method_symbol, *args, &block)
16
+ end
16
17
  end
17
18
  end
18
- end
19
- end
19
+
20
+ def require_all_pages glob_path=nil
21
+ glob_path ||= File.join(Rake.application.original_dir, 'page', '**', '*.rb')
22
+ Dir.glob(glob_path) { |file| require_relative file }
23
+ end
24
+
25
+ def define_page_methods opts={}
26
+ method = opts.fetch(:method, :define_singleton_method)
27
+ page_module = opts[:page_module] || raise('must set page_module')
28
+ target_class = opts[:target_class] || raise('must set target_class')
29
+ driver_object = opts[:watir] || opts[:driver] || raise('must set driver')
30
+ page_module.constants.each do |page_class|
31
+ qualified_class = page_module.const_get(page_class)
32
+
33
+ # enable use of by/element/no_wait within block passed to pageobject element
34
+ # element(:greet_button) { element(by.binding('greet')) }
35
+ AngularWebdriver.install_rspec_helpers qualified_class
36
+
37
+ # ButtonsPage => buttons_page
38
+ # https://github.com/rails/rails/blob/daaa21bc7d20f2e4ff451637423a25ff2d5e75c7/activesupport/lib/active_support/inflector/methods.rb#L96
39
+ page_name = page_class.to_s.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
40
+ target_class.send(method, page_name) do
41
+ instance_name = "@#{page_module}#{page_class}"
42
+ instance = instance_variable_get(instance_name)
43
+ return instance if instance
44
+ obj = qualified_class.new driver_object
45
+ instance_variable_set instance_name, obj
46
+ end
47
+ end
48
+ end
49
+ end # class << self
50
+ end # module AngularWebdriver
@@ -1,4 +1,4 @@
1
1
  module AngularWebdriver
2
- VERSION = '1.0.4' unless defined? ::AngularWebdriver::VERSION
3
- DATE = '2015-06-07' unless defined? ::AngularWebdriver::DATE
2
+ VERSION = '1.0.5' unless defined? ::AngularWebdriver::VERSION
3
+ DATE = '2015-06-20' unless defined? ::AngularWebdriver::DATE
4
4
  end
data/readme.md CHANGED
@@ -1,4 +1,7 @@
1
- # angular_webdriver [![Gem Version](https://badge.fury.io/rb/angular_webdriver.svg)](https://rubygems.org/gems/angular_webdriver) [![Build Status](https://travis-ci.org/bootstraponline/angular_webdriver.svg?branch=master)](https://travis-ci.org/bootstraponline/angular_webdriver/builds)
1
+ # angular_webdriver
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/angular_webdriver.svg)](https://rubygems.org/gems/angular_webdriver) [![Build Status](https://travis-ci.org/bootstraponline/angular_webdriver.svg?branch=master)](https://travis-ci.org/bootstraponline/angular_webdriver/builds) [![Coverage Status](https://coveralls.io/repos/bootstraponline/angular_webdriver/badge.svg?nocache)](https://coveralls.io/r/bootstraponline/angular_webdriver) [![Dependency Status](https://gemnasium.com/bootstraponline/angular_webdriver.svg?nocache)](https://gemnasium.com/bootstraponline/angular_webdriver)
4
+
2
5
 
3
6
  Angular enhancements to the Ruby webdriver bindings based on [protractor](https://github.com/angular/protractor).
4
7
 
data/release_notes.md CHANGED
@@ -1,3 +1,24 @@
1
+ #### v1.0.5 2015-06-20
2
+
3
+ - [248bd2a](https://github.com/bootstraponline/angular_webdriver/commit/248bd2a7d979543047e4ad9d4f7f12f4a99f4ce8) Release 1.0.5
4
+ - [1347e18](https://github.com/bootstraponline/angular_webdriver/commit/1347e181c8d0c29a9e62b9a7a29c882c20fff6e4) Update dependencies
5
+ - [0f41127](https://github.com/bootstraponline/angular_webdriver/commit/0f411277df55783ef46736ba28c5f3aaee07324c) Update install_rspec_helpers. Add page helpers
6
+ - [b4c4ad4](https://github.com/bootstraponline/angular_webdriver/commit/b4c4ad4d519b1538e4db5e25ddd7594f86b99660) Test rspec helpers
7
+ - [7075fc0](https://github.com/bootstraponline/angular_webdriver/commit/7075fc037acf2797e39ea4be64631275b2c6ded6) Update badges
8
+ - [ddbfbf0](https://github.com/bootstraponline/angular_webdriver/commit/ddbfbf0c18489c1f1b73f458daeca4f0defdf0c8) Add gemnasium badge
9
+ - [b47c73c](https://github.com/bootstraponline/angular_webdriver/commit/b47c73c8835e160b28ab0b65bb66866f32e744a5) Set spec timeouts and window size
10
+ - [5b5b260](https://github.com/bootstraponline/angular_webdriver/commit/5b5b260d45df6f0a5f462cdcb5008d09b300b180) Test locate find_first_by_multiple
11
+ - [eed49f4](https://github.com/bootstraponline/angular_webdriver/commit/eed49f44d6bf9ed6caf5a725648d16acbdcc0991) Improve watir patch tests
12
+ - [2033489](https://github.com/bootstraponline/angular_webdriver/commit/2033489b6f8425c19e55b1eb8bab5d18c1f6ecf9) Clean up exception raising
13
+ - [20b8d91](https://github.com/bootstraponline/angular_webdriver/commit/20b8d91bac69d4e2411baed30c470db23c6c7ab8) Fix protractor refresh
14
+ - [df975a4](https://github.com/bootstraponline/angular_webdriver/commit/df975a4ce94950e58f0077c3510402912d327ae0) Fix dynamic methods
15
+ - [2b0aa97](https://github.com/bootstraponline/angular_webdriver/commit/2b0aa97e8f31003bb75a1ad7c3bc1c8cd7cf6d93) Launch browser exactly once for faster testing
16
+ - [a522795](https://github.com/bootstraponline/angular_webdriver/commit/a52279514b9db1ff3ec548bd9f63f8ab003e54b7) Disable Pry paging
17
+ - [a5d129e](https://github.com/bootstraponline/angular_webdriver/commit/a5d129ec81a85a18952a040b9be1b6ef7345bad3) Fix client side scripts spec
18
+ - [cdf3c88](https://github.com/bootstraponline/angular_webdriver/commit/cdf3c88e1aa7cde322843aa25bfadd7fe03a6ccd) Add coveralls
19
+ - [e9231df](https://github.com/bootstraponline/angular_webdriver/commit/e9231dfbb327e6243222dda573fbdc9eb97b6c95) Remove completed todo
20
+
21
+
1
22
  #### v1.0.4 2015-06-07
2
23
 
3
24
  - [a7965d7](https://github.com/bootstraponline/angular_webdriver/commit/a7965d7d1103bb802eabbdf11a37c9be8f9f3547) Release 1.0.4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-07 00:00:00.000000000 Z
11
+ date: 2015-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.6
47
+ version: 1.0.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.6
54
+ version: 1.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.2.0
61
+ version: 3.3.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.2.0
68
+ version: 3.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: appium_thor
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.7
75
+ version: 1.0.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.7
82
+ version: 1.0.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: trace_files
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.0.2
103
+ version: 1.0.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.0.2
110
+ version: 1.0.0
111
111
  description: Angular webdriver.
112
112
  email:
113
113
  - code@bootstraponline.com
@@ -115,6 +115,7 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".coveralls.yml"
118
119
  - ".gitignore"
119
120
  - ".gitmodules"
120
121
  - ".rspec"