capybara-ng 0.2.3 → 0.2.4

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: 6c4f7c97f4ebf5e71648c057da7f82f731d98971
4
- data.tar.gz: 8dcf57346e76e4d7ec6635ae4dc0748817887419
3
+ metadata.gz: be1d09148071e01a094f2a9cbecb642c95bb81ea
4
+ data.tar.gz: d85deb17586269edd02764448aee3030e8007e45
5
5
  SHA512:
6
- metadata.gz: 10abab89dedd87d0044ffa7daa3c7273ad56993849fff02f3305a57453ccb7fb2d4a2ead7366cfca9224c715e6a6b25aac7b7c3fc8e89217c3aec364e8bfeb19
7
- data.tar.gz: c468da66a5426bc55c4c4d93d4e258aeb1ac0dc7b2a834b1a8c7721f3965740c22bc7257558e1b972e7538b632b605fe31283797e7d264f817c4f773020a4a4e
6
+ metadata.gz: 0db1d7f3ccb9ff4818587aa70c5d10dce59ea8be95b09fce0ae7495ad0df9426ff4e587b46a30b3056e26bdd55acda050329d5f8e359ff2e7e2c0c9d006736e8
7
+ data.tar.gz: 99f180ad70ad9583c23038aeff5571264979820abbc5b9298b448521c602309d0976292f167e483efd6755e40abd46cd3b0cc8cd73381f4a245caa15eabc5ce4
@@ -1,28 +1,11 @@
1
1
  module Angular
2
2
  module ClientScript
3
- # /**
4
- # * Wait until Angular has finished rendering and has
5
- # * no outstanding $http calls before continuing.
6
- # *
7
- # * Asynchronous.
8
- # *
9
- # * @param {string} selector The selector housing an ng-app
10
- # * @param {function} callback callback
11
- # */
12
- FN_waitForAngular = <<-FN
13
- function(selector, callback) {
14
- var el = document.querySelector(selector);
15
- return el;
16
- try {
17
- if (angular.getTestability) {
18
- angular.getTestability(el).whenStable(callback);
19
- } else {
20
- angular.element(el).injector().get('$browser').
21
- notifyWhenNoOutstandingRequests(callback);
22
- }
23
- } catch (e) {
24
- callback(e);
25
- }
3
+ #
4
+ # Log calls
5
+ #
6
+ FN_nglog = <<-FN
7
+ function(method, params) {
8
+ console.log('NG: ' + method + '(' + params.join(', ') + ')')
26
9
  };
27
10
  FN
28
11
 
@@ -38,6 +21,8 @@ FN
38
21
  # */
39
22
  FN_findBindings = <<-FN
40
23
  function(binding, exactMatch, using, rootSelector) {
24
+ nglog("findBindings", [binding, exactMatch, using, rootSelector]);
25
+
41
26
  rootSelector = rootSelector || 'body';
42
27
  using = using || document.querySelector(rootSelector);
43
28
 
@@ -81,6 +66,8 @@ FN
81
66
  # */
82
67
  FN_findBindingsIds = <<-FN
83
68
  function(binding, exactMatch, using, rootSelector) {
69
+ nglog("findBindingsIds", [binding, exactMatch, using, rootSelector]);
70
+
84
71
  var elements = findBindings(binding, exactMatch, using, rootSelector);
85
72
  return createCapybaraNgMatches(elements);
86
73
  };
@@ -101,6 +88,8 @@ FN
101
88
  # */
102
89
  FN_findRepeaterRows = <<-FN
103
90
  function(repeater, index, using, rootSelector) {
91
+ console.log("findRepeaterRows", repeater, index, using, rootSelector);
92
+
104
93
  rootSelector = rootSelector || 'body';
105
94
  using = using || document.querySelector(rootSelector);
106
95
 
@@ -157,6 +146,8 @@ FN
157
146
  # */
158
147
  FN_findRepeaterRowsIds = <<-FN
159
148
  function(repeater, index, using, rootSelector) {
149
+ nglog("findRepeaterRowsIds", [repeater, index, using, rootSelector]);
150
+
160
151
  var elements = findRepeaterRows(repeater, index, using, rootSelector);
161
152
  return createCapybaraNgMatches(elements);
162
153
  };
@@ -173,6 +164,8 @@ FN
173
164
  # */
174
165
  FN_findAllRepeaterRows = <<-FN
175
166
  function(repeater, using, rootSelector) {
167
+ nglog("findAllRepeaterRows", [repeater, using, rootSelector]);
168
+
176
169
  rootSelector = rootSelector || 'body';
177
170
  using = using || document.querySelector(rootSelector);
178
171
 
@@ -220,6 +213,8 @@ FN
220
213
  # */
221
214
  FN_findAllRepeaterRowsIds = <<-FN
222
215
  function(repeater, using, rootSelector) {
216
+ nglog("findAllRepeaterRowsIds", [repeater, using, rootSelector]);
217
+
223
218
  var elements = findAllRepeaterRows(repeater, using, rootSelector);
224
219
  return createCapybaraNgMatches(elements);
225
220
  };
@@ -238,6 +233,8 @@ FN
238
233
  # */
239
234
  FN_findRepeaterElement = <<-FN
240
235
  function(repeater, index, binding, using, rootSelector) {
236
+ nglog("findRepeaterElement", [repeater, index, binding, using, rootSelector]);
237
+
241
238
  var matches = [];
242
239
  rootSelector = rootSelector || 'body';
243
240
  using = using || document.querySelector(rootSelector);
@@ -338,6 +335,8 @@ FN
338
335
  # */
339
336
  FN_findRepeaterElementIds = <<-FN
340
337
  function(repeater, index, binding, using, rootSelector) {
338
+ nglog("findRepeaterElementIds", [repeater, index, binding, using, rootSelector]);
339
+
341
340
  var elements = findRepeaterElement(repeater, index, binding, using, rootSelector);
342
341
  return createCapybaraNgMatches(elements);
343
342
  };
@@ -355,6 +354,8 @@ FN
355
354
  # */
356
355
  FN_findRepeaterColumn = <<-FN
357
356
  function(repeater, binding, using, rootSelector) {
357
+ nglog("findRepeaterColumn", [repeater, binding, using, rootSelector]);
358
+
358
359
  var matches = [];
359
360
  rootSelector = rootSelector || 'body';
360
361
  using = using || document.querySelector(rootSelector);
@@ -452,6 +453,8 @@ FN
452
453
  # */
453
454
  FN_findRepeaterColumnIds = <<-FN
454
455
  function(repeater, binding, using, rootSelector) {
456
+ nglog("findRepeaterColumnIds", [repeater, binding, using, rootSelector]);
457
+
455
458
  var elements = findRepeaterColumn(repeater, binding, using, rootSelector);
456
459
  return createCapybaraNgMatches(elements);
457
460
  };
@@ -468,6 +471,8 @@ FN
468
471
  # */
469
472
  FN_findByModel = <<-FN
470
473
  function(model, using, rootSelector) {
474
+ nglog("findByModel", [model, using, rootSelector]);
475
+
471
476
  rootSelector = rootSelector || 'body';
472
477
  using = using || document.querySelector(rootSelector);
473
478
 
@@ -498,6 +503,8 @@ FN
498
503
  # */
499
504
  FN_findByModelIds = <<-FN
500
505
  function(model, using, rootSelector) {
506
+ nglog("findByModelIds", [model, using, rootSelector]);
507
+
501
508
  var elements = findByModel(model, using, rootSelector);
502
509
  return createCapybaraNgMatches(elements);
503
510
  };
@@ -515,6 +522,8 @@ FN
515
522
  # */
516
523
  FN_findByOptions = <<-FN
517
524
  function(optionsDescriptor, using, rootSelector) {
525
+ nglog("findByOptions", [optionsDescriptor, using, rootSelector]);
526
+
518
527
  rootSelector = rootSelector || 'body';
519
528
  using = using || document.querySelector(rootSelector);
520
529
 
@@ -541,6 +550,8 @@ FN
541
550
  # */
542
551
  FN_findByOptionsIds = <<-FN
543
552
  function(optionsDescriptor, using, rootSelector) {
553
+ nglog("findByOptionsIds", [optionsDescriptor, using, rootSelector]);
554
+
544
555
  var elements = findByOptions(optionsDescriptor, using, rootSelector);
545
556
  return createCapybaraNgMatches(elements);
546
557
  };
@@ -557,6 +568,8 @@ FN
557
568
  # */
558
569
  FN_findByButtonText = <<-FN
559
570
  function(searchText, using, rootSelector) {
571
+ nglog("findByButtonText", [searchText, using, rootSelector]);
572
+
560
573
  rootSelector = rootSelector || 'body';
561
574
  using = using || document.querySelector(rootSelector);
562
575
 
@@ -590,6 +603,8 @@ FN
590
603
  # */
591
604
  FN_findByPartialButtonText = <<-FN
592
605
  function(searchText, using, rootSelector) {
606
+ nglog("findByPartialButtonText", [searchText, using, rootSelector]);
607
+
593
608
  rootSelector = rootSelector || 'body';
594
609
  using = using || document.querySelector(rootSelector);
595
610
 
@@ -624,6 +639,8 @@ FN
624
639
  # */
625
640
  FN_findByCssContainingText = <<-FN
626
641
  function(cssSelector, searchText, using, rootSelector) {
642
+ nglog("findByCssContainingText", [cssSelector, searchText, using, rootSelector]);
643
+
627
644
  rootSelector = rootSelector || 'body';
628
645
  using = using || document.querySelector(rootSelector);
629
646
 
@@ -651,6 +668,8 @@ FN
651
668
  # */
652
669
  FN_testForAngular = <<-FN
653
670
  function(attempts, asyncCallback) {
671
+ nglog("testForAngular", [attempts, asyncCallback]);
672
+
654
673
  var callback = function(args) {
655
674
  setTimeout(function() {
656
675
  asyncCallback(args);
@@ -687,12 +706,16 @@ FN
687
706
  # */
688
707
  FN_evaluate = <<-FN
689
708
  function(element, expression) {
709
+ nglog("evaluate", [element, expression]);
710
+
690
711
  return angular.element(element).scope().$eval(expression);
691
712
  };
692
713
  FN
693
714
 
694
715
  FN_allowAnimations = <<-FN
695
716
  function(element, value) {
717
+ nglog("allowAnimations", [element, value]);
718
+
696
719
  var ngElement = angular.element(element);
697
720
  if (ngElement.allowAnimations) {
698
721
  // AngularDart: $testability API.
@@ -712,6 +735,8 @@ FN
712
735
  # */
713
736
  FN_getLocationAbsUrl = <<-FN
714
737
  function(selector) {
738
+ nglog("getLocationAbsUrl", [selector]);
739
+
715
740
  var el = document.querySelector(selector);
716
741
  if (angular.getTestability) {
717
742
  return angular.getTestability(el).
@@ -730,6 +755,8 @@ FN
730
755
  # */
731
756
  FN_getLocation = <<-FN
732
757
  function(selector) {
758
+ nglog("getLocation", [selector]);
759
+
733
760
  var el = document.querySelector(selector);
734
761
  var $injector = angular.element(el).injector();
735
762
  var $location = $injector.get('$location');
@@ -746,6 +773,8 @@ FN
746
773
  # */
747
774
  FN_setLocation = <<-FN
748
775
  function(selector, url) {
776
+ nglog("setLocation", [selector, url]);
777
+
749
778
  var el = document.querySelector(selector);
750
779
  if (angular.getTestability) {
751
780
  return angular.getTestability(el).
@@ -1,3 +1,3 @@
1
1
  module Angular
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -38,6 +38,10 @@ module Angular
38
38
 
39
39
  window.ngReady = false;
40
40
 
41
+ window. nglog = function(method, params) {
42
+ console.log('NG: ' + method + '(' + params.join(', ') + ')')
43
+ };
44
+
41
45
  window.nextCapybaraId = function() {
42
46
  window.capybaraId = window.capybaraId || 1;
43
47
  return window.capybaraId++;
@@ -73,16 +77,20 @@ module Angular
73
77
  var app = angular.element(el);
74
78
  var injector = app.injector();
75
79
  var callback = function() {
80
+ nglog("ready", []);
76
81
  window.ngReady = true;
77
82
  };
78
83
 
79
84
  try {
80
85
  if (angular.getTestability) {
86
+ nglog("getTestability", [el]);
81
87
  angular.getTestability(el).whenStable(callback);
82
88
  } else {
89
+ nglog("$browser", [el]);
83
90
  injector.get('$browser').notifyWhenNoOutstandingRequests(callback);
84
91
  }
85
92
  } catch (e) {
93
+ nglog("callback failed", [e]);
86
94
  callback(e);
87
95
  }
88
96
  })();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-ng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-12 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,10 +70,7 @@ files:
70
70
  - lib/angular.rb
71
71
  - lib/angular/capybara_setup.rb
72
72
  - lib/angular/client_script.rb
73
- - lib/angular/driver.rb
74
73
  - lib/angular/dsl.rb
75
- - lib/angular/element_helper.rb
76
- - lib/angular/locator.rb
77
74
  - lib/angular/log.rb
78
75
  - lib/angular/setup.rb
79
76
  - lib/angular/version.rb
@@ -1,357 +0,0 @@
1
- module Angular
2
- #
3
- # TODO KI NOT USED
4
- #
5
- class Driver
6
- include Capybara::DSL
7
-
8
- DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
9
-
10
- WEB_ELEMENT_FUNCTIONS = [
11
- 'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText',
12
- 'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear',
13
- 'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'getId'
14
- ]
15
-
16
- DEFAULT_RESET_URL = 'data:text/html,<html></html>'
17
- DEFAULT_GET_PAGE_TIMEOUT = 10000
18
-
19
-
20
- def initialize(opt)
21
- @element = ElementHelper.new(self)
22
-
23
- # All get methods will be resolved against this base URL. Relative URLs are =
24
- # resolved the way anchor tags resolve.
25
- #
26
- # @type {string}
27
- @baseUrl = opt[:base_url] || '';
28
-
29
- #
30
- # The css selector for an element on which to find Angular. This is usually
31
- # 'body' but if your ng-app is on a subsection of the page it may be
32
- # a subelement.
33
- #
34
- # @type {string}
35
- @rootEl = opt[:root_element] || 'body';
36
-
37
- #
38
- # If true, Protractor will not attempt to synchronize with the page before
39
- # performing actions. This can be harmful because Protractor will not wait
40
- # until $timeouts and $http calls have been processed, which can cause
41
- # tests to become flaky. This should be used only when necessary, such as
42
- # when a page continuously polls an API using $timeout.
43
- #
44
- # @type {boolean}
45
- @ignoreSynchronization = false;
46
-
47
- #
48
- # Timeout in milliseconds to wait for pages to load when calling `get`.
49
- #
50
- # @type {number}
51
- @getPageTimeout = DEFAULT_GET_PAGE_TIMEOUT;
52
-
53
- #
54
- # An object that holds custom test parameters.
55
- #
56
- # @type {Object}
57
- @params = {};
58
-
59
- #
60
- # The reset URL to use between page loads.
61
- #
62
- # @type {string}
63
- @resetUrl = DEFAULT_RESET_URL;
64
-
65
- #
66
- # Information about mock modules that will be installed during every
67
- # get().
68
- #
69
- # @type {Array<{name: string, script: function|string, args: Array.<string>}>}
70
- @mockModules = [];
71
-
72
- @addBaseMockModules_();
73
-
74
- @functions = ClientScript.functions
75
- end
76
-
77
- # @see http://artsy.github.io/blog/2012/02/03/reliably-testing-asynchronous-ui-w-slash-rspec-and-capybara/
78
- def wait_for_dom(timeout = Capybara.default_wait_time)
79
- uuid = SecureRandom.uuid
80
- page.find("body")
81
- page.evaluate_script <<-EOS
82
- _.defer(function() {
83
- $('body').append("<div id='#{uuid}'></div>");
84
- });
85
- EOS
86
- page.find("##{uuid}")
87
- end
88
-
89
- def setup
90
- <<-FN
91
- // These functions should delegate to the webdriver instance, but should
92
- // wait for Angular to sync up before performing the action. This does not
93
- // include functions which are overridden by protractor below.
94
- var methodsToSync = ['getCurrentUrl', 'getPageSource', 'getTitle'];
95
-
96
- // Mix all other driver functionality into Protractor.
97
- for (var method in webdriverInstance) {
98
- if(!this[method] && typeof webdriverInstance[method] == 'function') {
99
- if (methodsToSync.indexOf(method) !== -1) {
100
- mixin(this, webdriverInstance, method, this.waitForAngular.bind(this));
101
- } else {
102
- mixin(this, webdriverInstance, method);
103
- }
104
- }
105
- }
106
- FN
107
- end
108
-
109
- def page
110
- Capybara.current_session
111
- end
112
-
113
- def wait_for_angular
114
- return if @ignoreSynchronization
115
- result = page.evaluate_script(functions[:waitForAngular])
116
-
117
- <<-FN
118
- Protractor.prototype.waitForAngular = function() {
119
- if (this.ignoreSynchronization) {
120
- return webdriver.promise.fulfilled();
121
- }
122
- return this.driver.executeAsyncScript(
123
- clientSideScripts.waitForAngular, this.rootEl).then(function(browserErr) {
124
- if (browserErr) {
125
- throw 'Error while waiting for Protractor to ' +
126
- 'sync with the page: ' + JSON.stringify(browserErr);
127
- }
128
- }).then(null, function(err) {
129
- var timeout;
130
- if (/asynchronous script timeout/.test(err.message)) {
131
- // Timeout on Chrome
132
- timeout = /-?[\d\.]*\ seconds/.exec(err.message);
133
- } else if (/Timed out waiting for async script/.test(err.message)) {
134
- // Timeout on Firefox
135
- timeout = /-?[\d\.]*ms/.exec(err.message);
136
- } else if (/Timed out waiting for an asynchronous script/.test(err.message)) {
137
- // Timeout on Safari
138
- timeout = /-?[\d\.]*\ ms/.exec(err.message);
139
- }
140
- if (timeout) {
141
- throw 'Timed out waiting for Protractor to synchronize with ' +
142
- 'the page after ' + timeout + '. Please see ' +
143
- 'https://github.com/angular/protractor/blob/master/docs/faq.md';
144
- } else {
145
- throw err;
146
- }
147
- });
148
- };
149
- FN
150
- end
151
-
152
- def findElement
153
- <<-FN
154
- /**
155
- * Waits for Angular to finish rendering before searching for elements.
156
- * @see webdriver.WebDriver.findElement
157
- * @return {!webdriver.WebElement}
158
- */
159
- function(locator) {
160
- return this.element(locator).getWebElement();
161
- };
162
- FN
163
- end
164
-
165
- def findElements
166
- <<-FN
167
- /**
168
- * Waits for Angular to finish rendering before searching for elements.
169
- * @see webdriver.WebDriver.findElements
170
- * @return {!webdriver.promise.Promise} A promise that will be resolved to an
171
- * array of the located {@link webdriver.WebElement}s.
172
- */
173
- function(locator) {
174
- return this.element.all(locator).getWebElements();
175
- };
176
- FN
177
- end
178
-
179
- def isElementPresent
180
- <<-FN
181
- /**
182
- * Tests if an element is present on the page.
183
- * @see webdriver.WebDriver.isElementPresent
184
- * @return {!webdriver.promise.Promise} A promise that will resolve to whether
185
- * the element is present on the page.
186
- */
187
- function(locatorOrElement) {
188
- var element = (locatorOrElement instanceof webdriver.promise.Promise) ?
189
- locatorOrElement : this.element(locatorOrElement);
190
- return element.isPresent();
191
- };
192
- FN
193
- end
194
-
195
- def get
196
- <<-FN
197
- /**
198
- * See webdriver.WebDriver.get
199
- *
200
- * Navigate to the given destination and loads mock modules before
201
- * Angular. Assumes that the page being loaded uses Angular.
202
- * If you need to access a page which does not have Angular on load, use
203
- * the wrapped webdriver directly.
204
- *
205
- * @param {string} destination Destination URL.
206
- * @param {number=} opt_timeout Number of milliseconds to wait for Angular to
207
- * start.
208
- */
209
- function(destination, opt_timeout) {
210
- var timeout = opt_timeout ? opt_timeout : this.getPageTimeout;
211
- var self = this;
212
-
213
- destination = this.baseUrl.indexOf('file://') === 0 ?
214
- this.baseUrl + destination : url.resolve(this.baseUrl, destination);
215
-
216
- if (this.ignoreSynchronization) {
217
- return this.driver.get(destination);
218
- }
219
-
220
- this.driver.get(this.resetUrl);
221
- this.driver.executeScript(
222
- 'window.name = "' + DEFER_LABEL + '" + window.name;' +
223
- 'window.location.replace("' + destination + '");');
224
-
225
- // We need to make sure the new url has loaded before
226
- // we try to execute any asynchronous scripts.
227
- this.driver.wait(function() {
228
- return self.driver.executeScript('return window.location.href;').
229
- then(function(url) {
230
- return url !== self.resetUrl;
231
- }, function(err) {
232
- if (err.code == 13) {
233
- // Ignore the error, and continue trying. This is because IE
234
- // driver sometimes (~1%) will throw an unknown error from this
235
- // execution. See https://github.com/angular/protractor/issues/841
236
- // This shouldn't mask errors because it will fail with the timeout
237
- // anyway.
238
- return false;
239
- } else {
240
- throw err;
241
- }
242
- });
243
- }, timeout,
244
- 'Timed out waiting for page to load after ' + timeout + 'ms');
245
-
246
- // Make sure the page is an Angular page.
247
- self.driver.executeAsyncScript(clientSideScripts.testForAngular,
248
- Math.floor(timeout / 1000)).
249
- then(function(angularTestResult) {
250
- var hasAngular = angularTestResult[0];
251
- if (!hasAngular) {
252
- var message = angularTestResult[1];
253
- throw new Error('Angular could not be found on the page ' +
254
- destination + ' : ' + message);
255
- }
256
- }, function(err) {
257
- throw 'Error while running testForAngular: ' + err.message;
258
- });
259
-
260
- // At this point, Angular will pause for us until angular.resumeBootstrap
261
- // is called.
262
- var moduleNames = [];
263
- for (var i = 0; i < this.mockModules_.length; ++i) {
264
- var mockModule = this.mockModules_[i];
265
- var name = mockModule.name;
266
- moduleNames.push(name);
267
- var executeScriptArgs = [mockModule.script].concat(mockModule.args);
268
- this.driver.executeScript.apply(this, executeScriptArgs).
269
- then(null, function(err) {
270
- throw 'Error while running module script ' + name +
271
- ': ' + err.message;
272
- });
273
- }
274
-
275
- return this.driver.executeScript(
276
- 'angular.resumeBootstrap(arguments[0]);',
277
- moduleNames);
278
- };
279
- FN
280
- end
281
-
282
- def refresh
283
- <<-FN
284
- /**
285
- * See webdriver.WebDriver.refresh
286
- *
287
- * Makes a full reload of the current page and loads mock modules before
288
- * Angular. Assumes that the page being loaded uses Angular.
289
- * If you need to access a page which does not have Angular on load, use
290
- * the wrapped webdriver directly.
291
- *
292
- * @param {number=} opt_timeout Number of seconds to wait for Angular to start.
293
- */
294
- = function(opt_timeout) {
295
- var timeout = opt_timeout || 10;
296
- var self = this;
297
-
298
- if (self.ignoreSynchronization) {
299
- return self.driver.navigate().refresh();
300
- }
301
-
302
- return self.driver.executeScript('return window.location.href').then(function(href) {
303
- return self.get(href, timeout);
304
- });
305
- };
306
- FN
307
- end
308
-
309
- def navigate
310
- <<-FN
311
- /**
312
- * Mixin navigation methods back into the navigation object so that
313
- * they are invoked as before, i.e. driver.navigate().refresh()
314
- */
315
- function() {
316
- var nav = this.driver.navigate();
317
- mixin(nav, this, 'refresh');
318
- return nav;
319
- };
320
- FN
321
- end
322
-
323
- def setLocation
324
- <<-FN
325
- /**
326
- * Browse to another page using in-page navigation.
327
- *
328
- * @param {string} url In page URL using the same syntax as $location.url()
329
- * @returns {!webdriver.promise.Promise} A promise that will resolve once
330
- * page has been changed.
331
- */
332
- function(url) {
333
- this.waitForAngular();
334
- return this.driver.executeScript(clientSideScripts.setLocation, this.rootEl, url)
335
- .then(function(browserErr) {
336
- if (browserErr) {
337
- throw 'Error while navigating to \'' + url + '\' : ' +
338
- JSON.stringify(browserErr);
339
- }
340
- });
341
- };
342
- FN
343
- end
344
-
345
- def getLocationAbsUrl
346
- <<-FN
347
- /**
348
- * Returns the current absolute url from AngularJS.
349
- */
350
- function() {
351
- this.waitForAngular();
352
- return this.driver.executeScript(clientSideScripts.getLocationAbsUrl, this.rootEl);
353
- };
354
- FN
355
- end
356
- end
357
- end