@qavajs/cypress-runner-adapter 0.1.1 → 0.2.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
@@ -10,6 +10,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
10
10
  :pencil: - chore
11
11
  :microscope: - experimental
12
12
 
13
+ ## [0.2.0]
14
+ - :rocket: added _BeforeAll_ and _AfterAll_ hooks support
15
+
13
16
  ## [0.1.1]
14
17
  - :beetle: changed browserify to webpack
15
18
 
package/adapter/index.js CHANGED
@@ -46,6 +46,15 @@ function adapter(testCases) {
46
46
  });
47
47
  step.code.apply(world, parameters);
48
48
  }
49
+ if (supportCodeLibrary.beforeTestRunHookDefinitions.length > 0) {
50
+ describe('Before All', function () {
51
+ for (const beforeRun of supportCodeLibrary.beforeTestRunHookDefinitions) {
52
+ it('Before All', function () {
53
+ beforeRun.code.apply();
54
+ });
55
+ }
56
+ })
57
+ }
49
58
  for (const test of tests) {
50
59
  describe('Scenario: ' + test.name, { testIsolation: false }, function () {
51
60
  const world = new supportCodeLibrary.World();
@@ -60,7 +69,7 @@ function adapter(testCases) {
60
69
  pickleStep: this.step,
61
70
  gherkinDocument: tests,
62
71
  result: this.currentTest.state
63
- }])
72
+ }]);
64
73
  }
65
74
  }
66
75
  }
@@ -105,11 +114,20 @@ function adapter(testCases) {
105
114
  result,
106
115
  gherkinDocument: tests,
107
116
  willBeRetried: false
108
- }])
117
+ }]);
109
118
  });
110
119
  }
111
120
  }
112
121
  });
122
+ }
123
+ if (supportCodeLibrary.afterTestRunHookDefinitions.length > 0) {
124
+ describe('After All', function () {
125
+ for (const afterRun of supportCodeLibrary.afterTestRunHookDefinitions) {
126
+ it('After All', function () {
127
+ afterRun.code.apply();
128
+ });
129
+ }
130
+ })
113
131
  }
114
132
  `;
115
133
  }
package/index.d.ts CHANGED
@@ -25,5 +25,7 @@ export function BeforeStep(fn: Function): void;
25
25
  export function BeforeStep(options: StepHookOptions, fn: Function): void;
26
26
  export function AfterStep(fn: Function): void;
27
27
  export function AfterStep(options: StepHookOptions, fn: Function): void;
28
+ export function BeforeAll(fn: Function): void;
29
+ export function AfterAll(fn: Function): void;
28
30
  export function setWorldConstructor(world: IWorld): void;
29
31
  export function defineParameterType(option: ParameterTypeOption): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/cypress-runner-adapter",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "debug": "cypress open --config-file test/cypress.config.js",
@@ -1,12 +1,10 @@
1
- import {
2
- CucumberExpression,
3
- RegularExpression,
4
- } from '@cucumber/cucumber-expressions'
1
+ import { CucumberExpression, RegularExpression } from '@cucumber/cucumber-expressions'
5
2
  import StepDefinition from './step_definition';
6
- import {SourcedParameterTypeRegistry} from './sourced_parameter_type_registry';
3
+ import { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry';
7
4
  import TestCaseHookDefinition from './test_case_hook_definition';
8
5
  import TestStepHookDefinition from './test_step_hook_definition';
9
- import {buildParameterType} from './build_parameter_type';
6
+ import { buildParameterType } from './build_parameter_type';
7
+ import TestRunHookDefinition from './test_run_hook_definition';
10
8
  class World {}
11
9
 
12
10
  const supportCodeLibrary = {
@@ -84,6 +82,18 @@ export function AfterStep(optionsOrCode, code) {
84
82
  }));
85
83
  }
86
84
 
85
+ export function BeforeAll(handler) {
86
+ supportCodeLibrary.beforeTestRunHookDefinitions.push(new TestRunHookDefinition({
87
+ code: handler,
88
+ }));
89
+ }
90
+
91
+ export function AfterAll(handler) {
92
+ supportCodeLibrary.afterTestRunHookDefinitions.push(new TestRunHookDefinition({
93
+ code: handler,
94
+ }));
95
+ }
96
+
87
97
  export function setWorldConstructor(world) {
88
98
  supportCodeLibrary.World = world;
89
99
  }
@@ -0,0 +1,3 @@
1
+ import Definition from './definition'
2
+
3
+ export default class TestRunHookDefinition extends Definition {}