@uuv/cypress 1.7.3 → 1.8.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
@@ -1,3 +1,24 @@
1
+ ## [1.8.1](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.8.0...runner-cypress-v1.8.1) (2023-08-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **intellij-plugin:** manage result.test null case, closes [#228](https://github.com/Orange-OpenSource/uuv/issues/228) ([996982f](https://github.com/Orange-OpenSource/uuv/commit/996982fbc37016012fdff00bef24aad0ab69c8a0))
7
+
8
+ # [1.8.0](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.7.3...runner-cypress-v1.8.0) (2023-08-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * prototype pollution in lodash - cve-2019-10744, [#219](https://github.com/Orange-OpenSource/uuv/issues/219) ([4b16741](https://github.com/Orange-OpenSource/uuv/commit/4b16741d53f814958ad0ee6d761e82d92374e5e8))
14
+
15
+
16
+ ### Features
17
+
18
+ * **runner-cypress:** add locationHint for testLocation via teamcity, [#195](https://github.com/Orange-OpenSource/uuv/issues/195) ([9bb51c6](https://github.com/Orange-OpenSource/uuv/commit/9bb51c6be8984b004d89fac32668ae5cb2e43edb))
19
+ * **runner-cypress:** add targetTestFile to run specific file, [#195](https://github.com/Orange-OpenSource/uuv/issues/195) ([daa2c4c](https://github.com/Orange-OpenSource/uuv/commit/daa2c4c9fe503e345455fcab352cee2f939b0fc9))
20
+ * **runner-cypress:** add teamcity trace for IntelliJ Plugin, [#195](https://github.com/Orange-OpenSource/uuv/issues/195) ([2a134c0](https://github.com/Orange-OpenSource/uuv/commit/2a134c0c67a01fd18ec3a142a2c42738eac86732))
21
+
1
22
  ## [1.7.3](https://github.com/Orange-OpenSource/uuv/compare/runner-cypress-v1.7.2...runner-cypress-v1.7.3) (2023-08-21)
2
23
 
3
24
 
@@ -63,6 +63,54 @@ async function setupNodeEvents(on, config) {
63
63
  },
64
64
  },
65
65
  }));
66
+ on("before:run", () => {
67
+ logTeamCity("##teamcity[progressStart 'Running UUV Tests']");
68
+ });
69
+ on("after:run", () => {
70
+ logTeamCity("##teamcity[progressFinish 'Running UUV Tests']");
71
+ });
72
+ on("before:spec", (spec) => {
73
+ logTeamCity(`##teamcity[testSuiteStarted ${teamcityAddName(spec.baseName)} ${teamcityFlowId(spec.baseName)} ${teamcityAddCustomField("locationHint", "test://" + spec.absolute)} ]`);
74
+ });
75
+ on("after:spec", (spec, results) => {
76
+ results?.tests?.forEach(test => {
77
+ logTeamCity(`##teamcity[testStarted ${teamcityAddName(test.title[1])} ${teamcityFlowIdAndParentFlowId(test.title[1], spec.baseName)} ${teamcityAddCustomField("locationHint", "test://" + spec.absolute)} ]`);
78
+ if (test.state === "passed") {
79
+ // eslint-disable-next-line max-len
80
+ logTeamCity(`##teamcity[testFinished ${teamcityAddName(test.title[1])} ${teamcityFlowIdAndParentFlowId(test.title[1], spec.baseName)} ${teamcityAddDuration(test)} ]`);
81
+ }
82
+ else if (test.state === "failed") {
83
+ // eslint-disable-next-line max-len
84
+ logTeamCity(`##teamcity[testFailed ${teamcityAddName(test.title[1])} ${teamcityFlowIdAndParentFlowId(test.title[1], spec.baseName)} type='comparisonFailure' message='Test failed' ]`);
85
+ // eslint-disable-next-line max-len
86
+ logTeamCity(`##teamcity[testFinished ${teamcityAddName(test.title[1])} ${teamcityFlowIdAndParentFlowId(test.title[1], spec.baseName)} ${teamcityAddDuration(test)} ]`);
87
+ }
88
+ else {
89
+ logTeamCity(`##teamcity[testIgnored ${teamcityAddName(test.title[1])} ${teamcityFlowIdAndParentFlowId(test.title[1], spec.baseName)} ]`);
90
+ }
91
+ });
92
+ logTeamCity(`##teamcity[testSuiteFinished ${teamcityAddName(spec.baseName)} ${teamcityFlowId(spec.baseName)}]`);
93
+ });
94
+ function logTeamCity(line) {
95
+ if (config.env["enableTeamcityLogging"]) {
96
+ console.log(line);
97
+ }
98
+ }
99
+ function teamcityFlowId(name) {
100
+ return "flowId='" + name.replaceAll("'", "|'") + "'";
101
+ }
102
+ function teamcityFlowIdAndParentFlowId(name, parentName) {
103
+ return "flowId='" + name.replaceAll("'", "|'") + "' parent='" + parentName.replaceAll("'", "|'") + "'";
104
+ }
105
+ function teamcityAddName(name) {
106
+ return "name='" + name.replaceAll("'", "|'") + "'";
107
+ }
108
+ function teamcityAddDuration(testResult) {
109
+ return "duration='" + testResult.attempts[testResult.attempts.length - 1].wallClockDuration + "'";
110
+ }
111
+ function teamcityAddCustomField(fieldName, value) {
112
+ return `${fieldName}='${value}'`;
113
+ }
66
114
  // Make sure to return the config object as it might have been modified by the plugin.
67
115
  return config;
68
116
  }
@@ -50,10 +50,14 @@ async function main() {
50
50
  function extractArgs(argv) {
51
51
  const browser = argv.browser ? argv.browser : "chrome";
52
52
  const env = argv.env ? JSON.parse(argv.env.replace(/'/g, "\"")) : {};
53
+ const targetTestFile = argv.targetTestFile ? argv.targetTestFile : null;
53
54
  console.debug("Variables: ");
54
55
  console.debug(` -> browser: ${browser}`);
55
56
  console.debug(` -> env: ${JSON.stringify(env)}`);
56
- return { browser, env };
57
+ if (targetTestFile) {
58
+ console.debug(` -> targetTestFile: ${targetTestFile}`);
59
+ }
60
+ return { browser, env, targetTestFile };
57
61
  }
58
62
  function openCypress(argv) {
59
63
  const { env } = extractArgs(argv);
@@ -63,14 +67,18 @@ async function main() {
63
67
  });
64
68
  }
65
69
  function runE2ETests(argv) {
66
- const { browser, env } = extractArgs(argv);
67
- // Running Tests
68
- return cypress_1.default
69
- .run({
70
+ const { browser, env, targetTestFile } = extractArgs(argv);
71
+ const options = {
70
72
  project: PROJECT_DIR,
71
73
  browser,
72
- env,
73
- })
74
+ env
75
+ };
76
+ if (targetTestFile) {
77
+ options.spec = targetTestFile;
78
+ }
79
+ // Running Tests
80
+ return cypress_1.default
81
+ .run(options)
74
82
  .then(async (result) => {
75
83
  if (argv.generateHtmlReport) {
76
84
  console.info(chalk_1.default.blueBright("Generating Test Report..."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/cypress",
3
- "version": "1.7.3",
3
+ "version": "1.8.1",
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,7 +46,7 @@
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.2",
49
+ "@uuv/runner-commons": "1.6.4",
50
50
  "axe-core": "4.7.2",
51
51
  "chalk": "4.1.2",
52
52
  "cucumber-json-report-formatter": "0.1.4",