@qavajs/cypress-runner-adapter 1.9.0 → 1.9.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/adapter/index.js CHANGED
@@ -1,4 +1,5 @@
1
- const { ensureFileSync, writeFileSync, readFileSync } = require('fs-extra');
1
+ const { mkdirSync, writeFileSync, readFileSync } = require('node:fs');
2
+ const { dirname } = require('node:path');
2
3
  const { randomUUID } = require('node:crypto');
3
4
  const { AstBuilder, compile, GherkinClassicTokenMatcher, Parser } = require('@cucumber/gherkin');
4
5
  const webpackPreprocessor = require('@cypress/webpack-preprocessor')();
@@ -26,7 +27,7 @@ module.exports = async function cucumber(file) {
26
27
  const tagExpression = tagExpressionParser(process.env.TAGS || '');
27
28
  const testCases = compile(gherkinDocument, filePath, uuidFn)
28
29
  .filter(test => tagExpression.evaluate(test.tags.map(tag => tag.name)));
29
- ensureFileSync(outputPath);
30
+ mkdirSync(dirname(outputPath), { recursive: true });
30
31
  writeFileSync(outputPath, adapter(testCases), 'utf-8');
31
32
  return outputPath;
32
33
  }
@@ -155,7 +155,7 @@ module.exports = function makeMochaTest(tests) {
155
155
  it('Scenario: ' + test.name, function () {
156
156
  const world = this.world;
157
157
  for (const step of test.steps) {
158
- runStep({ keyword: keyword(step), name: stepNameText(step) }, function () {
158
+ runStep({ keyword: keyword(step), name: stepNameText(step) }, () => {
159
159
  this.step = step;
160
160
  const result = { status: 'passed', duration: 0 };
161
161
  for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
package/adapter.d.ts CHANGED
@@ -1 +1 @@
1
- export default function (file: any): void;
1
+ export default function (file: any): Promise<any>;
package/index.d.ts CHANGED
@@ -35,5 +35,6 @@ export class World {
35
35
  log: (...args: any) => void;
36
36
  attach: (...args: any) => void;
37
37
  link: (...args: any) => void;
38
+ executeStep: (...args: any) => Promise<any>;
38
39
  });
39
40
  }
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@qavajs/cypress-runner-adapter",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "main": "index.js",
5
+ "files": [
6
+ "adapter",
7
+ "supportCodeLibrary",
8
+ "index.js",
9
+ "index.d.ts",
10
+ "adapter.js",
11
+ "adapter.d.ts"
12
+ ],
5
13
  "scripts": {
6
14
  "debug": "cypress open --config-file test/cypress.config.js",
7
15
  "test": "cypress run --config-file test/cypress.config.js",
@@ -25,11 +33,10 @@
25
33
  "@cucumber/cucumber-expressions": "^19.0.0",
26
34
  "@cucumber/gherkin": "^39.0.0",
27
35
  "@cucumber/tag-expressions": "^9.1.0",
28
- "@cypress/webpack-preprocessor": "^7.0.2",
29
- "fs-extra": "^11.3.4"
36
+ "@cypress/webpack-preprocessor": "^7.0.2"
30
37
  },
31
38
  "devDependencies": {
32
- "cypress": "^15.11.0",
39
+ "cypress": "^15.12.0",
33
40
  "mochawesome": "^7.1.4"
34
41
  },
35
42
  "keywords": [
@@ -42,4 +49,4 @@
42
49
  "test",
43
50
  "test-automation"
44
51
  ]
45
- }
52
+ }
@@ -47,6 +47,6 @@ export default class DataTable {
47
47
  const transposed = this.rawTable[0].map((x, i) =>
48
48
  this.rawTable.map((y) => y[i])
49
49
  )
50
- return new Data_table(transposed)
50
+ return new DataTable(transposed)
51
51
  }
52
52
  }
@@ -52,8 +52,7 @@ export function Given(pattern, code) {
52
52
  }
53
53
 
54
54
  export function Before(optionsOrCode, code) {
55
- const defaultOptions = { name: 'Before' };
56
- const options = code ? Object.assign(defaultOptions, optionsOrCode) : defaultOptions;
55
+ const options = code ? Object.assign({ name: 'Before' }, optionsOrCode) : { name: 'Before' };
57
56
  const handler = code ?? optionsOrCode;
58
57
  supportCodeLibrary.beforeTestCaseHookDefinitions.push(new TestCaseHookDefinition({
59
58
  code: handler,
@@ -62,8 +61,7 @@ export function Before(optionsOrCode, code) {
62
61
  }
63
62
 
64
63
  export function After(optionsOrCode, code) {
65
- const defaultOptions = { name: 'After' };
66
- const options = code ? Object.assign(defaultOptions, optionsOrCode) : defaultOptions;
64
+ const options = code ? Object.assign({ name: 'After' }, optionsOrCode) : { name: 'After' };
67
65
  const handler = code ?? optionsOrCode;
68
66
  supportCodeLibrary.afterTestCaseHookDefinitions.push(new TestCaseHookDefinition({
69
67
  code: handler,
package/CHANGELOG.md DELETED
@@ -1,82 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to the "@qavajs/cypress-runner-adapter" will be documented in this file.
4
-
5
- Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6
-
7
- :rocket: - new feature
8
-
9
- :beetle: - bugfix
10
-
11
- :x: - deprecation/removal
12
-
13
- :pencil: - chore
14
-
15
- :microscope: - experimental
16
-
17
- ## [1.9.0]
18
- - :rocket: added step log groups for `it` mode
19
-
20
- ## [1.8.0]
21
- - :rocket: added `testCaseStartedId` and `testStepId` as hooks parameters to comply cucumber spec
22
-
23
- ## [1.7.0]
24
- - :rocket: updated @cucumber/cucumber-expressions, @cucumber/gherkin, @cucumber/tag-expressions
25
-
26
- ## [1.6.0]
27
- - :rocket: updated logs for Gherkin steps
28
- - :rocket: improved multi line and data table step logging
29
-
30
- ## [1.5.0]
31
- - :rocket: added `world.log` method
32
- - :rocket: updated test.body to render corresponding step code
33
-
34
- ## [1.4.2]
35
- - :pencil: updated to cypress 15.7.0
36
- - :pencil: updated to gherkin to 37.0.0
37
-
38
- ## [1.4.1]
39
- - :beetle: fixed `result` property in `After` and `AfterStep` hooks
40
- - :rocket: added workaround to complete `AfterStep` hook in case of step fail
41
-
42
- ## [1.4.0]
43
- - :rocket: added `Template` utility function
44
- ```typescript
45
- import { When, Template } from '@qavajs/playwright-runner-adapter';
46
-
47
- When('I click {string} and verify {string}', Template((locator, expected) => `
48
- I click '${locator}'
49
- I expect '${locator} > Value' to equal '${expected}'
50
- `));
51
- ```
52
-
53
- ## [1.3.0]
54
- - :rocket: added tags support
55
- - :rocket: added alternative 'it mode' to translate gherkin tests to mocha `it` instead of `describe`
56
- ```bash
57
- MODE=it npx cypress open
58
- ```
59
-
60
- ## [1.2.1]
61
- - :pencil: updated to cypress 15.3
62
-
63
- ## [1.2.0]
64
- - :pencil: updated to cypress 15
65
-
66
- ## [1.1.0]
67
- - :pencil: updated to cypress 14
68
-
69
- ## [1.0.1]
70
- - :pencil: updated dependencies
71
-
72
- ## [1.0.0]
73
- - :rocket: added `this.executeStep` world method
74
-
75
- ## [0.2.0]
76
- - :rocket: added _BeforeAll_ and _AfterAll_ hooks support
77
-
78
- ## [0.1.1]
79
- - :beetle: changed browserify to webpack
80
-
81
- ## [0.1.0]
82
- - :rocket: initial implementation