@qavajs/playwright-runner-adapter 0.5.0 → 0.6.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.6.0]
14
+ - :rocket: added test case accessor to BeforeStep/AfterStep hooks
15
+
13
16
  ## [0.5.0]
14
17
  - :rocket: updated gherkin dependency
15
18
  - :rocket: added _expect_ to default world
@@ -29,6 +29,7 @@ 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
+ const result = { status: 'passed' };
32
33
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
33
34
  if (beforeHook.appliesToTestCase(testCase)) {
34
35
  await test.step('Before', async () => {
@@ -40,7 +41,7 @@ for (const feature of features) {
40
41
  await test.step(pickleStep.text, async () => {
41
42
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
42
43
  if (beforeStep.appliesToTestCase(testCase)) {
43
- await beforeStep.code.apply(world);
44
+ await beforeStep.code.apply(world, [testCase]);
44
45
  }
45
46
  }
46
47
  const steps = supportCodeLibrary.stepDefinitions
@@ -51,14 +52,12 @@ for (const feature of features) {
51
52
  throw new Error(`'${pickleStep.text}' matches multiple step definitions`);
52
53
  const [step] = steps;
53
54
  const { parameters } = await step.getInvocationParameters({
54
- // @ts-ignore
55
55
  step: {
56
56
  text: pickleStep.text,
57
57
  argument: pickleStep.argument
58
58
  },
59
59
  world
60
60
  });
61
- const result = { status: 'passed' };
62
61
  try {
63
62
  await step.code.apply(world, parameters);
64
63
  }
@@ -68,7 +67,7 @@ for (const feature of features) {
68
67
  }
69
68
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
70
69
  if (afterStep.appliesToTestCase(testCase)) {
71
- await afterStep.code.apply(world, [{ result }]);
70
+ await afterStep.code.apply(world, [Object.assign(Object.assign({}, testCase), { result })]);
72
71
  }
73
72
  }
74
73
  if (result.error)
@@ -78,7 +77,7 @@ for (const feature of features) {
78
77
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
79
78
  if (afterHook.appliesToTestCase(testCase)) {
80
79
  await test.step('After', async () => {
81
- await afterHook.code.apply(world, [testCase]);
80
+ await afterHook.code.apply(world, [Object.assign(Object.assign({}, testCase), { result })]);
82
81
  });
83
82
  }
84
83
  }
@@ -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,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAiB,EAAE,KAAK,IAA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AAC;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.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "adapter for playwright test runner",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -14,9 +14,9 @@
14
14
  "glob": "^11.0.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@cucumber/cucumber": "^11.0.0",
18
- "@playwright/test": "^1.46.1",
19
- "@types/node": "^22.5.4",
20
- "typescript": "^5.5.4"
17
+ "@cucumber/cucumber": "^11.0.1",
18
+ "@playwright/test": "^1.48.1",
19
+ "@types/node": "^22.7.7",
20
+ "typescript": "^5.6.3"
21
21
  }
22
22
  }
@@ -34,6 +34,7 @@ for (const feature of features) {
34
34
  for (const testCase of tests) {
35
35
  const tag = testCase.tags.map((tag: { name: string }) => tag.name);
36
36
  test(testCase.name, { tag }, async () => {
37
+ const result: { status: string, error?: any } = { status: 'passed' };
37
38
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
38
39
  if (beforeHook.appliesToTestCase(testCase)) {
39
40
  await test.step('Before', async () => {
@@ -45,7 +46,7 @@ for (const feature of features) {
45
46
  await test.step(pickleStep.text, async () => {
46
47
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
47
48
  if (beforeStep.appliesToTestCase(testCase)) {
48
- await beforeStep.code.apply(world);
49
+ await beforeStep.code.apply(world, [testCase]);
49
50
  }
50
51
  }
51
52
  const steps = supportCodeLibrary.stepDefinitions
@@ -54,14 +55,12 @@ for (const feature of features) {
54
55
  if (steps.length > 1) throw new Error(`'${pickleStep.text}' matches multiple step definitions`);
55
56
  const [step] = steps;
56
57
  const { parameters} = await step.getInvocationParameters({
57
- // @ts-ignore
58
58
  step: {
59
59
  text: pickleStep.text,
60
60
  argument: pickleStep.argument
61
61
  },
62
62
  world
63
- });
64
- const result: { status: string, error?: any } = { status: 'passed' };
63
+ } as any);
65
64
  try {
66
65
  await step.code.apply(world, parameters);
67
66
  } catch (err) {
@@ -70,7 +69,7 @@ for (const feature of features) {
70
69
  }
71
70
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
72
71
  if (afterStep.appliesToTestCase(testCase)) {
73
- await afterStep.code.apply(world, [{result}]);
72
+ await afterStep.code.apply(world, [{...testCase, result}]);
74
73
  }
75
74
  }
76
75
  if (result.error) throw result.error;
@@ -79,7 +78,7 @@ for (const feature of features) {
79
78
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
80
79
  if (afterHook.appliesToTestCase(testCase)) {
81
80
  await test.step('After', async () => {
82
- await afterHook.code.apply(world, [testCase]);
81
+ await afterHook.code.apply(world, [{...testCase, result}]);
83
82
  });
84
83
  }
85
84
  }