@qavajs/playwright-runner-adapter 1.6.0 → 1.7.1

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
@@ -14,6 +14,19 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
14
14
 
15
15
  :microscope: - experimental
16
16
 
17
+ ## [1.7.1]
18
+ - :beetle: fixed `result` property in `After` and `AfterStep` hooks
19
+
20
+ ## [1.7.0]
21
+ - :rocket: added `filter` grep utility function
22
+ ```typescript
23
+ import { filter } from '@qavajs/playwright-runner-adapter';
24
+ export default defineConfig({
25
+ grep: filter(name => name.includes('login test'))
26
+ });
27
+ ```
28
+ - :rocket: expose `uri` test annotation
29
+
17
30
  ## [1.6.0]
18
31
  - :rocket: added `Template` utility function
19
32
  ```typescript
package/README.md CHANGED
@@ -75,14 +75,23 @@ class ExtendedPlaywrightWorld extends PlaywrightWorld {
75
75
  }
76
76
  ```
77
77
 
78
- ### Tag expression
78
+ ### Tag expression and filter
79
79
  It is possible to use regular tag expressions via `tags` util function
80
80
 
81
81
  ```typescript
82
82
  import { tags } from '@qavajs/playwright-runner-adapter';
83
83
  export default defineConfig({
84
84
  grep: tags('@oneTag and @anotherTag')
85
- })
85
+ });
86
+ ```
87
+
88
+ or filter tests by predicate
89
+
90
+ ```typescript
91
+ import { filter } from '@qavajs/playwright-runner-adapter';
92
+ export default defineConfig({
93
+ grep: filter(name => name.includes('login test'))
94
+ });
86
95
  ```
87
96
 
88
97
  ## Limitation
@@ -2,6 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const loader_1 = require("./loader");
4
4
  const { features, supportCodeLibrary } = (0, loader_1.load)();
5
+ function getResult(testInfo) {
6
+ const message = testInfo.errors.length > 0
7
+ ? testInfo.errors.map((err) => err.message).join('\n')
8
+ : undefined;
9
+ return {
10
+ duration: testInfo.duration,
11
+ message,
12
+ status: testInfo.status,
13
+ exception: testInfo.error
14
+ };
15
+ }
16
+ function getLine(step) {
17
+ return { location: { column: 1, file: step.uri, line: step.line } };
18
+ }
5
19
  function log(data) {
6
20
  console.log(data);
7
21
  }
@@ -14,7 +28,7 @@ const fixture = new supportCodeLibrary.World({});
14
28
  const test = fixture.test;
15
29
  test.beforeAll(async () => {
16
30
  for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
17
- const location = { location: { column: 1, file: beforeAllHook.uri, line: beforeAllHook.line } };
31
+ const location = getLine(beforeAllHook);
18
32
  await test.step('Before All', () => beforeAllHook.code.apply({}), location);
19
33
  }
20
34
  });
@@ -37,7 +51,7 @@ for (const feature of features) {
37
51
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
38
52
  if (beforeHook.appliesToTestCase(testCase)) {
39
53
  const hookName = beforeHook.name ?? 'Before';
40
- const location = { location: { column: 1, file: beforeHook.uri, line: beforeHook.line } };
54
+ const location = getLine(beforeHook);
41
55
  await test.step(hookName, () => beforeHook.code.apply(world, [{
42
56
  pickle: testCase
43
57
  }]), location);
@@ -48,14 +62,14 @@ for (const feature of features) {
48
62
  const tag = [...new Set(testCase.tags.map((tag) => tag.name))];
49
63
  const annotation = [
50
64
  { type: 'name', description: testCase.name },
65
+ { type: 'uri', description: testCase.uri },
51
66
  { type: 'testId', description: testCase.id },
52
67
  { type: 'tags', description: JSON.stringify(tag) }
53
68
  ];
54
- test(testCase.name, { tag, annotation: annotation }, async () => {
55
- const testInfo = test.info();
56
- testInfo.result = { status: 'passed' };
69
+ test(testCase.name, { tag, annotation }, async () => {
70
+ const result = { status: 'passed' };
57
71
  for (const pickleStep of testCase.steps) {
58
- if (testInfo.result.error) {
72
+ if (result.status !== 'passed') {
59
73
  break;
60
74
  }
61
75
  const steps = supportCodeLibrary.stepDefinitions
@@ -65,11 +79,11 @@ for (const feature of features) {
65
79
  if (steps.length > 1)
66
80
  throw new Error(`Step '${pickleStep.text}' matches multiple step definitions`);
67
81
  const [step] = steps;
68
- const location = { location: { column: 1, file: step.uri, line: step.line } };
82
+ const location = getLine(step);
69
83
  await test.step(pickleStep.text, async () => {
70
84
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
71
85
  if (beforeStep.appliesToTestCase(testCase)) {
72
- const location = { location: { column: 1, file: beforeStep.uri, line: beforeStep.line } };
86
+ const location = getLine(beforeStep);
73
87
  await test.step('Before Step', () => beforeStep.code.apply(world, [{
74
88
  pickle: testCase,
75
89
  pickleStep
@@ -87,17 +101,23 @@ for (const feature of features) {
87
101
  await step.code.apply(world, parameters);
88
102
  }
89
103
  catch (err) {
90
- testInfo.result.error = err;
104
+ result.status = 'failed';
105
+ result.error = err;
91
106
  throw err;
92
107
  }
93
108
  finally {
94
109
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
95
110
  if (afterStep.appliesToTestCase(testCase)) {
96
- const location = { location: { column: 1, file: afterStep.uri, line: afterStep.line } };
111
+ const location = getLine(afterStep);
97
112
  await test.step('After Step', () => afterStep.code.apply(world, [{
98
113
  pickle: testCase,
99
114
  pickleStep,
100
- result: testInfo.result
115
+ result: {
116
+ duration: 0,
117
+ message: result.error?.message,
118
+ status: result.status,
119
+ exception: result.error
120
+ }
101
121
  }]), location);
102
122
  }
103
123
  }
@@ -116,10 +136,10 @@ for (const feature of features) {
116
136
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
117
137
  if (afterHook.appliesToTestCase(testCase)) {
118
138
  const hookName = afterHook.name ?? 'After';
119
- const location = { location: { column: 1, file: afterHook.uri, line: afterHook.line } };
139
+ const location = getLine(afterHook);
120
140
  await test.step(hookName, () => afterHook.code.apply(world, [{
121
141
  pickle: testCase,
122
- result: testInfo.result
142
+ result: getResult(testInfo)
123
143
  }]), location);
124
144
  }
125
145
  }
@@ -128,7 +148,7 @@ for (const feature of features) {
128
148
  }
129
149
  test.afterAll(async () => {
130
150
  for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
131
- const location = { location: { column: 1, file: afterAllHook.uri, line: afterAllHook.line } };
151
+ const location = getLine(afterAllHook);
132
152
  await test.step('After All', () => afterAllHook.code.apply({}), location);
133
153
  }
134
154
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cucumber.spec.js","sourceRoot":"","sources":["../src/cucumber.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,OAAO,EAAE,QAAQ,IAAI,YAAY,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,EAAE,SAAS,IAAI,YAAY,CAAC;IACvD,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,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;IACtB,KAAK,MAAM,aAAa,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;QAC1E,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,EAAC,CAAA;QAC9F,MAAM,IAAI,CAAC,IAAI,CACX,YAAY,EACZ,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAClC,QAAQ,CACX,CAAA;IACL,CAAC;AACL,C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,EAAE,CAAC;oBACxC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,IAAI,OAAO,CAAC;oBAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;oBACpC,MAAM,IAAI,CAAC,IAAI,CACX,QAAQ,EACR,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;4BAC/B,MAAM,EAAE,QAAQ;4BAChB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC;yBAC9B,CAAC,CAAC,EACH,QAAQ,CACX,CAAC;gBACN,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AACP,CAAC;AAED,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;IACrB,KAAK,MAAM,YAAY,IAAI,kBAAkB,CAAC,2BAA2B,EAAE,CAAC;QACxE,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,IAAI,CACX,WAAW,EACX,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EACjC,QAAQ,CACX,CAAA;IACL,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Translate cucumber tag expression to playwright grep
3
+ * @param {string} tagExpression
4
+ * @example
5
+ * import { tags } from '@qavajs/playwright-runner-adapter';
6
+ * export default defineConfig({
7
+ * grep: tags('@oneTag and @anotherTag')
8
+ * });
9
+ */
10
+ export declare function tags(tagExpression: string): RegExp;
11
+ /**
12
+ * Filter test cases by name
13
+ * @param {(testName: string) => boolean} predicate
14
+ * import { filter } from '@qavajs/playwright-runner-adapter';
15
+ * export default defineConfig({
16
+ * grep: filter(name => name.includes('login test'))
17
+ * });
18
+ */
19
+ export declare function filter(predicate: (testName: string) => boolean): RegExp;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.tags = tags;
7
+ exports.filter = filter;
7
8
  const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
8
9
  class TagExpression extends RegExp {
9
10
  tagExpression;
@@ -25,9 +26,31 @@ class TagExpression extends RegExp {
25
26
  * import { tags } from '@qavajs/playwright-runner-adapter';
26
27
  * export default defineConfig({
27
28
  * grep: tags('@oneTag and @anotherTag')
28
- * })
29
+ * });
29
30
  */
30
31
  function tags(tagExpression) {
31
32
  return new TagExpression(tagExpression);
32
33
  }
33
- //# sourceMappingURL=tags.js.map
34
+ class Filter extends RegExp {
35
+ predicate;
36
+ constructor(predicate) {
37
+ super('');
38
+ this.predicate = predicate;
39
+ this.predicate = predicate;
40
+ }
41
+ test(testName) {
42
+ return this.predicate(testName);
43
+ }
44
+ }
45
+ /**
46
+ * Filter test cases by name
47
+ * @param {(testName: string) => boolean} predicate
48
+ * import { filter } from '@qavajs/playwright-runner-adapter';
49
+ * export default defineConfig({
50
+ * grep: filter(name => name.includes('login test'))
51
+ * });
52
+ */
53
+ function filter(predicate) {
54
+ return new Filter(predicate);
55
+ }
56
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":";;;;;AA2BA,oBAEC;AAqBD,wBAEC;AApDD,gFAA8C;AAE9C,MAAM,aAAc,SAAQ,MAAM;IAKV;IAJZ,cAAc,CAEpB;IAEF,YAAoB,aAAqB;QACrC,KAAK,CAAC,EAAE,CAAC,CAAC;QADM,kBAAa,GAAb,aAAa,CAAQ;QAErC,IAAI,CAAC,cAAc,GAAG,IAAA,yBAAK,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ;AAED;;;;;;;;GAQG;AACH,SAAgB,IAAI,CAAC,aAAqB;IACtC,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,MAAO,SAAQ,MAAM;IACH;IAApB,YAAoB,SAAwC;QACxD,KAAK,CAAC,EAAE,CAAC,CAAC;QADM,cAAS,GAAT,SAAS,CAA+B;QAExD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,SAAgB,MAAM,CAAC,SAAwC;IAC3D,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export * from './PlaywrightWorld';
2
2
  export * from './defineCucumber';
3
- export * from './tags';
3
+ export * from './filter';
4
4
  export * from './Template';
5
5
  export * from '@cucumber/cucumber';
package/adapter/index.js CHANGED
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./PlaywrightWorld"), exports);
18
18
  __exportStar(require("./defineCucumber"), exports);
19
- __exportStar(require("./tags"), exports);
19
+ __exportStar(require("./filter"), exports);
20
20
  __exportStar(require("./Template"), exports);
21
21
  __exportStar(require("@cucumber/cucumber"), exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,yCAAuB;AACvB,6CAA2B;AAC3B,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,2CAAyB;AACzB,6CAA2B;AAC3B,qDAAmC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qavajs/playwright-runner-adapter",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "adapter for playwright test runner",
5
5
  "main": "adapter/index.js",
6
6
  "types": "adapter/index.d.ts",
@@ -19,14 +19,39 @@
19
19
  "url": "https://github.com/qavajs/playwright-runner-adapter/issues"
20
20
  },
21
21
  "dependencies": {
22
- "@cucumber/gherkin": "^35.1.0",
23
- "@cucumber/tag-expressions": "^6.2.0",
22
+ "@cucumber/gherkin": "^36.0.0",
23
+ "@cucumber/tag-expressions": "^8.0.0",
24
24
  "glob": "^11.0.3",
25
25
  "@cucumber/cucumber": "^12.2.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@playwright/test": "^1.55.1",
29
- "@types/node": "^24.6.2",
28
+ "@playwright/test": "^1.56.1",
29
+ "@types/node": "^24.9.1",
30
30
  "typescript": "^5.9.3"
31
- }
31
+ },
32
+ "keywords": [
33
+ "test",
34
+ "automation",
35
+ "testing",
36
+ "qa",
37
+ "quality-assurance",
38
+ "test-framework",
39
+ "test-runner",
40
+ "test-automation",
41
+ "e2e",
42
+ "end-to-end",
43
+ "ui-testing",
44
+ "integration-testing",
45
+ "acceptance-testing",
46
+ "functional-testing",
47
+ "browser-testing",
48
+ "mobile-testing",
49
+ "cross-browser",
50
+ "bdd",
51
+ "gherkin",
52
+ "assertions",
53
+ "continuous-delivery",
54
+ "automation-framework",
55
+ "playwright"
56
+ ]
32
57
  }
@@ -1,7 +1,24 @@
1
1
  import { load } from './loader';
2
+ import type { TestInfo } from '@playwright/test';
2
3
 
3
4
  const { features, supportCodeLibrary } = load();
4
5
 
6
+ function getResult(testInfo: TestInfo) {
7
+ const message = testInfo.errors.length > 0
8
+ ? testInfo.errors.map((err: any) => err.message).join('\n')
9
+ : undefined;
10
+ return {
11
+ duration: testInfo.duration,
12
+ message,
13
+ status: testInfo.status,
14
+ exception: testInfo.error
15
+ };
16
+ }
17
+
18
+ function getLine(step: { uri: string, line: number }) {
19
+ return { location: { column: 1, file: step.uri, line: step.line }}
20
+ }
21
+
5
22
  function log(data: any) {
6
23
  console.log(data);
7
24
  }
@@ -17,7 +34,7 @@ const test = fixture.test;
17
34
 
18
35
  test.beforeAll(async () => {
19
36
  for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
20
- const location = { location: { column: 1, file: beforeAllHook.uri, line: beforeAllHook.line }}
37
+ const location = getLine(beforeAllHook);
21
38
  await test.step(
22
39
  'Before All',
23
40
  () => beforeAllHook.code.apply({}),
@@ -47,7 +64,7 @@ for (const feature of features) {
47
64
  for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
48
65
  if (beforeHook.appliesToTestCase(testCase)) {
49
66
  const hookName = beforeHook.name ?? 'Before';
50
- const location = { location: { column: 1, file: beforeHook.uri, line: beforeHook.line }}
67
+ const location = getLine(beforeHook);
51
68
  await test.step(
52
69
  hookName,
53
70
  () => beforeHook.code.apply(world, [{
@@ -63,14 +80,14 @@ for (const feature of features) {
63
80
  const tag = [...new Set(testCase.tags.map((tag: { name: string }) => tag.name))];
64
81
  const annotation = [
65
82
  { type: 'name', description: testCase.name },
83
+ { type: 'uri', description: testCase.uri },
66
84
  { type: 'testId', description: testCase.id },
67
85
  { type: 'tags', description: JSON.stringify(tag) }
68
86
  ];
69
- test(testCase.name, { tag, annotation: annotation }, async () => {
70
- const testInfo = test.info();
71
- testInfo.result = { status: 'passed' };
87
+ test(testCase.name, { tag, annotation }, async () => {
88
+ const result: { status: string, error?: Error } = { status: 'passed' };
72
89
  for (const pickleStep of testCase.steps) {
73
- if (testInfo.result.error) {
90
+ if (result.status !== 'passed') {
74
91
  break;
75
92
  }
76
93
  const steps = supportCodeLibrary.stepDefinitions
@@ -78,11 +95,11 @@ for (const feature of features) {
78
95
  if (steps.length === 0) throw new Error(`Step '${pickleStep.text}' is not defined`);
79
96
  if (steps.length > 1) throw new Error(`Step '${pickleStep.text}' matches multiple step definitions`);
80
97
  const [ step ] = steps;
81
- const location = { location: { column: 1, file: step.uri, line: step.line }}
98
+ const location = getLine(step);
82
99
  await test.step(pickleStep.text, async () => {
83
100
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
84
101
  if (beforeStep.appliesToTestCase(testCase)) {
85
- const location = { location: { column: 1, file: beforeStep.uri, line: beforeStep.line }}
102
+ const location = getLine(beforeStep);
86
103
  await test.step(
87
104
  'Before Step',
88
105
  () => beforeStep.code.apply(world, [{
@@ -103,18 +120,24 @@ for (const feature of features) {
103
120
  try {
104
121
  await step.code.apply(world, parameters);
105
122
  } catch (err: any) {
106
- testInfo.result.error = err;
123
+ result.status = 'failed';
124
+ result.error = err;
107
125
  throw err;
108
126
  } finally {
109
127
  for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
110
128
  if (afterStep.appliesToTestCase(testCase)) {
111
- const location = { location: { column: 1, file: afterStep.uri, line: afterStep.line }}
129
+ const location = getLine(afterStep);
112
130
  await test.step(
113
131
  'After Step',
114
132
  () => afterStep.code.apply(world, [{
115
133
  pickle: testCase,
116
134
  pickleStep,
117
- result: testInfo.result
135
+ result: {
136
+ duration: 0,
137
+ message: result.error?.message,
138
+ status: result.status,
139
+ exception: result.error
140
+ }
118
141
  }]),
119
142
  location
120
143
  );
@@ -136,12 +159,12 @@ for (const feature of features) {
136
159
  for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
137
160
  if (afterHook.appliesToTestCase(testCase)) {
138
161
  const hookName = afterHook.name ?? 'After';
139
- const location = { location: { column: 1, file: afterHook.uri, line: afterHook.line }}
162
+ const location = getLine(afterHook);
140
163
  await test.step(
141
164
  hookName,
142
165
  () => afterHook.code.apply(world, [{
143
166
  pickle: testCase,
144
- result: testInfo.result
167
+ result: getResult(testInfo)
145
168
  }]),
146
169
  location
147
170
  );
@@ -154,7 +177,7 @@ for (const feature of features) {
154
177
 
155
178
  test.afterAll(async () => {
156
179
  for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
157
- const location = { location: { column: 1, file: afterAllHook.uri, line: afterAllHook.line }}
180
+ const location = getLine(afterAllHook);
158
181
  await test.step(
159
182
  'After All',
160
183
  () => afterAllHook.code.apply({}),
@@ -1,4 +1,4 @@
1
- import parse from '@cucumber/tag-expressions'
1
+ import parse from '@cucumber/tag-expressions';
2
2
 
3
3
  class TagExpression extends RegExp {
4
4
  private expressionNode: {
@@ -23,8 +23,31 @@ class TagExpression extends RegExp {
23
23
  * import { tags } from '@qavajs/playwright-runner-adapter';
24
24
  * export default defineConfig({
25
25
  * grep: tags('@oneTag and @anotherTag')
26
- * })
26
+ * });
27
27
  */
28
28
  export function tags(tagExpression: string): RegExp {
29
29
  return new TagExpression(tagExpression);
30
30
  }
31
+
32
+ class Filter extends RegExp {
33
+ constructor(private predicate: (testName: string) => boolean) {
34
+ super('');
35
+ this.predicate = predicate;
36
+ }
37
+
38
+ test(testName: string) {
39
+ return this.predicate(testName);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Filter test cases by name
45
+ * @param {(testName: string) => boolean} predicate
46
+ * import { filter } from '@qavajs/playwright-runner-adapter';
47
+ * export default defineConfig({
48
+ * grep: filter(name => name.includes('login test'))
49
+ * });
50
+ */
51
+ export function filter(predicate: (testName: string) => boolean): RegExp {
52
+ return new Filter(predicate);
53
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './PlaywrightWorld';
2
2
  export * from './defineCucumber';
3
- export * from './tags';
3
+ export * from './filter';
4
4
  export * from './Template';
5
5
  export * from '@cucumber/cucumber';
package/adapter/tags.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Translate cucumber tag expression to playwright grep
3
- * @param {string} tagExpression
4
- * @example
5
- * import { tags } from '@qavajs/playwright-runner-adapter';
6
- * export default defineConfig({
7
- * grep: tags('@oneTag and @anotherTag')
8
- * })
9
- */
10
- export declare function tags(tagExpression: string): RegExp;
@@ -1 +0,0 @@
1
- {"version":3,"file":"tags.js","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":";;;;;AA2BA,oBAEC;AA7BD,gFAA6C;AAE7C,MAAM,aAAc,SAAQ,MAAM;IAKV;IAJZ,cAAc,CAEpB;IAEF,YAAoB,aAAqB;QACrC,KAAK,CAAC,EAAE,CAAC,CAAC;QADM,kBAAa,GAAb,aAAa,CAAQ;QAErC,IAAI,CAAC,cAAc,GAAG,IAAA,yBAAK,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ;AAED;;;;;;;;GAQG;AACH,SAAgB,IAAI,CAAC,aAAqB;IACtC,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC"}