How to control the flow of methods that don't return promise in protractor test -
i've got spec i'm grabbing screenshot requires dynamic path created. makedir
not return promise, fires @ same time (after) savescreenshot
. what's best way ensure makedir
called first?
getpath().then(function(path) { makedir(baseurl + '/' + path); savescreenshot(baseurl + '/' + path + '/' + filename); })
you should able chain then() , second operation in there.
getpath().then(function(path) { makedir(baseurl + '/' + path); var screenshotpath = baseurl + '/' + path + '/' + filename; return screenshotpath; }).then(function(screenshotpath) { savescreenshot(screenshotpath); });
Comments
Post a Comment