@@ -837,7 +837,7 @@ Protractor.prototype.clearMockModules = function() {
837
837
* Remove a registered mock module.
838
838
* @param {!string } name The name of the module to remove.
839
839
*/
840
- Protractor . prototype . removeMockModule = function ( name ) {
840
+ Protractor . prototype . removeMockModule = function ( name ) {
841
841
var index = this . moduleNames_ . indexOf ( name ) ;
842
842
this . moduleNames_ . splice ( index , 1 ) ;
843
843
this . moduleScripts_ . splice ( index , 1 ) ;
@@ -848,7 +848,7 @@ Protractor.prototype.removeMockModule = function (name) {
848
848
*
849
849
* Navigate to the given destination and loads mock modules before
850
850
* Angular. Assumes that the page being loaded uses Angular.
851
- * If you need to access a page which does have Angular on load, use
851
+ * If you need to access a page which does not have Angular on load, use
852
852
* the wrapped webdriver directly.
853
853
*
854
854
* @param {string } destination Destination URL.
@@ -867,7 +867,7 @@ Protractor.prototype.get = function(destination, opt_timeout) {
867
867
this . driver . get ( 'about:blank' ) ;
868
868
this . driver . executeScript (
869
869
'window.name = "' + DEFER_LABEL + '" + window.name;' +
870
- 'window.location.assign ("' + destination + '");' ) ;
870
+ 'window.location.replace ("' + destination + '");' ) ;
871
871
872
872
// At this point, we need to make sure the new url has loaded before
873
873
// we try to execute any asynchronous scripts.
@@ -909,6 +909,39 @@ Protractor.prototype.get = function(destination, opt_timeout) {
909
909
} , this . moduleNames_ ) ;
910
910
} ;
911
911
912
+ /**
913
+ * See webdriver.WebDriver.refresh
914
+ *
915
+ * Makes a full reload of the current page and loads mock modules before
916
+ * Angular. Assumes that the page being loaded uses Angular.
917
+ * If you need to access a page which does not have Angular on load, use
918
+ * the wrapped webdriver directly.
919
+ *
920
+ * @param {number= } opt_timeout Number of seconds to wait for Angular to start.
921
+ */
922
+ Protractor . prototype . refresh = function ( opt_timeout ) {
923
+ var timeout = opt_timeout || 10 ;
924
+ var self = this ;
925
+
926
+ if ( self . ignoreSynchronization ) {
927
+ return self . driver . navigate ( ) . refresh ( ) ;
928
+ }
929
+
930
+ return self . driver . executeScript ( 'return window.location.href' ) . then ( function ( href ) {
931
+ return self . get ( href , opt_timeout ) ;
932
+ } ) ;
933
+ } ;
934
+
935
+ /**
936
+ * Mixin navigation methods back into the navigation object so that
937
+ * they are invoked as before, i.e. driver.navigate().refresh()
938
+ */
939
+ Protractor . prototype . navigate = function ( ) {
940
+ var nav = this . driver . navigate ( ) ;
941
+ mixin ( nav , this , 'refresh' ) ;
942
+ return nav ;
943
+ }
944
+
912
945
/**
913
946
* Browse to another page using in-page navigation.
914
947
*
0 commit comments