codeceptjs 4.0.0-rc.22 → 4.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/actor.js CHANGED
@@ -94,7 +94,7 @@ export default function (obj = {}, container) {
94
94
  actor[action] = actor[actionAlias] = function () {
95
95
  const step = new Step(helper, action)
96
96
  if (translation.loaded) {
97
- step.name = actionAlias
97
+ step.title = actionAlias
98
98
  step.actor = translation.I
99
99
  }
100
100
  // add methods to promise chain
package/lib/heal.js CHANGED
@@ -49,12 +49,12 @@ class Heal {
49
49
  }
50
50
 
51
51
  hasCorrespondingRecipes(step) {
52
- return matchRecipes(this.recipes, this.contextName).filter(r => !r.steps || r.steps.includes(step.name)).length > 0
52
+ return matchRecipes(this.recipes, this.contextName).filter(r => !r.steps || r.steps.includes(step.title)).length > 0
53
53
  }
54
54
 
55
55
  async getCodeSuggestions(context) {
56
56
  const suggestions = []
57
- const stepName = context.step?.name
57
+ const stepName = context.step?.title
58
58
  const recipes = matchRecipes(this.recipes, this.contextName)
59
59
  .filter(r => !r.steps || !stepName || r.steps.includes(stepName))
60
60
 
@@ -195,7 +195,7 @@ export default function (config = {}) {
195
195
  } else {
196
196
  if (stepNum === -1) return
197
197
  if (isStepIgnored(step)) return
198
- if (step.metaStep && step.metaStep.name === 'BeforeSuite') return
198
+ if (step.metaStep && step.metaStep.title === 'BeforeSuite') return
199
199
 
200
200
  const stepPrefix = generateStepPrefix(step, stepNum)
201
201
  stepNum++
@@ -247,7 +247,7 @@ export default function (config = {}) {
247
247
  async function persistStep(step) {
248
248
  if (stepNum === -1) return
249
249
  if (isStepIgnored(step)) return
250
- if (step.metaStep && step.metaStep.name === 'BeforeSuite') return
250
+ if (step.metaStep && step.metaStep.title === 'BeforeSuite') return
251
251
 
252
252
  const stepKey = step.toString()
253
253
 
@@ -437,8 +437,9 @@ export default function (config = {}) {
437
437
 
438
438
  function isStepIgnored(step) {
439
439
  if (!config.ignoreSteps) return false
440
+ if (!step.title) return false
440
441
  for (const pattern of config.ignoreSteps || []) {
441
- if (step.name.match(pattern)) return true
442
+ if (step.title.match(pattern)) return true
442
443
  }
443
444
  return false
444
445
  }
@@ -242,7 +242,7 @@ function stepLogLine(entry) {
242
242
 
243
243
  function stepText(step) {
244
244
  if (step && typeof step.toString === 'function' && step.toString !== Object.prototype.toString) return step.toString()
245
- return (step && (step.title || step.name)) || 'step'
245
+ return (step && step.title) || 'step'
246
246
  }
247
247
 
248
248
  function stepDuration(step) {
@@ -111,11 +111,12 @@ export default function (config) {
111
111
  }
112
112
 
113
113
  event.dispatcher.on(event.step.started, step => {
114
+ if (!step.title) return
114
115
  for (const ignored of config.ignoredSteps) {
115
- if (step.name === ignored) return
116
+ if (step.title === ignored) return
116
117
  if (ignored instanceof RegExp) {
117
- if (step.name.match(ignored)) return
118
- } else if (ignored.indexOf('*') && step.name.startsWith(ignored.slice(0, -1))) return
118
+ if (step.title.match(ignored)) return
119
+ } else if (ignored.indexOf('*') && step.title.startsWith(ignored.slice(0, -1))) return
119
120
  }
120
121
  enableRetry = true
121
122
  })
@@ -258,7 +258,7 @@ function formatTimestamp(timestampInMs) {
258
258
  }
259
259
 
260
260
  function stepTitle(step) {
261
- let title = `${step.actor}.${step.name}(${step.args ? step.args.join(',') : ''})`
261
+ let title = `${step.actor}.${step.title}(${step.args ? step.args.join(',') : ''})`
262
262
  if (title.length > 100) title = `${title.substring(0, 100)}...`
263
263
  return title
264
264
  }
@@ -325,7 +325,7 @@ function wireSlides(options, trigger) {
325
325
  if (stepNum === -1) return
326
326
  if (savedStep === step) return
327
327
  if (scenarioFailed) return
328
- if (step.metaStep && step.metaStep.name === 'BeforeSuite') return
328
+ if (step.metaStep && step.metaStep.title === 'BeforeSuite') return
329
329
  if (!currentTest) return
330
330
  if (!stepFilter(step)) return
331
331
  if (isStepIgnored(step, options.ignoreSteps)) return
@@ -404,7 +404,7 @@ function makeStepFilter(trigger, options) {
404
404
  function isStepIgnored(step, patterns) {
405
405
  if (!patterns || !patterns.length) return false
406
406
  for (const pattern of patterns) {
407
- if (step.name && step.name.match(pattern)) return true
407
+ if (step.title && step.title.match(pattern)) return true
408
408
  }
409
409
  return false
410
410
  }
@@ -68,6 +68,7 @@ export default function(config) {
68
68
  config.customTimeoutSteps = config.customTimeoutSteps.concat(config.noTimeoutSteps).concat(config.customTimeoutSteps)
69
69
 
70
70
  event.dispatcher.on(event.step.before, step => {
71
+ if (!step.title) return
71
72
  let stepTimeout
72
73
  for (let stepRule of config.customTimeoutSteps) {
73
74
  let customTimeout = 0
@@ -75,7 +76,7 @@ export default function(config) {
75
76
  if (stepRule.length > 1) customTimeout = stepRule[1]
76
77
  stepRule = stepRule[0]
77
78
  }
78
- if (stepRule instanceof RegExp ? step.name.match(stepRule) : step.name === stepRule || (stepRule.indexOf('*') && step.name.startsWith(stepRule.slice(0, -1)))) {
79
+ if (stepRule instanceof RegExp ? step.title.match(stepRule) : step.title === stepRule || (stepRule.indexOf('*') && step.title.startsWith(stepRule.slice(0, -1)))) {
79
80
  stepTimeout = customTimeout
80
81
  break
81
82
  }
package/lib/step/base.js CHANGED
@@ -10,12 +10,12 @@ const STACK_LINE = 5
10
10
  /**
11
11
  * Each command in test executed through `I.` object is wrapped in Step.
12
12
  * Step allows logging executed commands and triggers hook before and after step execution.
13
- * @param {string} name
13
+ * @param {string} title
14
14
  */
15
15
  class Step {
16
- constructor(name) {
16
+ constructor(title) {
17
17
  /** @member {string} */
18
- this.name = name
18
+ this.title = title
19
19
  /** @member {Map<number, number>} */
20
20
  this.timeouts = new Map()
21
21
 
@@ -43,7 +43,7 @@ class Step {
43
43
  /** @member {any} */
44
44
  this.helper = null
45
45
  /** @member {string} */
46
- this.helperMethod = name
46
+ this.helperMethod = title
47
47
 
48
48
  this.startTime = 0
49
49
  this.endTime = 0
@@ -103,7 +103,7 @@ class Step {
103
103
 
104
104
  /** @return {string} */
105
105
  humanize() {
106
- return humanizeString(this.name)
106
+ return humanizeString(this.title)
107
107
  }
108
108
 
109
109
  /** @return {string} */
@@ -180,7 +180,7 @@ class Step {
180
180
 
181
181
  /** @return {string} */
182
182
  toCode() {
183
- return `${this.prefix}${this.actor}.${this.name}(${this.humanizeArgs()})${this.suffix}`
183
+ return `${this.prefix}${this.actor}.${this.title}(${this.humanizeArgs()})${this.suffix}`
184
184
  }
185
185
 
186
186
  isMetaStep() {
@@ -223,7 +223,7 @@ class Step {
223
223
 
224
224
  return {
225
225
  opts: step.opts || {},
226
- title: step.name,
226
+ title: step.title,
227
227
  args: args,
228
228
  status: step.status,
229
229
  startTime: step.startTime,
@@ -1,8 +1,8 @@
1
1
  import FuncStep from './func.js'
2
2
 
3
3
  class CommentStep extends FuncStep {
4
- constructor(name, comment) {
5
- super(name)
4
+ constructor(title, comment) {
5
+ super(title)
6
6
  this.fn = () => {}
7
7
  }
8
8
  }
@@ -2,12 +2,12 @@ import Step from './base.js'
2
2
  import store from '../store.js'
3
3
 
4
4
  class HelperStep extends Step {
5
- constructor(helper, name) {
6
- super(name)
5
+ constructor(helper, title) {
6
+ super(title)
7
7
  /** @member {CodeceptJS.Helper} helper corresponding helper */
8
8
  this.helper = helper
9
- /** @member {string} helperMethod name of method to be executed */
10
- this.helperMethod = name
9
+ /** @member {string} helperMethod title of method to be executed */
10
+ this.helperMethod = title
11
11
  }
12
12
 
13
13
  /**
package/lib/step/meta.js CHANGED
@@ -29,7 +29,7 @@ class MetaStep extends Step {
29
29
  const actorText = this.actor
30
30
 
31
31
  if (this.isBDD()) {
32
- return `${this.prefix}${actorText} ${this.name} "${this.humanizeArgs()}${this.suffix}"`
32
+ return `${this.prefix}${actorText} ${this.title} "${this.humanizeArgs()}${this.suffix}"`
33
33
  }
34
34
 
35
35
  if (actorText === 'I') {
@@ -37,14 +37,14 @@ class MetaStep extends Step {
37
37
  }
38
38
 
39
39
  if (!this.actor) {
40
- return `${this.name} ${this.humanizeArgs()}${this.suffix}`.trim()
40
+ return `${this.title} ${this.humanizeArgs()}${this.suffix}`.trim()
41
41
  }
42
42
 
43
43
  return `On ${this.prefix}${actorText}: ${this.humanize()} ${this.humanizeArgs()}${this.suffix}`.trim()
44
44
  }
45
45
 
46
46
  humanize() {
47
- return humanizeString(this.name)
47
+ return humanizeString(this.title)
48
48
  }
49
49
 
50
50
  setTrace() {}
@@ -16,12 +16,12 @@ function recordStep(step, args) {
16
16
  const { opts, timeout, retry } = stepConfig.getConfig()
17
17
 
18
18
  if (opts) {
19
- output.debug(`Step ${step.name}: options applied ${JSON.stringify(opts)}`)
19
+ output.debug(`Step ${step.title}: options applied ${JSON.stringify(opts)}`)
20
20
  store.stepOptions = opts
21
21
  step.opts = opts
22
22
  }
23
23
  if (timeout) {
24
- output.debug(`Step ${step.name} timeout ${timeout}s`)
24
+ output.debug(`Step ${step.title} timeout ${timeout}s`)
25
25
  step.setTimeout(timeout * 1000, TIMEOUT_ORDER.codeLimitTime)
26
26
  }
27
27
  if (retry) retryStep(retry)
@@ -31,7 +31,7 @@ function recordStep(step, args) {
31
31
  // run async before step hooks
32
32
  event.emit(event.step.before, step)
33
33
 
34
- const task = `${step.name}: ${step.humanizeArgs()}`
34
+ const task = `${step.title}: ${step.humanizeArgs()}`
35
35
  let val
36
36
 
37
37
  // run step inside promise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.0.0-rc.22",
3
+ "version": "4.0.0-rc.23",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [