* Configuration for a Feature. * Can inject values and add custom configuration.
| 3 | * Can inject values and add custom configuration. |
| 4 | */ |
| 5 | class FeatureConfig { |
| 6 | /** |
| 7 | * @param {CodeceptJS.Suite} suite |
| 8 | */ |
| 9 | constructor(suite) { |
| 10 | this.suite = suite |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Set metadata for this suite |
| 15 | * @param {string} key |
| 16 | * @param {string} value |
| 17 | * @returns {this} |
| 18 | */ |
| 19 | meta(key, value) { |
| 20 | this.suite.tests.forEach(test => { |
| 21 | test.meta[key] = value |
| 22 | }) |
| 23 | return this |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Retry this test for number of times |
| 28 | * |
| 29 | * @param {number} retries |
| 30 | * @returns {this} |
| 31 | */ |
| 32 | retry(retries) { |
| 33 | this.suite.retries(retries) |
| 34 | return this |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Set timeout for this test |
| 39 | * @param {number} timeout |
| 40 | * @returns {this} |
| 41 | */ |
| 42 | timeout(timeout) { |
| 43 | this.suite.timeout(timeout) |
| 44 | return this |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @callback FeatureConfigCallback |
| 49 | * @param {CodeceptJS.Suite} suite |
| 50 | * @returns {Object<string, any>} |
| 51 | */ |
| 52 | |
| 53 | /** |
| 54 | * Configures a helper. |
| 55 | * Helper name can be omitted and values will be applied to first helper. |
| 56 | * @param {string | Object<string, any> | FeatureConfigCallback} helper |
| 57 | * @param {Object<string, any>} [obj] |
| 58 | * @returns {this} |
| 59 | */ |
| 60 | config(helper, obj) { |
| 61 | if (!obj) { |
| 62 | obj = helper |
nothing calls this directly
no outgoing calls
no test coverage detected