@uuv/runner-commons 1.6.5 → 1.7.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
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.7.0](https://github.com/Orange-OpenSource/uuv/compare/runner-commons-v1.6.5...runner-commons-v1.7.0) (2023-09-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency cypress to v12.17.4 ([998b754](https://github.com/Orange-OpenSource/uuv/commit/998b754038941de8b035abbd47800d45b1dac022))
|
|
7
|
+
* **deps:** update dependency cypress-real-events to v1.10.1 ([f60978d](https://github.com/Orange-OpenSource/uuv/commit/f60978da4bdd76483bcb2479324ccbbf3b36d87b))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add sentences to click on element and reset context, [#250](https://github.com/Orange-OpenSource/uuv/issues/250) ([347e327](https://github.com/Orange-OpenSource/uuv/commit/347e327bdfc5c6befc3a58a2c880bea3b0c8400c))
|
|
13
|
+
* **docs:** add autocompletion searchfield to steps definition page, [#255](https://github.com/Orange-OpenSource/uuv/issues/255) ([a0323ee](https://github.com/Orange-OpenSource/uuv/commit/a0323eec01a6351f9b60399398d145cb2bc86779))
|
|
14
|
+
|
|
1
15
|
## [1.6.5](https://github.com/Orange-OpenSource/uuv/compare/runner-commons-v1.6.4...runner-commons-v1.6.5) (2023-08-31)
|
|
2
16
|
|
|
3
17
|
## [1.6.4](https://github.com/Orange-OpenSource/uuv/compare/runner-commons-v1.6.3...runner-commons-v1.6.4) (2023-08-25)
|
|
@@ -12,4 +12,8 @@
|
|
|
12
12
|
* Software description: Make test writing fast, understandable by any human
|
|
13
13
|
* understanding English or French.
|
|
14
14
|
*/
|
|
15
|
+
export declare class AutocompletionSuggestion {
|
|
16
|
+
suggestion: string;
|
|
17
|
+
link: string;
|
|
18
|
+
}
|
|
15
19
|
export declare function runGenerateDoc(destDir: string): void;
|
|
@@ -13,21 +13,43 @@
|
|
|
13
13
|
* Software description: Make test writing fast, understandable by any human
|
|
14
14
|
* understanding English or French.
|
|
15
15
|
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
16
39
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
41
|
};
|
|
19
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.runGenerateDoc = void 0;
|
|
43
|
+
exports.runGenerateDoc = exports.AutocompletionSuggestion = void 0;
|
|
21
44
|
const lang_enum_1 = require("./lang-enum");
|
|
22
45
|
const fs_1 = __importDefault(require("fs"));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
46
|
+
const common_1 = require("./common");
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
class AutocompletionSuggestion {
|
|
49
|
+
suggestion;
|
|
50
|
+
link;
|
|
30
51
|
}
|
|
52
|
+
exports.AutocompletionSuggestion = AutocompletionSuggestion;
|
|
31
53
|
function runGenerateDoc(destDir) {
|
|
32
54
|
const GENERATED_DIR_DOC = `${destDir}/docs/03-wordings/01-generated-wording-description`;
|
|
33
55
|
const GENERATED_DIR_DOC_FR = `${destDir}/i18n/fr/docusaurus-plugin-content-docs/current/03-wordings/01-generated-wording-description`;
|
|
@@ -39,13 +61,23 @@ function runGenerateDoc(destDir) {
|
|
|
39
61
|
const generatedFile = `${GENERATED_DIR_DOC}/${indexOfFile}-${lang}-generated-wording-description.md`;
|
|
40
62
|
const wordingBaseFile = `${__dirname}/../assets/i18n/${lang}.json`;
|
|
41
63
|
const wordingEnrichedFile = `${__dirname}/../assets/i18n/${lang}-enriched-wordings.json`;
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
const autocompletionSuggestionFile = path.join(GENERATED_DIR_DOC, `${lang}-autocompletion-suggestion.json`);
|
|
65
|
+
cleanGeneratedFilesIfExists(generatedFile, lang, indexOfFile);
|
|
66
|
+
common_1.Common.cleanGeneratedFilesIfExists(autocompletionSuggestionFile);
|
|
67
|
+
generateWordingFiles(wordingBaseFile, wordingEnrichedFile, generatedFile, lang, indexOfFile, autocompletionSuggestionFile);
|
|
44
68
|
fs_1.default.copyFileSync(generatedFile, `${GENERATED_DIR_DOC_FR}/${indexOfFile}-${lang}-generated-wording-description.md`);
|
|
69
|
+
fs_1.default.copyFileSync(autocompletionSuggestionFile, path.join(GENERATED_DIR_DOC_FR, `${lang}-autocompletion-suggestion.json`));
|
|
45
70
|
});
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
71
|
+
function cleanGeneratedFilesIfExists(generatedFile, lang, indexOfFile) {
|
|
72
|
+
if (fs_1.default.existsSync(generatedFile)) {
|
|
73
|
+
fs_1.default.rmSync(generatedFile);
|
|
74
|
+
console.log(`[DEL] ${indexOfFile}-${lang}-generated-wording-description.md deleted successfully`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function generateWordingFiles(wordingBaseFile, wordingEnrichedFile, generatedFile, lang, indexOfFile, autocompletionSuggestionFile) {
|
|
78
|
+
const { wordingFileContent, autocompletionSuggestionContent } = computeWordingFile(wordingBaseFile, wordingEnrichedFile, lang);
|
|
79
|
+
writeWordingFile(generatedFile, wordingFileContent, lang, indexOfFile);
|
|
80
|
+
common_1.Common.writeWordingFile(autocompletionSuggestionFile, autocompletionSuggestionContent);
|
|
49
81
|
}
|
|
50
82
|
function computeWordingFile(wordingBaseFile, wordingEnrichedFile, lang) {
|
|
51
83
|
const wordingsBase = fs_1.default.readFileSync(wordingBaseFile);
|
|
@@ -62,7 +94,9 @@ function runGenerateDoc(destDir) {
|
|
|
62
94
|
return "# Anglais";
|
|
63
95
|
}
|
|
64
96
|
})();
|
|
65
|
-
const
|
|
97
|
+
const autocompletionComponent = `\nimport {UuvWordingAutocomplete} from '@site/src/components/WordingAutocomplete/uuv-wording-autocomplete.js';\n\n<UuvWordingAutocomplete lang={'${lang}'}/>\n`;
|
|
98
|
+
const rows = [title, autocompletionComponent];
|
|
99
|
+
const autocompletionSuggestions = [];
|
|
66
100
|
const stepTitle = (function () {
|
|
67
101
|
switch (lang) {
|
|
68
102
|
case lang_enum_1.LANG.FR.toString():
|
|
@@ -73,10 +107,11 @@ function runGenerateDoc(destDir) {
|
|
|
73
107
|
return ["", "", ""];
|
|
74
108
|
}
|
|
75
109
|
})();
|
|
76
|
-
const given = computeStepDefinition(wordingsBaseJson, "key.given", stepTitle[0]);
|
|
77
|
-
const when = computeStepDefinition(wordingsBaseJson, "key.when", stepTitle[1]);
|
|
78
|
-
const then = computeStepDefinition(wordingsBaseJson, "key.then", stepTitle[2]);
|
|
110
|
+
const { step: given, autocompletionSuggestions: givenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.given", stepTitle[0], undefined);
|
|
111
|
+
const { step: when, autocompletionSuggestions: whenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.when", stepTitle[1], undefined);
|
|
112
|
+
const { step: then, autocompletionSuggestions: thenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.then", stepTitle[2], undefined);
|
|
79
113
|
rows.push(...given, ...when, ...then);
|
|
114
|
+
autocompletionSuggestions.push(...givenAutocompletionSuggestions, ...whenAutocompletionSuggestions, ...thenAutocompletionSuggestions);
|
|
80
115
|
rows.push("## Par rôle");
|
|
81
116
|
const dataOrigin = wordingsEnriched;
|
|
82
117
|
let dataUpdated = dataOrigin;
|
|
@@ -89,24 +124,31 @@ function runGenerateDoc(destDir) {
|
|
|
89
124
|
.replaceAll("$roleName", role.name)
|
|
90
125
|
.replaceAll("$roleId", role.id);
|
|
91
126
|
const wordingsEnrichedJson = JSON.parse(dataUpdated);
|
|
92
|
-
const enrichedGiven = computeStepDefinition(wordingsEnrichedJson.enriched, "key.given", undefined, "####");
|
|
127
|
+
const { step: enrichedGiven, autocompletionSuggestions: enrichedGivenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.given", undefined, "####");
|
|
93
128
|
if (enrichedGiven.length > 1) {
|
|
94
129
|
rows.push(...enrichedGiven);
|
|
130
|
+
autocompletionSuggestions.push(...enrichedGivenAutocompletionSuggestions);
|
|
95
131
|
}
|
|
96
|
-
const enrichedWhen = computeStepDefinition(wordingsEnrichedJson.enriched, "key.when", undefined, "####");
|
|
132
|
+
const { step: enrichedWhen, autocompletionSuggestions: enrichedWhenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.when", undefined, "####");
|
|
97
133
|
if (enrichedWhen.length > 1) {
|
|
98
134
|
rows.push(...enrichedWhen);
|
|
135
|
+
autocompletionSuggestions.push(...enrichedWhenAutocompletionSuggestions);
|
|
99
136
|
}
|
|
100
|
-
const enrichedThen = computeStepDefinition(wordingsEnrichedJson.enriched, "key.then", undefined, "####");
|
|
137
|
+
const { step: enrichedThen, autocompletionSuggestions: enrichedThenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.then", undefined, "####");
|
|
101
138
|
if (enrichedThen.length > 1) {
|
|
102
139
|
rows.push(...enrichedThen);
|
|
140
|
+
autocompletionSuggestions.push(...enrichedThenAutocompletionSuggestions);
|
|
103
141
|
}
|
|
104
142
|
});
|
|
105
|
-
return
|
|
143
|
+
return {
|
|
144
|
+
wordingFileContent: rows.join("\n"),
|
|
145
|
+
autocompletionSuggestionContent: JSON.stringify(autocompletionSuggestions)
|
|
146
|
+
};
|
|
106
147
|
}
|
|
107
148
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
108
149
|
function computeStepDefinition(wordingsJson, stepKey, stepTitle, level = "###") {
|
|
109
150
|
const step = [];
|
|
151
|
+
const autocompletionSuggestion = [];
|
|
110
152
|
if (stepTitle) {
|
|
111
153
|
step.push(stepTitle);
|
|
112
154
|
}
|
|
@@ -115,9 +157,22 @@ function runGenerateDoc(destDir) {
|
|
|
115
157
|
const wording = `${level} ${conf.wording}`;
|
|
116
158
|
step.push(wording);
|
|
117
159
|
step.push(`> ${conf.description ?? ""}\n`);
|
|
160
|
+
autocompletionSuggestion.push({
|
|
161
|
+
suggestion: conf.wording,
|
|
162
|
+
link: conf.wording
|
|
163
|
+
.replaceAll("{", "")
|
|
164
|
+
.replaceAll("}", "")
|
|
165
|
+
.replaceAll("(", "")
|
|
166
|
+
.replaceAll(")", "")
|
|
167
|
+
.replaceAll("'", "")
|
|
168
|
+
.replaceAll(/\s/g, "-").toLowerCase()
|
|
169
|
+
});
|
|
118
170
|
}
|
|
119
171
|
});
|
|
120
|
-
return
|
|
172
|
+
return {
|
|
173
|
+
step,
|
|
174
|
+
autocompletionSuggestions: autocompletionSuggestion
|
|
175
|
+
};
|
|
121
176
|
}
|
|
122
177
|
function writeWordingFile(generatedFile, data, lang, indexOfFile) {
|
|
123
178
|
fs_1.default.writeFileSync(generatedFile, data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/runner-commons",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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 common lib for uuv",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
39
39
|
"@typescript-eslint/parser": "5.62.0",
|
|
40
|
-
"eslint": "8.
|
|
41
|
-
"jest": "29.6.
|
|
40
|
+
"eslint": "8.49.0",
|
|
41
|
+
"jest": "29.6.4"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"dist/index.d.ts",
|