@qavajs/playwright-runner-adapter 0.6.0 → 0.7.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,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
10
10
  :pencil: - chore
11
11
  :microscope: - experimental
12
12
 
13
+ ## [0.7.0]
14
+ - :rocket: added support of named hooks
15
+
16
+ ## [0.6.1]
17
+ - :beetle: make params in hooks closer to cucumber types
18
+
13
19
  ## [0.6.0]
14
20
  - :rocket: added test case accessor to BeforeStep/AfterStep hooks
15
21
 
@@ -29,11 +29,15 @@ for (const feature of features) {
29
29
  for (const testCase of tests) {
30
30
  const tag = testCase.tags.map((tag) => tag.name);
31
31
  test(testCase.name, { tag }, async () => {
32
+ var _a, _b;
32
33
  const result = { status: 'passed' };
33
34
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
34
35
  if (beforeHook.appliesToTestCase(testCase)) {
35
- await test.step('Before', async () => {
36
- await beforeHook.code.apply(world, [testCase]);
36
+ const hookName = (_a = beforeHook.name) !== null && _a !== void 0 ? _a : 'Before';
37
+ await test.step(hookName, async () => {
38
+ await beforeHook.code.apply(world, [{
39
+ pickle: testCase
40
+ }]);
37
41
  });
38
42
  }
39
43
  }
@@ -41,7 +45,10 @@ for (const feature of features) {
41
45
  await test.step(pickleStep.text, async () => {
42
46
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
43
47
  if (beforeStep.appliesToTestCase(testCase)) {
44
- await beforeStep.code.apply(world, [testCase]);
48
+ await beforeStep.code.apply(world, [{
49
+ pickle: testCase,
50
+ pickleStep
51
+ }]);
45
52
  }
46
53
  }
47
54
  const steps = supportCodeLibrary.stepDefinitions
@@ -67,7 +74,11 @@ for (const feature of features) {
67
74
  }
68
75
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
69
76
  if (afterStep.appliesToTestCase(testCase)) {
70
- await afterStep.code.apply(world, [Object.assign(Object.assign({}, testCase), { result })]);
77
+ await afterStep.code.apply(world, [{
78
+ pickle: testCase,
79
+ pickleStep,
80
+ result
81
+ }]);
71
82
  }
72
83
  }
73
84
  if (result.error)
@@ -76,8 +87,11 @@ for (const feature of features) {
76
87
  }
77
88
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
78
89
  if (afterHook.appliesToTestCase(testCase)) {
79
- await test.step('After', async () => {
80
- await afterHook.code.apply(world, [Object.assign(Object.assign({}, testCase), { result })]);
90
+ const hookName = (_b = afterHook.name) !== null && _b !== void 0 ? _b : 'After';
91
+ await test.step(hookName, async () => {
92
+ await afterHook.code.apply(world, [{
93
+ pickle: testCase, result
94
+ }]);
81
95
  });
82
96
  }
83
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.spec.js","sourceRoot":"","sources":["../src/adapter.spec.ts"],"names":[],"mappings":";;AAAA,qCAAgC;AAEhC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,IAAA,aAAI,GAAE,CAAC;AAEhD,SAAS,GAAG,CAAC,IAAS;IAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,MAAM,CAAsB,IAAS,EAAE,OAAY;;IACxD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,YAAY,CAAC;IAClD,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,YAAY,CAAC;IACtD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACjD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAE1B,KAAK,MAAM,OAAO,IAAI,QAAQ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AQ,EAAE,KAAK,IAAI,EAAE;4BACjC,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;oCAC/B,MAAM,EAAE,QAAQ,EAAE,MAAM;iCAC3B,CAAC,CAAC,CAAC;wBACR,CAAC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAA;QACN,CAAC;QACD,KAAK,MAAM,YAAY,IAAI,kBAAkB,CAAC,2BAA2B,EAAE,CAAC;YACxE,IAAI,CAAC,QAAQ,CAAC,KAAK;gBACf,MAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/playwright-runner-adapter",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "adapter for playwright test runner",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -37,8 +37,11 @@ for (const feature of features) {
37
37
  const result: { status: string, error?: any } = { status: 'passed' };
38
38
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
39
39
  if (beforeHook.appliesToTestCase(testCase)) {
40
- await test.step('Before', async () => {
41
- await beforeHook.code.apply(world, [testCase]);
40
+ const hookName = beforeHook.name ?? 'Before';
41
+ await test.step(hookName, async () => {
42
+ await beforeHook.code.apply(world, [{
43
+ pickle: testCase
44
+ }]);
42
45
  });
43
46
  }
44
47
  }
@@ -46,7 +49,10 @@ for (const feature of features) {
46
49
  await test.step(pickleStep.text, async () => {
47
50
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
48
51
  if (beforeStep.appliesToTestCase(testCase)) {
49
- await beforeStep.code.apply(world, [testCase]);
52
+ await beforeStep.code.apply(world, [{
53
+ pickle: testCase,
54
+ pickleStep
55
+ }]);
50
56
  }
51
57
  }
52
58
  const steps = supportCodeLibrary.stepDefinitions
@@ -69,7 +75,11 @@ for (const feature of features) {
69
75
  }
70
76
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
71
77
  if (afterStep.appliesToTestCase(testCase)) {
72
- await afterStep.code.apply(world, [{...testCase, result}]);
78
+ await afterStep.code.apply(world, [{
79
+ pickle: testCase,
80
+ pickleStep,
81
+ result
82
+ }]);
73
83
  }
74
84
  }
75
85
  if (result.error) throw result.error;
@@ -77,8 +87,11 @@ for (const feature of features) {
77
87
  }
78
88
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
79
89
  if (afterHook.appliesToTestCase(testCase)) {
80
- await test.step('After', async () => {
81
- await afterHook.code.apply(world, [{...testCase, result}]);
90
+ const hookName = afterHook.name ?? 'After';
91
+ await test.step(hookName, async () => {
92
+ await afterHook.code.apply(world, [{
93
+ pickle: testCase, result
94
+ }]);
82
95
  });
83
96
  }
84
97
  }