@qavajs/cypress-runner-adapter 0.2.0 → 1.0.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
@@ -5,11 +5,18 @@ All notable changes to the "@qavajs/cypress-runner-adapter" will be documented i
5
5
  Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6
6
 
7
7
  :rocket: - new feature
8
+
8
9
  :beetle: - bugfix
10
+
9
11
  :x: - deprecation/removal
12
+
10
13
  :pencil: - chore
14
+
11
15
  :microscope: - experimental
12
16
 
17
+ ## [1.0.0]
18
+ - :rocket: added `this.executeStep` world method
19
+
13
20
  ## [0.2.0]
14
21
  - :rocket: added _BeforeAll_ and _AfterAll_ hooks support
15
22
 
package/adapter/index.js CHANGED
@@ -25,6 +25,19 @@ function adapter(testCases) {
25
25
  }
26
26
  }
27
27
 
28
+ function executeStepByText(text, argument) {
29
+ const steps = supportCodeLibrary.stepDefinitions
30
+ .filter(stepDefinition => stepDefinition.matchesStepName(text));
31
+ if (steps.length === 0) throw new Error(\`Step '\${text}' is not defined\`);
32
+ if (steps.length > 1) throw new Error(\`Step '\${text}' matches multiple step definitions\`);
33
+ const [step] = steps;
34
+ const { parameters } = step.getInvocationParameters({
35
+ step: { text, argument },
36
+ world: this
37
+ });
38
+ step.code.apply(this, parameters);
39
+ }
40
+
28
41
  function executeStep(pickle, world) {
29
42
  if (pickle.argument && pickle.argument.dataTable) {
30
43
  Cypress.log({ displayName: 'DataTable', message: pickle.argument.dataTable })
@@ -32,20 +45,9 @@ function adapter(testCases) {
32
45
  if (pickle.argument && pickle.argument.docString) {
33
46
  Cypress.log({ displayName: 'Multiline', message: pickle.argument.docString.content })
34
47
  }
35
- const steps = supportCodeLibrary.stepDefinitions
36
- .filter(stepDefinition => stepDefinition.matchesStepName(pickle.text));
37
- if (steps.length === 0) throw new Error(\`Step '\${pickle.text}' is not defined\`);
38
- if (steps.length > 1) throw new Error(\`'\${pickle.text}' matches multiple step definitions\`);
39
- const [step] = steps;
40
- const { parameters } = step.getInvocationParameters({
41
- step: {
42
- text: pickle.text,
43
- argument: pickle.argument
44
- },
45
- world
46
- });
47
- step.code.apply(world, parameters);
48
+ executeStepByText.call(world, pickle.text, pickle.argument);
48
49
  }
50
+
49
51
  if (supportCodeLibrary.beforeTestRunHookDefinitions.length > 0) {
50
52
  describe('Before All', function () {
51
53
  for (const beforeRun of supportCodeLibrary.beforeTestRunHookDefinitions) {
@@ -58,6 +60,7 @@ function adapter(testCases) {
58
60
  for (const test of tests) {
59
61
  describe('Scenario: ' + test.name, { testIsolation: false }, function () {
60
62
  const world = new supportCodeLibrary.World();
63
+ world.executeStep = executeStepByText;
61
64
  let skip = false;
62
65
  let result = 'passed';
63
66
  afterEach(function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/cypress-runner-adapter",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "debug": "cypress open --config-file test/cypress.config.js",
@@ -10,13 +10,13 @@
10
10
  "license": "MIT",
11
11
  "description": "feature file preprocessor",
12
12
  "dependencies": {
13
- "@cucumber/cucumber-expressions": "^17.1.0",
14
- "@cucumber/gherkin": "^28.0.0",
15
- "@cucumber/tag-expressions": "^6.1.0",
13
+ "@cucumber/cucumber-expressions": "^18.0.1",
14
+ "@cucumber/gherkin": "^30.0.4",
15
+ "@cucumber/tag-expressions": "^6.1.1",
16
16
  "@cypress/webpack-preprocessor": "^6.0.2",
17
17
  "fs-extra": "^11.2.0"
18
18
  },
19
19
  "devDependencies": {
20
- "cypress": "^13.11.0"
20
+ "cypress": "^13.16.0"
21
21
  }
22
22
  }