@qavajs/playwright-runner-adapter 0.4.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,13 @@ 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
+
16
+ ## [0.5.0]
17
+ - :rocket: updated gherkin dependency
18
+ - :rocket: added _expect_ to default world
19
+
13
20
  ## [0.4.0]
14
21
  - :rocket: added support of _requireModules_ option
15
22
  - :rocket: improved _defineCucumber_ function to encapsulate adapter path
package/README.md CHANGED
@@ -35,7 +35,7 @@ export default defineConfig({
35
35
  Custom test instance can be passed to world constructor as _test_ property.
36
36
  And then fixtures can be connected with world instance via _init_ property.
37
37
  ```typescript
38
- import { test as base } from '@playwright/test';
38
+ import { test as base, expect as baseExpect } from '@playwright/test';
39
39
  import { SettingsPage } from './settings-page';
40
40
  import { setWorldConstructor } from '@cucumber/cucumber';
41
41
  import { PlaywrightWorld } from '@qavajs/playwright-runner-adapter/PlaywrightWorld';
@@ -50,6 +50,12 @@ const customTest = base.extend<MyFixtures>({
50
50
  },
51
51
  });
52
52
 
53
+ const customExpect = baseExpect.extend({
54
+ async customMatcher() {
55
+ // implementation
56
+ }
57
+ });
58
+
53
59
  class ExtendedPlaywrightWorld extends PlaywrightWorld {
54
60
  settingsPage: SettingsPage;
55
61
  constructor(options: any) {
@@ -58,6 +64,7 @@ class ExtendedPlaywrightWorld extends PlaywrightWorld {
58
64
 
59
65
  // set test property with extened one
60
66
  test = customTest;
67
+ expect = customExpect;
61
68
 
62
69
  // init arrow function connects fixtures with Cucumber world instance
63
70
  init = ({ settingsPage }) => {
@@ -8,6 +8,7 @@ const test_1 = require("@playwright/test");
8
8
  class PlaywrightWorld {
9
9
  constructor(options) {
10
10
  this.test = test_1.test;
11
+ this.expect = test_1.expect;
11
12
  this.init = ({ browser, context, page }) => {
12
13
  this.browser = browser;
13
14
  this.context = context;
@@ -1 +1 @@
1
- {"version":3,"file":"PlaywrightWorld.js","sourceRoot":"","sources":["../src/PlaywrightWorld.ts"],"names":[],"mappings":";;;AAAA,2CAA0F;AAE1F;;GAEG;AACH,MAAa,eAAe;IAWxB,YAAY,OAAY;QAFxB,SAAI,GAAG,WAAI,CAAC;QAQZ,SAAI,GAAiC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAA6D,EAAE,EAAE;YAC3H,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC,CAAA;QATG,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACzC,CAAC;CAOJ;AAtBD,0CAsBC"}
1
+ {"version":3,"file":"PlaywrightWorld.js","sourceRoot":"","sources":["../src/PlaywrightWorld.ts"],"names":[],"mappings":";;;AAAA,2CAAkG;AAElG;;GAEG;AACH,MAAa,eAAe;IAYxB,YAAY,OAAY;QAHxB,SAAI,GAAG,WAAI,CAAC;QACZ,WAAM,GAAG,aAAM,CAAC;QAQhB,SAAI,GAAiC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAA6D,EAAE,EAAE;YAC3H,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC,CAAA;QATG,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACzC,CAAC;CAOJ;AAvBD,0CAuBC"}
@@ -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,IAAI,EAAE;QAChD,KAAK,MAAM,aAAa,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;YAC1E,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;gBACtB,MAAM,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACP,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,kBAAkB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AAG,GAAG,CAAC;wBACvB,CAAC;wBACD,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;4BACtE,IAAI,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;gCACxC,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,iCAAK,QAAQ,KAAE,MAAM,IAAE,CAAC,CAAC;4BAC/D,CAAC;wBACL,CAAC;wBACD,IAAI,MAAM,CAAC,KAAK;4BAAE,MAAM,MAAM,CAAC,KAAK,CAAC;oBACzC,CAAC,CAAC,CAAC;gBACP,CAAC;gBACD,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;oBACtE,IAAI,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACxC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;4BAChC,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,iCAAK,QAAQ,KAAE,MAAM,IAAE,CAAC,CAAC;wBAC/D,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.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "adapter for playwright test runner",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -10,13 +10,13 @@
10
10
  "author": "Alexandr Galichenko",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@cucumber/gherkin": "^28.0.0",
13
+ "@cucumber/gherkin": "^29.0.0",
14
14
  "glob": "^11.0.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@cucumber/cucumber": "^10.8.0",
18
- "@playwright/test": "^1.45.3",
19
- "@types/node": "^22.1.0",
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
  }
@@ -1,4 +1,4 @@
1
- import { APIRequestContext, Browser, BrowserContext, Page, test } from '@playwright/test';
1
+ import { APIRequestContext, Browser, BrowserContext, Page, test, expect } from '@playwright/test';
2
2
 
3
3
  /**
4
4
  * Cucumber world for playwright adapter
@@ -13,6 +13,7 @@ export class PlaywrightWorld {
13
13
  attach!: (data: any, details?: { fileName?: string, mediaType: string }) => void;
14
14
  parameters!: string;
15
15
  test = test;
16
+ expect = expect;
16
17
 
17
18
  constructor(options: any) {
18
19
  this.log = options.log;
@@ -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
  }