onCleanUp() vs onComplete() vs afterLaunch()
In Protractor, there is a "global set up" method called onPrepare()
, but I'm not completely sure what is meant to be a "global tear down" - there are three relevant methods: onCleanUp
, onComplete
and afterLaunch
that are all called after a test execution.
Why does protractor
have three methods called after a test run? What is the difference between onCleanUp
, onComplete
and afterLaunch
?
I've also noticed that there is an "exit" event that we can attach a callback to (example here):
protractor.on('exit', function (status) {
});
Answer
onComplete
will be executed once per capability after all tests have finished, but the webdriver instance has not yet been shut down.
onCleanup
will be executed once per capability after all tests have finished and the webdriver instance has been shut down
afterLaunch
will be executed only once before program exits; after all capabilities are finished (after all onCleanup
)
Further information on protractor callback functions can be found in their GitHub documentation.
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM