angular_webdriver 1.0.0 → 1.0.1

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: 36f37457d0ef4a33d6270ff82c314b816287f340
4
- data.tar.gz: f322210de5d4c17b9cc69c544399f793f0e5f901
3
+ metadata.gz: 0ebe9dcced61bdcd80e99c422bafb5416a97e142
4
+ data.tar.gz: b3c166bc7ce00fae03a6dbe77c61c2352edff096
5
5
  SHA512:
6
- metadata.gz: b26d552ec0240432af01e600c4936e5ecce7e014275168df066e3fb99d3b51e9db6b74b1c283730f29fe3d1ac393a29f8df42a5402349a0e6757410f1790c94f
7
- data.tar.gz: 6322971ae12c782a76058ba8355e8ac1a526ff9dfbf4fab50180080eb5017faa4537ef4bb217bf7db883a0311616b43a1c8dcc91bd0336f98bc859e087f87225
6
+ metadata.gz: ff7d5236328e971370c1871c6851edbdf468377f1e3fdddbaba2d7ec8fa8c8dc0220eeabc6f5d58a31c22ba7614acf2767dd808824478fc64699ca7ca8df8e7e
7
+ data.tar.gz: 919f103503af4df1cfe3c306b382594191ad2a9104adbe16d0822e9d3d591e60a22bbf00beafe48e1b0aad4b2457e415c0b51e10bd612acdab719588a8f3cf54
data/docs/overview.md CHANGED
@@ -99,3 +99,7 @@ reimplemented client side to avoid flakiness.
99
99
  **driver.set_max_wait(5)** - wait up to 5 seconds for an exception to not be raised
100
100
  when finding an element.
101
101
  **driver.max_wait_seconds** - The max wait amount (default 0) in seconds.
102
+ **driver.set_max_page_wait(30)** - wait up to 30 seconds for pages to load via
103
+ protractor.get
104
+ **driver.max_page_wait_seconds** - The max wait amount (default 30) in seconds
105
+ for pages to load via protractor.get.
@@ -82,9 +82,10 @@ class Protractor
82
82
  # expect(browser.getCurrentUrl()).toBe('https://angularjs.org/');
83
83
  #
84
84
  # @param destination [String] The destination URL to load, can be relative if base_url is set
85
- # @param opt_timeout [Integer] Number of seconds to wait for Angular to start. Default 30.
85
+ # @param opt_timeout [Integer] Number of seconds to wait for Angular to start.
86
+ # Default 30
86
87
  #
87
- def get destination, opt_timeout=30
88
+ def get destination, opt_timeout=driver.max_page_wait_seconds
88
89
  # do not use driver.get because that redirects to this method
89
90
  # instead driver_get is provided.
90
91
 
@@ -130,7 +131,7 @@ class Protractor
130
131
  # now that the url has changed, make sure Angular has loaded
131
132
  # note that the mock module logic is omitted.
132
133
  #
133
- waitForAngular
134
+ waitForAngular description: 'Protractor.get', timeout: timeout
134
135
  end
135
136
 
136
137
  # Invokes the underlying driver.get. Does not wait for angular.
@@ -318,7 +319,7 @@ class Protractor
318
319
  )
319
320
  must_sync = sync_whitelist.include? webdriver_command
320
321
 
321
- self.waitForAngular if must_sync
322
+ waitForAngular if must_sync
322
323
  end
323
324
 
324
325
  # Instruct webdriver to wait until Angular has finished rendering and has
@@ -326,23 +327,33 @@ class Protractor
326
327
  # Note that Protractor automatically applies this command before every
327
328
  # WebDriver action.
328
329
  #
329
- # @param [String] opt_description An optional description to be added
330
- # to webdriver logs.
330
+ # Will wait up to driver.max_wait_seconds (set with driver.set_max_wait)
331
+ #
332
+ # @param [Hash] opts
333
+ # @option opts [String] :description An optional description to be added
334
+ # to webdriver logs.
335
+ # @option opts [Integer] :timeout Amount of time in seconds to wait for
336
+ # angular to load. Default driver.max_wait_seconds
331
337
  # @return [WebDriver::Element, Integer, Float, Boolean, NilClass, String, Array]
332
338
  #
333
- def waitForAngular opt_description='' # Protractor.prototype.waitForAngular
339
+ def waitForAngular opts={} # Protractor.prototype.waitForAngular
334
340
  return if ignore_sync
335
341
 
336
- begin
337
- # the client side script will return a string on error
338
- # the string won't be raised as an error unless we explicitly do so here
339
- error = executeAsyncScript_(client_side_scripts.wait_for_angular,
340
- "Protractor.waitForAngular() #{opt_description}",
341
- root_element)
342
- raise Selenium::WebDriver::Error::JavascriptError, error if error
343
- rescue Exception => e
344
- # https://github.com/angular/protractor/blob/master/docs/faq.md
345
- raise e.class, "Error while waiting for Protractor to sync with the page: #{e}"
342
+ description = opts.fetch(:description, '')
343
+ timeout = opts.fetch(:timeout, driver.max_wait_seconds)
344
+
345
+ wait(timeout: timeout, bubble: true) do
346
+ begin
347
+ # the client side script will return a string on error
348
+ # the string won't be raised as an error unless we explicitly do so here
349
+ error = executeAsyncScript_(client_side_scripts.wait_for_angular,
350
+ "Protractor.waitForAngular() #{description}",
351
+ root_element)
352
+ raise Selenium::WebDriver::Error::JavascriptError, error if error
353
+ rescue Exception => e
354
+ # https://github.com/angular/protractor/blob/master/docs/faq.md
355
+ raise e.class, "Error while waiting for Protractor to sync with the page: #{e}"
356
+ end
346
357
  end
347
358
  end
348
359
 
@@ -37,7 +37,25 @@ module Selenium
37
37
  # waiting for angular to load.
38
38
  #
39
39
  def max_wait_seconds
40
- @bridge.max_wait_seconds
40
+ @bridge.max_wait_seconds || 0
41
+ end
42
+
43
+ # Sets the wait time in seconds used when loading pages with protractor.get
44
+ #
45
+ # @param value [Numeric] the amount of time to wait in seconds
46
+ #
47
+ # @return [Numeric] the wait time in seconds
48
+ def set_max_page_wait value
49
+ @max_page_wait = value
50
+ end
51
+
52
+ # Gets the wait time in seconds used when loading pages with protractor.get
53
+ #
54
+ # Defaults to 30 seconds
55
+ #
56
+ # @return [Numeric] the wait time in seconds
57
+ def max_page_wait_seconds
58
+ @max_page_wait || 30
41
59
  end
42
60
  end
43
61
 
@@ -1,4 +1,4 @@
1
1
  module AngularWebdriver
2
- VERSION = '1.0.0' unless defined? ::AngularWebdriver::VERSION
3
- DATE = '2015-06-06' unless defined? ::AngularWebdriver::DATE
2
+ VERSION = '1.0.1' unless defined? ::AngularWebdriver::VERSION
3
+ DATE = '2015-06-07' unless defined? ::AngularWebdriver::DATE
4
4
  end
data/release_notes.md CHANGED
@@ -1,3 +1,11 @@
1
+ #### v1.0.1 2015-06-07
2
+
3
+ - [afb8d22](https://github.com/bootstraponline/angular_webdriver/commit/afb8d228f087c897ce35deaeace4adbbe63eac25) Release 1.0.1
4
+ - [449c605](https://github.com/bootstraponline/angular_webdriver/commit/449c605d9c43972296d6f04a8f860d43813d1b36) Update wait logic and fix tests
5
+ - [7f133c0](https://github.com/bootstraponline/angular_webdriver/commit/7f133c0a16ca3303f18c0ec99519e066933d85fd) waitForAngular now waits driver.max_wait_seconds
6
+ - [36a1e1a](https://github.com/bootstraponline/angular_webdriver/commit/36a1e1a8093b4c13db6a7ba2cc551cffecbb00e8) Remove unnecessary include
7
+
8
+
1
9
  #### v1.0.0 2015-06-06
2
10
 
3
11
  - [8291152](https://github.com/bootstraponline/angular_webdriver/commit/82911526e99411420ef5bde4cc5dba652cc514ed) Release 1.0.0
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.0
4
+ version: 1.0.1
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-06 00:00:00.000000000 Z
11
+ date: 2015-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver