Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | 5x 5x 5x 1x 1x 1x 1x 1x 1x | import { executeHooksWithArgs } from '@wdio/config'
import CucumberEventListener from './cucumberEventListener'
export default class HookRunner {
gherkinDocEvents = []
constructor (eventBroadcaster, config) {
this.config = config
this.eventListener = new CucumberEventListener(eventBroadcaster)
.on('before-feature', ::this.handleBeforeFeature)
.on('before-scenario', ::this.handleBeforeScenario)
.on('before-step', ::this.handleBeforeStep)
.on('after-step', ::this.handleAfterStep)
.on('after-scenario', ::this.handleAfterScenario)
.on('after-feature', ::this.handleAfterFeature)
}
/**
* handle beforeFeature hook
* @param {String} uri url of feature
* @param {Object} feature feature object from Cucumber
* @return {Promise} hook promise
*/
handleBeforeFeature (...args) {
return executeHooksWithArgs(this.config.beforeFeature, args)
}
/**
* [handleBeforeScenario description]
* @param {String} uri uri of feature file
* @param {Object} feature feature object from Cucumber
* @param {[type]} scenario scenario object from Cucumber
* @return {Promise} hook promise
*/
handleBeforeScenario (...args) {
return executeHooksWithArgs(this.config.beforeScenario, args)
}
/**
* [handleBeforeStep description]
* @param {String} uri uri of feature file
* @param {Object} feature feature object from Cucumber
* @param {[type]} scenario scenario object from Cucumber
* @param {[type]} step step object from Cucumber
* @return {Promise} hook promise
*/
handleBeforeStep (...args) {
return executeHooksWithArgs(this.config.beforeStep, args)
}
/**
* [handleAfterStep description]
* @param {String} uri uri of feature file
* @param {Object} feature feature object from Cucumber
* @param {[type]} scenario scenario object from Cucumber
* @param {[type]} step step object from Cucumber
* @param {[type]} result result of step
* @return {Promise} hook promise
*/
handleAfterStep (...args) {
return executeHooksWithArgs(this.config.afterStep, args)
}
/**
* @param {String} uri uri of feature file
* @param {Object} feature feature object from Cucumber
* @param {[type]} scenario scenario object from Cucumber
* @return {Promise} hook promise
*/
handleAfterScenario (...args) {
return executeHooksWithArgs(this.config.afterScenario, args)
}
/**
* [handleAfterFeature description]
* @param {String} uri url of feature
* @param {Object} feature feature object from Cucumber
* @return {Promise} hook promise
*/
handleAfterFeature (...args) {
return executeHooksWithArgs(this.config.afterFeature, args)
}
}
|