@qavajs/cypress-runner-adapter 1.7.0 → 1.9.0

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/CHANGELOG.md CHANGED
@@ -14,6 +14,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
14
14
 
15
15
  :microscope: - experimental
16
16
 
17
+ ## [1.9.0]
18
+ - :rocket: added step log groups for `it` mode
19
+
20
+ ## [1.8.0]
21
+ - :rocket: added `testCaseStartedId` and `testStepId` as hooks parameters to comply cucumber spec
22
+
17
23
  ## [1.7.0]
18
24
  - :rocket: updated @cucumber/cucumber-expressions, @cucumber/gherkin, @cucumber/tag-expressions
19
25
 
@@ -94,7 +94,9 @@ module.exports = function makeMochaTest(tests) {
94
94
  status,
95
95
  exception,
96
96
  message
97
- }
97
+ },
98
+ testCaseStartedId: test.id,
99
+ testStepId: this.step.id,
98
100
  }]);
99
101
  }
100
102
  }
@@ -109,7 +111,8 @@ module.exports = function makeMochaTest(tests) {
109
111
  beforeTest.code.apply(world, [{
110
112
  pickle: test,
111
113
  gherkinDocument: tests,
112
- willBeRetried: false
114
+ willBeRetried: false,
115
+ testCaseStartedId: test.id
113
116
  }]);
114
117
  });
115
118
  }
@@ -124,7 +127,9 @@ module.exports = function makeMochaTest(tests) {
124
127
  beforeStep.code.apply(world, [{
125
128
  pickle: test,
126
129
  pickleStep: step,
127
- gherkinDocument: tests
130
+ gherkinDocument: tests,
131
+ testCaseStartedId: test.id,
132
+ testStepId: this.step.id,
128
133
  }]);
129
134
  }
130
135
  }
@@ -145,7 +150,8 @@ module.exports = function makeMochaTest(tests) {
145
150
  message
146
151
  },
147
152
  gherkinDocument: tests,
148
- willBeRetried: false
153
+ willBeRetried: false,
154
+ testCaseStartedId: test.id,
149
155
  }]);
150
156
  });
151
157
  }
@@ -39,8 +39,8 @@ module.exports = function makeMochaTest(tests) {
39
39
  if (steps.length === 0) throw new Error(`Step '${text}' is not defined`);
40
40
  if (steps.length > 1) throw new Error(`Step '${text}' matches multiple step definitions`);
41
41
  const [step] = steps;
42
- const {parameters} = step.getInvocationParameters({
43
- step: {text, argument},
42
+ const { parameters } = step.getInvocationParameters({
43
+ step: { text, argument },
44
44
  world: this
45
45
  });
46
46
  step.code.apply(this, parameters);
@@ -49,10 +49,10 @@ module.exports = function makeMochaTest(tests) {
49
49
  function executeStep(pickle, world) {
50
50
  cy.then(() => {
51
51
  if (pickle.argument && pickle.argument.dataTable) {
52
- Cypress.log({displayName: 'DataTable', message: pickle.argument.dataTable});
52
+ Cypress.log({ displayName: 'DataTable', message: pickle.argument.dataTable });
53
53
  }
54
54
  if (pickle.argument && pickle.argument.docString) {
55
- Cypress.log({displayName: 'Multiline', message: pickle.argument.docString.content});
55
+ Cypress.log({ displayName: 'Multiline', message: pickle.argument.docString.content });
56
56
  }
57
57
  });
58
58
  executeStepByText.call(world, pickle.text, pickle.argument);
@@ -60,11 +60,22 @@ module.exports = function makeMochaTest(tests) {
60
60
 
61
61
  supportCodeLibrary.World.prototype.executeStep = executeStepByText;
62
62
 
63
- function runStep(name, callback) {
63
+ function runStep({ keyword, name }, callback) {
64
+ const displayName = keyword ? keyword : name;
65
+ const message = keyword && name ? name : '';
66
+ let group;
64
67
  cy.then(() => {
65
- Cypress.log({displayName: name, message: ''});
66
- })
68
+ group = Cypress.log({
69
+ name,
70
+ displayName,
71
+ message,
72
+ groupStart: true,
73
+ });
74
+ });
67
75
  callback();
76
+ cy.then(() => {
77
+ group.endGroup();
78
+ });
68
79
  }
69
80
 
70
81
  function findTest(tests, name) {
@@ -94,11 +105,12 @@ module.exports = function makeMochaTest(tests) {
94
105
  });
95
106
  for (const beforeTest of supportCodeLibrary.beforeTestCaseHookDefinitions) {
96
107
  if (beforeTest.appliesToTestCase(test)) {
97
- runStep(beforeTest.name, function () {
108
+ runStep({ name: beforeTest.name }, function () {
98
109
  beforeTest.code.apply(world, [{
99
110
  pickle: test,
100
111
  gherkinDocument: tests,
101
- willBeRetried: false
112
+ willBeRetried: false,
113
+ testCaseStartedId: test.id
102
114
  }]);
103
115
  });
104
116
  }
@@ -117,6 +129,8 @@ module.exports = function makeMochaTest(tests) {
117
129
  pickle: test,
118
130
  pickleStep: this.step,
119
131
  gherkinDocument: tests,
132
+ testCaseStartedId: test.id,
133
+ testStepId: this.step.id,
120
134
  result
121
135
  }]);
122
136
  }
@@ -124,11 +138,12 @@ module.exports = function makeMochaTest(tests) {
124
138
  }
125
139
  for (const afterTest of supportCodeLibrary.afterTestCaseHookDefinitions) {
126
140
  if (afterTest.appliesToTestCase(test)) {
127
- runStep(afterTest.name, function () {
141
+ runStep({ name: afterTest.name }, function () {
128
142
  afterTest.code.apply(world, [{
129
143
  pickle: test,
130
144
  result,
131
145
  gherkinDocument: tests,
146
+ testCaseStartedId: test.id,
132
147
  willBeRetried: false
133
148
  }]);
134
149
  });
@@ -140,16 +155,18 @@ module.exports = function makeMochaTest(tests) {
140
155
  it('Scenario: ' + test.name, function () {
141
156
  const world = this.world;
142
157
  for (const step of test.steps) {
143
- const stepName = `${keyword(step)} ${stepNameText(step)}`;
144
- runStep(stepName, function () {
158
+ runStep({ keyword: keyword(step), name: stepNameText(step) }, function () {
145
159
  this.step = step;
146
- const result = {status: 'passed', duration: 0};
160
+ const result = { status: 'passed', duration: 0 };
147
161
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
148
162
  if (beforeStep.appliesToTestCase(step)) {
149
163
  beforeStep.code.apply(world, [{
150
164
  pickle: test,
151
165
  pickleStep: step,
152
- gherkinDocument: tests
166
+ gherkinDocument: tests,
167
+ willBeRetried: false,
168
+ testCaseStartedId: test.id,
169
+ testStepId: step.id
153
170
  }]);
154
171
  }
155
172
  }
@@ -160,7 +177,10 @@ module.exports = function makeMochaTest(tests) {
160
177
  pickle: test,
161
178
  pickleStep: this.step,
162
179
  gherkinDocument: tests,
163
- result
180
+ result,
181
+ willBeRetried: false,
182
+ testCaseStartedId: test.id,
183
+ testStepId: step.id
164
184
  }]);
165
185
  }
166
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/cypress-runner-adapter",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "debug": "cypress open --config-file test/cypress.config.js",
@@ -23,13 +23,13 @@
23
23
  "homepage": "https://qavajs.github.io/docs/intro",
24
24
  "dependencies": {
25
25
  "@cucumber/cucumber-expressions": "^19.0.0",
26
- "@cucumber/gherkin": "^38.0.0",
26
+ "@cucumber/gherkin": "^39.0.0",
27
27
  "@cucumber/tag-expressions": "^9.1.0",
28
28
  "@cypress/webpack-preprocessor": "^7.0.2",
29
- "fs-extra": "^11.3.3"
29
+ "fs-extra": "^11.3.4"
30
30
  },
31
31
  "devDependencies": {
32
- "cypress": "^15.10.0",
32
+ "cypress": "^15.11.0",
33
33
  "mochawesome": "^7.1.4"
34
34
  },
35
35
  "keywords": [