angular_webdriver 1.0.2 → 1.0.3

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: 0d9045bf7bc4696d2d8830c356179282e792775e
4
- data.tar.gz: 4a5b5555d20df4990b6ccef339708341198d9328
3
+ metadata.gz: 129723933393935ba3f51f00d55c00170701b4c1
4
+ data.tar.gz: 0f0458f8424f2010c459206d9d2d6ec26800fe71
5
5
  SHA512:
6
- metadata.gz: f7d0f23c5d5cb72520b763bf17954ee949b5815ca438577da6f074e0289932282e96862e166de84074ebc7166d87d9b676733e0c69fbde93f391fff457e6ed43
7
- data.tar.gz: 57dba96745f042756365ccabf2a291d0f6f33cb026acd26f2b94a6a759b687ccdbcd397474b6041fed4468f8311c19152a2de729501e19d3be1054cc55f61375
6
+ metadata.gz: 8d6e619430ed609bbe8cd6ca53591acd93c02a23413195c129bbb11d9242df64e77ebf159d188eded115110b61a9f3cf86793257731cb8546e7678cedff5366e
7
+ data.tar.gz: 16233f787ff5ca1603df8668587e455b4aa9941ce08cb5edbe7cd825741e16d84824cef770440af574f71239c9244d89fd1a0b14f21d590ceee8c2e07955714e
@@ -49,7 +49,27 @@ class Protractor
49
49
  #
50
50
  # @return [String] Default nil.
51
51
  #
52
- attr_accessor :base_url
52
+ attr_reader :base_url
53
+
54
+ # Sets the base url.
55
+ #
56
+ # Expected format:
57
+ # scheme://host
58
+ #
59
+ # Example:
60
+ # http://localhost
61
+ #
62
+ # @param url [String] the url to use as a base
63
+ #
64
+ # @return [String] url
65
+ def base_url= url
66
+ # Allow resetting base_url with falsey value
67
+ return @base_url = nil unless url
68
+
69
+ uri = URI.parse(url) rescue false
70
+ raise "Invalid URL #{url.inspect}. Must contain scheme and host." unless uri && uri.scheme && uri.host
71
+ @base_url = url
72
+ end
53
73
 
54
74
  # All scripts to be run on the client via executeAsyncScript or
55
75
  # executeScript should be put here.
@@ -97,19 +117,31 @@ class Protractor
97
117
  raise "Invalid destination #{destination}"
98
118
  end
99
119
 
100
- # URI.join doesn't allow for http://localhost:8081/#/ as a base_url
101
- # so this departs from the Protractor behavior and favors File.join instead.
102
- #
103
- # In protractor: url.resolve('http://localhost:8081/#/', 'async')
104
- # => http://localhost:8081/async
105
- # In Ruby: File.join('http://localhost:8081/#/', 'async')
106
- # => http://localhost:8081/#/async
107
- #
108
- base_url_exists = base_url && !base_url.empty?
109
- no_scheme = !URI.parse(destination).scheme rescue true
110
-
111
- if base_url_exists && no_scheme
112
- destination = File.join(base_url, destination.to_s)
120
+ # http://about:blank doesn't work. it must be exactly about:blank
121
+ about_url = destination.start_with?('about:')
122
+
123
+ # data urls must be preserved and not have http:// prepended.
124
+ # data:<blah>
125
+ data_url = destination.start_with?('data:')
126
+
127
+ unless about_url || data_url
128
+ # URI.join doesn't allow for http://localhost:8081/#/ as a base_url
129
+ # so this departs from the Protractor behavior and favors File.join instead.
130
+ #
131
+ # In protractor: url.resolve('http://localhost:8081/#/', 'async')
132
+ # => http://localhost:8081/async
133
+ # In Ruby: File.join('http://localhost:8081/#/', 'async')
134
+ # => http://localhost:8081/#/async
135
+ #
136
+ base_url_exists = base_url && !base_url.empty?
137
+ tmp_uri = URI.parse(destination) rescue URI.parse('')
138
+ relative_url = !tmp_uri.scheme || !tmp_uri.host
139
+
140
+ if base_url_exists && relative_url
141
+ destination = File.join(base_url, destination.to_s)
142
+ elsif relative_url # prepend 'http://' to urls such as localhost
143
+ destination = "http://#{destination}"
144
+ end
113
145
  end
114
146
 
115
147
  msg = lambda { |str| 'Protractor.get(' + destination + ') - ' + str }
@@ -1,4 +1,4 @@
1
1
  module AngularWebdriver
2
- VERSION = '1.0.2' unless defined? ::AngularWebdriver::VERSION
2
+ VERSION = '1.0.3' unless defined? ::AngularWebdriver::VERSION
3
3
  DATE = '2015-06-07' unless defined? ::AngularWebdriver::DATE
4
4
  end
data/release_notes.md CHANGED
@@ -1,3 +1,11 @@
1
+ #### v1.0.3 2015-06-07
2
+
3
+ - [97d5f18](https://github.com/bootstraponline/angular_webdriver/commit/97d5f18e187d56bc8616fb65ec1e5b9bafa8c289) Release 1.0.3
4
+ - [42b527e](https://github.com/bootstraponline/angular_webdriver/commit/42b527e81045c03b051bf14494189da8276cf754) Fix about and data url handling
5
+ - [8022a5c](https://github.com/bootstraponline/angular_webdriver/commit/8022a5c04e46f0f007d2b9bd394b914127cc610a) Fix set_max_page_wait spec
6
+ - [6000137](https://github.com/bootstraponline/angular_webdriver/commit/60001379d283d289247b8a2f9adad9469a8921bd) Fix loading urls without scheme
7
+
8
+
1
9
  #### v1.0.2 2015-06-07
2
10
 
3
11
  - [9b9cc12](https://github.com/bootstraponline/angular_webdriver/commit/9b9cc12e778d4230cd5ea6382bb9e31de4506b0a) Release 1.0.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angular_webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com