@uuv/cypress 1.7.1 → 1.7.3

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
@@ -1,3 +1,18 @@
1
+ ## [1.7.3](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.7.2...runner-cypress-v1.7.3) (2023-08-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **runner-playwright:** use exact match while calling getByLabel, closes [#205](https://github.com/Orange-OpenSource/uuv/issues/205) ([d499b41](https://github.com/Orange-OpenSource/uuv/commit/d499b4138c01d072c251822e42a3d1b16b3cd7bb))
7
+
8
+ ## [1.7.2](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.7.1...runner-cypress-v1.7.2) (2023-08-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * accept cucumber Rule keyword when generate json from ndjson for … ([#207](https://github.com/Orange-OpenSource/uuv/issues/207)) ([05bc903](https://github.com/Orange-OpenSource/uuv/commit/05bc90342ea2f7149109b5a12e428b04237bf00b))
14
+ * **runner-cypress:** relocate cypress-real-events dependency into project package.json, [#213](https://github.com/Orange-OpenSource/uuv/issues/213) ([ffca8dd](https://github.com/Orange-OpenSource/uuv/commit/ffca8dd21d3858d0020f6bf1974437bbf38fe6c4))
15
+
1
16
  ## [1.7.1](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.7.0...runner-cypress-v1.7.1) (2023-08-09)
2
17
 
3
18
 
@@ -0,0 +1,6 @@
1
+ import { Formatter } from "cucumber-json-report-formatter";
2
+ export declare class UuvCustomFormatter extends Formatter {
3
+ constructor();
4
+ parseCucumberJson(sourceFile: any, outputFile: any): Promise<void>;
5
+ private buildAndAddScenario;
6
+ }
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UuvCustomFormatter = void 0;
4
+ const cucumber_json_report_formatter_1 = require("cucumber-json-report-formatter");
5
+ // FIXME remove this class when the PR https://github.com/vrymar/cucumber-json-report-formatter/pull/20 will be merged
6
+ class UuvCustomFormatter extends cucumber_json_report_formatter_1.Formatter {
7
+ constructor() {
8
+ super();
9
+ }
10
+ async parseCucumberJson(sourceFile, outputFile) {
11
+ console.info(`Start formatting file '${sourceFile}' into '${outputFile}'`);
12
+ const report = await this.helper.readFileIntoJson(sourceFile);
13
+ const gherkinDocumentJson = this.helper.getJsonFromArray(report, "gherkinDocument");
14
+ const cucumberReport = [];
15
+ gherkinDocumentJson.forEach(gherkinJson => {
16
+ let gherkinDocument;
17
+ try {
18
+ gherkinDocument = JSON.parse(gherkinJson).gherkinDocument;
19
+ }
20
+ catch (err) {
21
+ console.error("Error parsing JSON string.", err);
22
+ }
23
+ const feature = gherkinDocument.feature;
24
+ const featureChildren = feature.children;
25
+ const scenariosJson = [];
26
+ const background = {};
27
+ featureChildren.forEach(featureChild => {
28
+ if (featureChild.rule) {
29
+ featureChild.rule.steps = [];
30
+ featureChild.rule.children.forEach(ruleChildren => {
31
+ this.buildAndAddScenario(ruleChildren, report, background, feature, scenariosJson, featureChild.rule);
32
+ });
33
+ }
34
+ else {
35
+ this.buildAndAddScenario(featureChild, report, background, feature, scenariosJson, undefined);
36
+ }
37
+ });
38
+ const rootJson = {
39
+ comments: this.getComments(gherkinDocument.comments),
40
+ description: gherkinDocument.feature.description,
41
+ elements: scenariosJson,
42
+ id: feature.name,
43
+ keyword: feature.keyword,
44
+ line: feature.location.line,
45
+ name: feature.name,
46
+ uri: gherkinDocument.uri,
47
+ tags: this.getTags(gherkinDocument.feature.tags)
48
+ };
49
+ cucumberReport.push(rootJson);
50
+ });
51
+ await this.validateReportSchema(report);
52
+ const reportString = JSON.stringify(cucumberReport);
53
+ console.info(`Finished formatting file '${sourceFile}'`);
54
+ this.helper.writeFile(outputFile, reportString);
55
+ }
56
+ buildAndAddScenario(child, report, background, feature, scenariosJson, rule) {
57
+ let steps = [];
58
+ let stepJson = {};
59
+ // Background
60
+ if (child.scenario === undefined) {
61
+ child.background.steps.forEach(step => {
62
+ stepJson = this.createStepJson(step, report, 0);
63
+ steps.push(stepJson);
64
+ });
65
+ background = this.createScenarioJson(feature, child.background, steps, "background");
66
+ // eslint-disable-next-line brace-style
67
+ }
68
+ // Normal Scenario
69
+ else if (!child.scenario.keyword.includes("Outline")) {
70
+ child.scenario.steps.forEach(step => {
71
+ stepJson = this.createStepJson(step, report, 0);
72
+ steps.push(stepJson);
73
+ });
74
+ const scenario = this.createScenarioJson(feature, child.scenario, steps, "scenario");
75
+ if (rule) {
76
+ scenario.id = `${feature.name};${rule.name};${scenario.name}`;
77
+ }
78
+ if (Object.keys(background).length !== 0 && background !== undefined) {
79
+ scenariosJson.push(background);
80
+ }
81
+ scenariosJson.push(scenario);
82
+ } /* Scenario Outline */
83
+ else if (child.scenario.examples[0].tableBody !== undefined) {
84
+ const numberOfExecutions = child.scenario.examples[0].tableBody.length;
85
+ const numberOfStepsEachExecution = child.scenario.steps.length;
86
+ let scenarioIndex = 0;
87
+ while (scenarioIndex < numberOfExecutions) {
88
+ let currentStep = 0;
89
+ steps = [];
90
+ while (currentStep < numberOfStepsEachExecution) {
91
+ stepJson = this.createStepJson(child.scenario.steps[currentStep], report, scenarioIndex);
92
+ currentStep++;
93
+ steps.push(stepJson);
94
+ }
95
+ const scenario = this.createScenarioJson(feature, child.scenario, steps, "scenario", scenarioIndex);
96
+ if (rule) {
97
+ scenario.id = `${feature.name};${rule.name};${scenario.name}`;
98
+ }
99
+ if (Object.keys(background).length !== 0 && background !== undefined) {
100
+ scenariosJson.push(background);
101
+ }
102
+ scenariosJson.push(scenario);
103
+ scenarioIndex++;
104
+ }
105
+ }
106
+ }
107
+ }
108
+ exports.UuvCustomFormatter = UuvCustomFormatter;
@@ -25,7 +25,7 @@ const figlet_1 = __importDefault(require("figlet"));
25
25
  const minimist_1 = __importDefault(require("minimist"));
26
26
  const fs_1 = __importDefault(require("fs"));
27
27
  const cypress_1 = __importDefault(require("cypress"));
28
- const cucumber_json_report_formatter_1 = require("cucumber-json-report-formatter");
28
+ const uuv_custom_formatter_1 = require("../cucumber/uuv-custom-formatter");
29
29
  async function main() {
30
30
  const JSON_REPORT_DIR = "./uuv/reports/e2e/json";
31
31
  const HTML_REPORT_DIR = "./uuv/reports/e2e/html";
@@ -94,12 +94,12 @@ async function main() {
94
94
  if (!fs_1.default.existsSync(JSON_REPORT_DIR)) {
95
95
  fs_1.default.mkdirSync(JSON_REPORT_DIR, { recursive: true });
96
96
  }
97
- const formatter = new cucumber_json_report_formatter_1.Formatter();
97
+ const formatter = new uuv_custom_formatter_1.UuvCustomFormatter();
98
98
  const outputFile = `${JSON_REPORT_DIR}/cucumber-report.json`;
99
99
  await formatter.parseCucumberJson(CUCUMBER_MESSAGES_FILE, outputFile);
100
100
  }
101
101
  function generateHtmlReportFromJson(browser, argv) {
102
- const UNKOWN_VALUE = "unknown";
102
+ const UNKNOWN_VALUE = "unknown";
103
103
  multiple_cucumber_html_reporter_1.default.generate({
104
104
  jsonDir: JSON_REPORT_DIR,
105
105
  reportPath: HTML_REPORT_DIR,
@@ -108,9 +108,9 @@ async function main() {
108
108
  name: browser,
109
109
  version: argv.browserVersion ? argv.browserVersion : "",
110
110
  },
111
- device: argv.device ? argv.device : UNKOWN_VALUE,
111
+ device: argv.device ? argv.device : UNKNOWN_VALUE,
112
112
  platform: {
113
- name: argv.platformName ? argv.platformName : UNKOWN_VALUE,
113
+ name: argv.platformName ? argv.platformName : UNKNOWN_VALUE,
114
114
  version: argv.platformVersion ? argv.platformVersion : "",
115
115
  },
116
116
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/cypress",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "type": "commonjs",
5
5
  "author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
6
6
  "description": "A solution to run E2E tests written in cucumber(BDD) with cypress.",
@@ -46,12 +46,13 @@
46
46
  "@badeball/cypress-cucumber-preprocessor": "16.0.3",
47
47
  "@cypress/webpack-preprocessor": "5.17.1",
48
48
  "@testing-library/cypress": "9.0.0",
49
- "@uuv/runner-commons": "1.6.1",
49
+ "@uuv/runner-commons": "1.6.2",
50
50
  "axe-core": "4.7.2",
51
51
  "chalk": "4.1.2",
52
52
  "cucumber-json-report-formatter": "0.1.4",
53
53
  "cypress": "12.17.3",
54
54
  "cypress-axe": "1.4.0",
55
+ "cypress-real-events": "^1.10.0",
55
56
  "figlet": "1.6.0",
56
57
  "is-admin": "2.1.1",
57
58
  "minimist": "1.2.8",