This repository was archived by the owner on Jul 29, 2024. It is now read-only.
File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,12 @@ Protractor.prototype.getProcessedConfig = null;
267
267
*/
268
268
Protractor . prototype . forkNewDriverInstance = null ;
269
269
270
+ /**
271
+ * Restart the browser instance.
272
+ *
273
+ * Set by the runner.
274
+ */
275
+ Protractor . prototype . restart = null ;
270
276
271
277
/**
272
278
* Instead of using a single root element, search through all angular apps
Original file line number Diff line number Diff line change @@ -223,6 +223,16 @@ Runner.prototype.createBrowser = function(plugins) {
223
223
}
224
224
return newBrowser ;
225
225
} ;
226
+
227
+ browser_ . restart = function ( ) {
228
+ // Note: because tests are not paused at this point, any async
229
+ // calls here are not guaranteed to complete before the tests resume.
230
+ self . driverprovider_ . quitDriver ( browser_ . driver ) ;
231
+ // Copy mock modules, but do not navigate to previous URL.
232
+ browser_ = browser_ . forkNewDriverInstance ( false , true ) ;
233
+ self . setupGlobals_ ( browser_ ) ;
234
+ } ;
235
+
226
236
return browser_ ;
227
237
} ;
228
238
@@ -304,14 +314,8 @@ Runner.prototype.run = function() {
304
314
305
315
if ( self . config_ . restartBrowserBetweenTests ) {
306
316
var restartDriver = function ( ) {
307
- // Note: because tests are not paused at this point, any async
308
- // calls here are not guaranteed to complete before the tests resume.
309
- self . driverprovider_ . quitDriver ( browser_ . driver ) ;
310
- // Copy mock modules, but do not navigate to previous URL.
311
- browser_ = browser_ . forkNewDriverInstance ( false , true ) ;
312
- self . setupGlobals_ ( browser_ ) ;
317
+ browser_ . restart ( ) ;
313
318
} ;
314
-
315
319
self . on ( 'testPass' , restartDriver ) ;
316
320
self . on ( 'testFail' , restartDriver ) ;
317
321
}
You can’t perform that action at this time.
0 commit comments