@@ -15,12 +15,9 @@ var log_ = function() {
15
15
} ;
16
16
17
17
/**
18
- * The plugin API for Protractor. Note that this API is extremely unstable
19
- * and current consists of only two functions:
20
- * <plugin>.setup - called before tests
21
- * <plugin>.teardown - called after tests
22
- * <plugin>.postResults - called after test results have been processed
23
- * More information on plugins coming in the future
18
+ * The plugin API for Protractor. Note that this API is unstable. See
19
+ * plugins/README.md for more information.
20
+ *
24
21
* @constructor
25
22
* @param {Object } config parsed from the config file
26
23
*/
@@ -58,8 +55,12 @@ function pluginFunFactory(funName) {
58
55
var pluginConf = this . pluginConfs [ name ] ;
59
56
var pluginObj = this . pluginObjs [ name ] ;
60
57
names . push ( name ) ;
61
- promises . push ( ( pluginObj [ funName ] || noop ) ( pluginConf ) ) ;
58
+ promises . push (
59
+ ( pluginObj [ funName ] || noop ) . apply (
60
+ pluginObj [ funName ] ,
61
+ [ pluginConf ] . concat ( [ ] . slice . call ( arguments ) ) ) ) ;
62
62
}
63
+
63
64
return q . all ( promises ) . then ( function ( results ) {
64
65
// Join the results into a single object and output any test results
65
66
var ret = { failedCount : 0 } ;
@@ -131,4 +132,12 @@ Plugins.prototype.teardown = pluginFunFactory('teardown');
131
132
*/
132
133
Plugins . prototype . postResults = pluginFunFactory ( 'postResults' ) ;
133
134
135
+ /**
136
+ * Called after each test block completes.
137
+ *
138
+ * @return {q.Promise } A promise which resolves when the plugins have all been
139
+ * torn down.
140
+ */
141
+ Plugins . prototype . postTest = pluginFunFactory ( 'postTest' ) ;
142
+
134
143
module . exports = Plugins ;
0 commit comments