Created
September 8, 2015 20:26
-
-
Save beatfactor/7115c2f0e5c0916b4618 to your computer and use it in GitHub Desktop.
Revisions
-
beatfactor renamed this gist
Sep 8, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
beatfactor created this gist
Sep 8, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ module.exports = { groupGlobals : null, checkGroupGlobals : function(hookName) { if (hookName && this.groupGlobals) { return this.groupGlobals[hookName]; } if (this.test_settings.group_name) { try { this.groupGlobals = require('../globals/' + this.test_settings.group_name.toLowerCase() + '.js'); if (hookName) { return this.groupGlobals[hookName]; } } catch (err) { return false; } } return false; }, endSession : function(client, done) { if (client.sessionId) { client.end(function() { done(); }); } else { done(); } }, before: function (done) { var beforeGroup = this.checkGroupGlobals('before'); if (beforeGroup) { beforeGroup.call(this, done); } else { done(); } }, after: function (done) { var afterGroup = this.checkGroupGlobals('before'); if (afterGroup) { afterGroup.call(this, done); } else { done(); } }, beforeEach: function (client, done) { var beforeGroupEach = this.checkGroupGlobals('beforeEach'); if (beforeGroupEach) { beforeGroupEach.call(this, client, done); } else { done(); } }, afterEach : function (client, done) { var afterGroupEach = this.checkGroupGlobals('afterEach'); if (afterGroupEach) { afterGroupEach.call(this, client, function() { this.endSession(client, done); }.bind(this)); } else { this.endSession(client, done); } } };