@uuv/runner-commons 2.66.0 → 2.67.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.d.ts +0 -4
  3. package/dist/index.js +0 -9
  4. package/dist/step-definition-generator/common.d.ts +2 -3
  5. package/dist/step-definition-generator/common.js +0 -12
  6. package/dist/step-definition-generator/generate-base-step-definitions.d.ts +14 -1
  7. package/dist/step-definition-generator/generate-base-step-definitions.js +10 -13
  8. package/dist/step-definition-generator/generate-based-role-step-definitions.d.ts +2 -2
  9. package/dist/step-definition-generator/generate-based-role-step-definitions.js +11 -14
  10. package/dist/step-definition-generator/generate-step-definitions-documentation.js +46 -44
  11. package/dist/step-definition-generator/generate-step-definitions.js +2 -2
  12. package/package.json +3 -2
  13. package/dist/assets/i18n/web/en/en-enriched-wordings.json +0 -106
  14. package/dist/assets/i18n/web/en/en-roles.d.ts +0 -2
  15. package/dist/assets/i18n/web/en/en-roles.js +0 -137
  16. package/dist/assets/i18n/web/en/en.json +0 -314
  17. package/dist/assets/i18n/web/en/index.d.ts +0 -3
  18. package/dist/assets/i18n/web/en/index.js +0 -12
  19. package/dist/assets/i18n/web/fr/fr-roles.d.ts +0 -2
  20. package/dist/assets/i18n/web/fr/fr-roles.js +0 -599
  21. package/dist/assets/i18n/web/index.d.ts +0 -2
  22. package/dist/assets/i18n/web/index.js +0 -8
  23. package/dist/assets/i18n/web/template.json +0 -126
  24. package/dist/step-definition-generator/accessible-role.d.ts +0 -13
  25. package/dist/step-definition-generator/accessible-role.js +0 -13
  26. package/dist/step-definition-generator/lang-enum.d.ts +0 -4
  27. package/dist/step-definition-generator/lang-enum.js +0 -8
  28. package/src/assets/i18n/web/en/en-enriched-wordings.json +0 -107
  29. package/src/assets/i18n/web/en/en.json +0 -314
  30. package/src/assets/i18n/web/fr/fr-enriched-wordings.json +0 -106
  31. package/src/assets/i18n/web/fr/fr.json +0 -314
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # [2.67.0](https://github.com/e2e-test-quest/uuv/compare/runner-commons-v2.66.0...runner-commons-v2.67.0) (2025-11-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * introduce mcp server and dictionary packages, [#1153](https://github.com/e2e-test-quest/uuv/issues/1153) ([3d52b10](https://github.com/e2e-test-quest/uuv/commit/3d52b1083a49a48ab30f60362dfe993d2c05d80d))
7
+ * release 0.0.1 of mcp-server and dictionary ([838be49](https://github.com/e2e-test-quest/uuv/commit/838be49f758896e8d10c847919de4d7de3f919f5))
8
+
1
9
  # [2.66.0](https://github.com/e2e-test-quest/uuv/compare/runner-commons-v2.65.0...runner-commons-v2.66.0) (2025-11-03)
2
10
 
3
11
 
package/dist/index.d.ts CHANGED
@@ -3,8 +3,4 @@ export * from "./step-definition-generator/generate-step-definitions";
3
3
  export * from "./step-definition-generator/generate-step-definitions-documentation";
4
4
  export * from "./runner/step-definitions/_constant";
5
5
  export * from "./runner/step-definitions/_i-context";
6
- import key from "./assets/i18n/web/template.json";
7
- export { key };
8
- export { AccessibleRole } from "./step-definition-generator/accessible-role";
9
- export * from "./assets/i18n/web/en";
10
6
  export * from "./cli";
package/dist/index.js CHANGED
@@ -13,19 +13,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.AccessibleRole = exports.key = void 0;
21
17
  __exportStar(require("./step-definition-generator/common"), exports);
22
18
  __exportStar(require("./step-definition-generator/generate-step-definitions"), exports);
23
19
  __exportStar(require("./step-definition-generator/generate-step-definitions-documentation"), exports);
24
20
  __exportStar(require("./runner/step-definitions/_constant"), exports);
25
21
  __exportStar(require("./runner/step-definitions/_i-context"), exports);
26
- const template_json_1 = __importDefault(require("./assets/i18n/web/template.json"));
27
- exports.key = template_json_1.default;
28
- var accessible_role_1 = require("./step-definition-generator/accessible-role");
29
- Object.defineProperty(exports, "AccessibleRole", { enumerable: true, get: function () { return accessible_role_1.AccessibleRole; } });
30
- __exportStar(require("./assets/i18n/web/en"), exports);
31
22
  __exportStar(require("./cli"), exports);
@@ -11,7 +11,7 @@
11
11
  * understanding English or French.
12
12
  */
13
13
  import fs from "fs";
14
- import { AccessibleRole } from "./accessible-role";
14
+ import { Dictionary } from "@uuv/dictionary";
15
15
  export { fs };
16
16
  export declare abstract class GenerateFileProcessing {
17
17
  baseDir: string;
@@ -21,9 +21,8 @@ export declare abstract class GenerateFileProcessing {
21
21
  constructor(baseDir: string, runner: TEST_RUNNER_ENUM, stepDefinitionFileName: STEP_DEFINITION_FILE_NAME, wordingFileRelativePath: any);
22
22
  abstract runGenerate(): void;
23
23
  abstract generateWordingFiles(generatedFile: string, lang: string): any;
24
- abstract computeWordingFile(data: string, wordingFile: string, roles?: AccessibleRole[], generatedFile?: string): any;
24
+ abstract computeWordingFile(data: string, dictionary: Dictionary, generatedFile?: string): any;
25
25
  }
26
- export declare function getDefinedRoles(lang: string): AccessibleRole[];
27
26
  export declare enum TEST_RUNNER_ENUM {
28
27
  CYPRESS = "cypress",
29
28
  PLAYWRIGHT = "playwright"
@@ -49,13 +49,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
49
49
  };
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.Common = exports.KEY_PRESS = exports.STEP_DEFINITION_FILE_NAME = exports.TEST_RUNNER_ENUM = exports.GenerateFileProcessing = exports.fs = void 0;
52
- exports.getDefinedRoles = getDefinedRoles;
53
52
  const fs_1 = __importDefault(require("fs"));
54
53
  exports.fs = fs_1.default;
55
54
  const path = __importStar(require("path"));
56
- const lang_enum_1 = require("./lang-enum");
57
- const en_roles_1 = require("../assets/i18n/web/en/en-roles");
58
- const fr_roles_1 = require("../assets/i18n/web/fr/fr-roles");
59
55
  class GenerateFileProcessing {
60
56
  baseDir;
61
57
  stepDefinitionFile;
@@ -71,14 +67,6 @@ class GenerateFileProcessing {
71
67
  }
72
68
  }
73
69
  exports.GenerateFileProcessing = GenerateFileProcessing;
74
- function getDefinedRoles(lang) {
75
- switch (lang) {
76
- case lang_enum_1.LANG.FR.toString():
77
- return fr_roles_1.FR_ROLES;
78
- default:
79
- return en_roles_1.EN_ROLES;
80
- }
81
- }
82
70
  var TEST_RUNNER_ENUM;
83
71
  (function (TEST_RUNNER_ENUM) {
84
72
  TEST_RUNNER_ENUM["CYPRESS"] = "cypress";
@@ -1,6 +1,19 @@
1
+ /**
2
+ * Software Name : UUV
3
+ *
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * This software is distributed under the MIT License,
7
+ * see the "LICENSE" file for more details
8
+ *
9
+ * Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
10
+ * Software description: Make test writing fast, understandable by any human
11
+ * understanding English or French.
12
+ */
1
13
  import { GenerateFileProcessing } from "./common";
14
+ import { Dictionary } from "@uuv/dictionary";
2
15
  export declare class BaseStepDefinition extends GenerateFileProcessing {
3
16
  runGenerate(): void;
4
17
  generateWordingFiles(generatedFile: string, lang: string): void;
5
- computeWordingFile(data: string, wordingFile: string): string;
18
+ computeWordingFile(data: string, dictionary: Dictionary): string;
6
19
  }
@@ -46,12 +46,12 @@ exports.BaseStepDefinition = void 0;
46
46
  * Software description: Make test writing fast, understandable by any human
47
47
  * understanding English or French.
48
48
  */
49
- const lang_enum_1 = require("./lang-enum");
50
49
  const common_1 = require("./common");
51
50
  const path = __importStar(require("path"));
51
+ const dictionary_1 = require("@uuv/dictionary");
52
52
  class BaseStepDefinition extends common_1.GenerateFileProcessing {
53
53
  runGenerate() {
54
- Object.values(lang_enum_1.LANG).forEach((lang) => {
54
+ Object.values(dictionary_1.LANG).forEach((lang) => {
55
55
  const generatedFile = path.join(this.generatedDir, `_${lang}-generated-cucumber-steps-definition.ts`);
56
56
  common_1.Common.buildDirIfNotExists(this.generatedDir);
57
57
  common_1.Common.cleanGeneratedFilesIfExists(generatedFile);
@@ -59,12 +59,12 @@ class BaseStepDefinition extends common_1.GenerateFileProcessing {
59
59
  });
60
60
  }
61
61
  generateWordingFiles(generatedFile, lang) {
62
- const wordingFile = path.join(this.wordingFilePath, lang, `${lang}.json`);
63
62
  const data = common_1.fs.readFileSync(this.stepDefinitionFile, { encoding: "utf8" });
64
- const updatedData = this.computeWordingFile(data, wordingFile);
63
+ const dictionary = (0, dictionary_1.getDefinedDictionary)(lang);
64
+ const updatedData = this.computeWordingFile(data, dictionary);
65
65
  common_1.Common.writeWordingFile(generatedFile, updatedData);
66
66
  }
67
- computeWordingFile(data, wordingFile) {
67
+ computeWordingFile(data, dictionary) {
68
68
  data =
69
69
  "/*******************************\n" +
70
70
  "NE PAS MODIFIER, FICHIER GENERE\n" +
@@ -77,18 +77,15 @@ class BaseStepDefinition extends common_1.GenerateFileProcessing {
77
77
  .replace("../../../cypress/commands", "../../../../cypress/commands")
78
78
  .replace("../../../playwright/chromium", "../../../../playwright/chromium")
79
79
  .replace("../i18n/template.json", "../../i18n/template.json")
80
- .replace("import {key} from \"@uuv/runner-commons/wording/web\";", "")
81
- .replace("import { key } from \"@uuv/runner-commons/wording/web\";", "")
80
+ .replace("import {key} from \"@uuv/dictionary\";", "")
81
+ .replace("import { key } from \"@uuv/dictionary\";", "")
82
82
  .replace("./core-engine", "../core-engine")
83
83
  .replace("../../preprocessor/run/world", "../../../preprocessor/run/world")
84
84
  .replace("./a11y-engine", "../a11y-engine")
85
85
  .replace("./_.common", "/../_.common");
86
- const wordings = common_1.fs.readFileSync(wordingFile);
87
- const wordingsJson = JSON.parse(wordings.toString());
88
- wordingsJson.forEach((conf) => {
89
- data = data.replace("${" + conf.key + "}", conf.wording);
90
- data = data.replace(conf.key + ".description", conf.description);
91
- // console.debug(conf, data)
86
+ dictionary.getBaseSentences().forEach((sentence) => {
87
+ data = data.replace("${" + sentence.key + "}", sentence.wording);
88
+ data = data.replace(sentence.key + ".description", sentence.description);
92
89
  });
93
90
  return data;
94
91
  }
@@ -11,9 +11,9 @@
11
11
  * understanding English or French.
12
12
  */
13
13
  import { GenerateFileProcessing } from "./common";
14
- import { AccessibleRole } from "./accessible-role";
14
+ import { Dictionary } from "@uuv/dictionary";
15
15
  export declare class BasedRoleStepDefinition extends GenerateFileProcessing {
16
16
  runGenerate(): void;
17
17
  generateWordingFiles(generatedFile: string, lang: string): void;
18
- computeWordingFile(data: string, wordingFile: string, definedRoles: AccessibleRole[], generatedFile: string): void;
18
+ computeWordingFile(data: string, dictionary: Dictionary, generatedFile: string): void;
19
19
  }
@@ -47,11 +47,11 @@ var __importStar = (this && this.__importStar) || (function () {
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.BasedRoleStepDefinition = void 0;
49
49
  const common_1 = require("./common");
50
- const lang_enum_1 = require("./lang-enum");
51
50
  const path = __importStar(require("path"));
51
+ const dictionary_1 = require("@uuv/dictionary");
52
52
  class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
53
53
  runGenerate() {
54
- Object.values(lang_enum_1.LANG).forEach((lang) => {
54
+ Object.values(dictionary_1.LANG).forEach((lang) => {
55
55
  const generatedSubfolder = `enriched/${lang}`;
56
56
  const generatedFolder = path.join(this.generatedDir, generatedSubfolder);
57
57
  common_1.Common.cleanFolderIfExists(generatedFolder);
@@ -62,17 +62,14 @@ class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
62
62
  });
63
63
  }
64
64
  generateWordingFiles(generatedFile, lang) {
65
- const wordingFile = path.join(this.wordingFilePath, lang, `${lang}-enriched-wordings.json`);
66
65
  const data = common_1.fs.readFileSync(this.stepDefinitionFile, { encoding: "utf8" });
67
- const definedRoles = (0, common_1.getDefinedRoles)(lang);
68
- this.computeWordingFile(data, wordingFile, definedRoles, generatedFile);
66
+ const dictionary = (0, dictionary_1.getDefinedDictionary)(lang);
67
+ this.computeWordingFile(data, dictionary, generatedFile);
69
68
  }
70
- computeWordingFile(data, wordingFile, definedRoles, generatedFile) {
69
+ computeWordingFile(data, dictionary, generatedFile) {
71
70
  const dataOrigin = data;
72
71
  let dataUpdated = dataOrigin;
73
- const wordings = common_1.fs.readFileSync(wordingFile);
74
- const wordingsJson = JSON.parse(wordings.toString());
75
- definedRoles.forEach((role) => {
72
+ dictionary.getDefinedRoles().forEach((role) => {
76
73
  // console.debug("role", role)
77
74
  dataUpdated =
78
75
  "/*******************************\n" +
@@ -82,23 +79,23 @@ class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
82
79
  dataUpdated = dataUpdated
83
80
  .replace("../../cypress/commands", "../../../../../../cypress/commands")
84
81
  .replace("../i18n/template.json", "../../../../i18n/template.json")
85
- .replace("import { key } from \"@uuv/runner-commons/wording/web\";", "")
86
- .replace("import {key} from \"@uuv/runner-commons/wording/web\";", "")
82
+ .replace("import { key } from \"@uuv/dictionary\";", "")
83
+ .replace("import {key} from \"@uuv/dictionary\";", "")
87
84
  .replace("./core-engine", "../../../core-engine")
88
85
  .replace("../../preprocessor/run/world", "../../../../../preprocessor/run/world")
89
86
  .replace("./_.common", "../../../_.common");
90
- wordingsJson.enriched.forEach((conf) => {
87
+ dictionary.getRoleBasedSentencesTemplate().forEach((sentence) => {
91
88
  // console.debug(">> conf", conf)
92
89
  // console.debug("${" + conf.key + "}");
93
90
  dataUpdated = dataUpdated
94
- .replaceAll("${" + conf.key + "}", conf.wording)
91
+ .replaceAll("${" + sentence.key + "}", sentence.wording)
95
92
  .replaceAll("$roleId", role.id)
96
93
  .replaceAll("$roleName", role.name)
97
94
  .replaceAll("$definiteArticle", role.getDefiniteArticle())
98
95
  .replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
99
96
  .replaceAll("$namedAdjective", role.namedAdjective())
100
97
  .replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle())
101
- .replaceAll(conf.key + ".description", conf.description);
98
+ .replaceAll(sentence.key + ".description", sentence.description);
102
99
  });
103
100
  // Exclude Role based Content sentence if specified
104
101
  if (!role.shouldGenerateContainsSentence) {
@@ -50,10 +50,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.AutocompletionSuggestion = void 0;
52
52
  exports.runGenerateDoc = runGenerateDoc;
53
- const lang_enum_1 = require("./lang-enum");
54
53
  const fs_1 = __importDefault(require("fs"));
55
54
  const common_1 = require("./common");
56
55
  const path = __importStar(require("path"));
56
+ const dictionary_1 = require("@uuv/dictionary");
57
57
  class AutocompletionSuggestion {
58
58
  suggestion;
59
59
  link;
@@ -62,18 +62,17 @@ exports.AutocompletionSuggestion = AutocompletionSuggestion;
62
62
  function runGenerateDoc(destDir) {
63
63
  const GENERATED_DIR_DOC = `${destDir}/docs/04-wordings/01-generated-wording-description`;
64
64
  const GENERATED_DIR_DOC_FR = `${destDir}/i18n/fr/docusaurus-plugin-content-docs/current/04-wordings/01-generated-wording-description`;
65
- Object.values(lang_enum_1.LANG).forEach((lang, index) => {
65
+ Object.values(dictionary_1.LANG).forEach((lang, index) => {
66
66
  const indexOfFile = (index + 1).toLocaleString("fr-FR", {
67
67
  minimumIntegerDigits: 2,
68
68
  useGrouping: false,
69
69
  });
70
70
  const generatedFile = `${GENERATED_DIR_DOC}/${indexOfFile}-${lang}-generated-wording-description.md`;
71
- const wordingBaseFile = path.join(__dirname, `../assets/i18n/web/${lang}/${lang}.json`);
72
- const wordingEnrichedFile = path.join(__dirname, `../assets/i18n/web/${lang}/${lang}-enriched-wordings.json`);
71
+ const dictionary = (0, dictionary_1.getDefinedDictionary)(lang);
73
72
  const autocompletionSuggestionFile = path.join(GENERATED_DIR_DOC, `${lang}-autocompletion-suggestion.json`);
74
73
  cleanGeneratedFilesIfExists(generatedFile, lang, indexOfFile);
75
74
  common_1.Common.cleanGeneratedFilesIfExists(autocompletionSuggestionFile);
76
- generateWordingFiles(wordingBaseFile, wordingEnrichedFile, generatedFile, lang, indexOfFile, autocompletionSuggestionFile);
75
+ generateWordingFiles(dictionary, generatedFile, lang, indexOfFile, autocompletionSuggestionFile);
77
76
  fs_1.default.copyFileSync(generatedFile, `${GENERATED_DIR_DOC_FR}/${indexOfFile}-${lang}-generated-wording-description.md`);
78
77
  fs_1.default.copyFileSync(autocompletionSuggestionFile, path.join(GENERATED_DIR_DOC_FR, `${lang}-autocompletion-suggestion.json`));
79
78
  });
@@ -83,20 +82,17 @@ function runGenerateDoc(destDir) {
83
82
  console.log(`[DEL] ${indexOfFile}-${lang}-generated-wording-description.md deleted successfully`);
84
83
  }
85
84
  }
86
- function generateWordingFiles(wordingBaseFile, wordingEnrichedFile, generatedFile, lang, indexOfFile, autocompletionSuggestionFile) {
87
- const { wordingFileContent, autocompletionSuggestionContent } = computeWordingFile(wordingBaseFile, wordingEnrichedFile, lang);
85
+ function generateWordingFiles(dictionary, generatedFile, lang, indexOfFile, autocompletionSuggestionFile) {
86
+ const { wordingFileContent, autocompletionSuggestionContent } = computeWordingFile(dictionary, lang);
88
87
  writeWordingFile(generatedFile, wordingFileContent, lang, indexOfFile);
89
88
  common_1.Common.writeWordingFile(autocompletionSuggestionFile, autocompletionSuggestionContent);
90
89
  }
91
- function computeWordingFile(wordingBaseFile, wordingEnrichedFile, lang) {
92
- const wordingsBase = fs_1.default.readFileSync(wordingBaseFile, { encoding: "utf8" });
93
- const wordingsEnriched = fs_1.default.readFileSync(wordingEnrichedFile, { encoding: "utf8" });
94
- const wordingEnrichedNormalized = normalizedMdxData(wordingsEnriched);
95
- const wordingBaseNormalized = normalizedMdxData(wordingsBase);
96
- const wordingsBaseJson = JSON.parse(wordingBaseNormalized);
90
+ function computeWordingFile(dictionary, lang) {
91
+ const wordingEnrichedNormalized = normalizedForMdx(dictionary.getRoleBasedSentencesTemplate());
92
+ const wordingsBaseNormalized = normalizedForMdx(dictionary.getBaseSentences());
97
93
  const title = (function () {
98
94
  switch (lang) {
99
- case lang_enum_1.LANG.FR.toString():
95
+ case dictionary_1.LANG.FR.toString():
100
96
  return ("# Français \n" +
101
97
  ":::caution\n" +
102
98
  "Pensez bien à rajouter `#language: fr` en entête de votre fichier feature.\n" +
@@ -110,46 +106,44 @@ function runGenerateDoc(destDir) {
110
106
  const autocompletionSuggestions = [];
111
107
  const stepTitle = (function () {
112
108
  switch (lang) {
113
- case lang_enum_1.LANG.FR.toString():
109
+ case dictionary_1.LANG.FR.toString():
114
110
  return ["## Etant donné que", "## Quand", "## Alors"];
115
- case lang_enum_1.LANG.EN.toString():
111
+ case dictionary_1.LANG.EN.toString():
116
112
  return ["## Given", "## When", "## Then"];
117
113
  default:
118
114
  return ["", "", ""];
119
115
  }
120
116
  })();
121
- const { step: given, autocompletionSuggestions: givenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.given", stepTitle[0], undefined);
122
- const { step: when, autocompletionSuggestions: whenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.when", stepTitle[1], undefined);
123
- const { step: then, autocompletionSuggestions: thenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseJson, "key.then", stepTitle[2], undefined);
117
+ const { step: given, autocompletionSuggestions: givenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseNormalized, "key.given", stepTitle[0], undefined);
118
+ const { step: when, autocompletionSuggestions: whenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseNormalized, "key.when", stepTitle[1], undefined);
119
+ const { step: then, autocompletionSuggestions: thenAutocompletionSuggestions } = computeStepDefinition(wordingsBaseNormalized, "key.then", stepTitle[2], undefined);
124
120
  rows.push(...given, ...when, ...then);
125
121
  autocompletionSuggestions.push(...givenAutocompletionSuggestions, ...whenAutocompletionSuggestions, ...thenAutocompletionSuggestions);
126
122
  rows.push("## Par rôle");
127
- const dataOrigin = wordingEnrichedNormalized;
128
- let dataUpdated = dataOrigin;
129
123
  // console.debug("roles", wordingsEnrichedJson.role)
130
- const definedRoles = (0, common_1.getDefinedRoles)(lang);
124
+ const definedRoles = dictionary.getDefinedRoles();
131
125
  definedRoles.forEach((role) => {
132
126
  rows.push(`### ${role.id}`);
133
127
  // console.debug("dataUpdated", dataUpdated)
134
- dataUpdated = dataOrigin
135
- .replaceAll("$roleName", role.name)
136
- .replaceAll("$roleId", role.id)
137
- .replaceAll("$definiteArticle", role.getDefiniteArticle())
138
- .replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
139
- .replaceAll("$namedAdjective", role.namedAdjective())
140
- .replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle());
141
- const wordingsEnrichedJson = JSON.parse(dataUpdated);
142
- const { step: enrichedGiven, autocompletionSuggestions: enrichedGivenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.given", undefined, "####", role);
128
+ wordingEnrichedNormalized.forEach(sentence => {
129
+ sentence.wording = sentence.wording.replaceAll("$roleName", role.name)
130
+ .replaceAll("$roleId", role.id)
131
+ .replaceAll("$definiteArticle", role.getDefiniteArticle())
132
+ .replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
133
+ .replaceAll("$namedAdjective", role.namedAdjective())
134
+ .replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle());
135
+ });
136
+ const { step: enrichedGiven, autocompletionSuggestions: enrichedGivenAutocompletionSuggestions } = computeStepDefinition(wordingEnrichedNormalized, "key.given", undefined, "####", role);
143
137
  if (enrichedGiven.length > 1) {
144
138
  rows.push(...enrichedGiven);
145
139
  autocompletionSuggestions.push(...enrichedGivenAutocompletionSuggestions);
146
140
  }
147
- const { step: enrichedWhen, autocompletionSuggestions: enrichedWhenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.when", undefined, "####", role);
141
+ const { step: enrichedWhen, autocompletionSuggestions: enrichedWhenAutocompletionSuggestions } = computeStepDefinition(wordingEnrichedNormalized, "key.when", undefined, "####", role);
148
142
  if (enrichedWhen.length > 1) {
149
143
  rows.push(...enrichedWhen);
150
144
  autocompletionSuggestions.push(...enrichedWhenAutocompletionSuggestions);
151
145
  }
152
- const { step: enrichedThen, autocompletionSuggestions: enrichedThenAutocompletionSuggestions } = computeStepDefinition(wordingsEnrichedJson.enriched, "key.then", undefined, "####", role);
146
+ const { step: enrichedThen, autocompletionSuggestions: enrichedThenAutocompletionSuggestions } = computeStepDefinition(wordingEnrichedNormalized, "key.then", undefined, "####", role);
153
147
  if (enrichedThen.length > 1) {
154
148
  rows.push(...enrichedThen);
155
149
  autocompletionSuggestions.push(...enrichedThenAutocompletionSuggestions);
@@ -224,16 +218,24 @@ function runGenerateDoc(destDir) {
224
218
  fs_1.default.writeFileSync(generatedFile, data);
225
219
  console.log(`[WRITE] ${indexOfFile}-${lang}-generated-wording-description.md written successfully`);
226
220
  }
227
- function normalizedMdxData(data) {
228
- return data.replaceAll("{string}", "\\\\{string\\\\}")
229
- .replaceAll("{}", "\\\\{\\\\}")
230
- .replaceAll("{int}", "\\\\{int\\\\}")
231
- .replaceAll("{key}", "\\\\{key\\\\}")
232
- .replaceAll("{reverseTab}", "\\\\{reverseTab\\\\}")
233
- .replaceAll("{tab}", "\\\\{tab\\\\}")
234
- .replaceAll("{down}", "\\\\{down\\\\}")
235
- .replaceAll("{right}", "\\\\{right\\\\}")
236
- .replaceAll("{left}", "\\\\{left\\\\}")
237
- .replaceAll("{up}", "\\\\{up\\\\}");
221
+ function normalizedForMdx(data) {
222
+ data.forEach(sentence => {
223
+ sentence.wording = normalizeFieldForMdx(sentence.wording);
224
+ sentence.description = normalizeFieldForMdx(sentence.description);
225
+ });
226
+ return data;
227
+ }
228
+ function normalizeFieldForMdx(field) {
229
+ return field
230
+ .replaceAll("{string}", "\\{string\\}")
231
+ .replaceAll("{}", "\\{\\}")
232
+ .replaceAll("{int}", "\\{int\\}")
233
+ .replaceAll("{key}", "\\{key\\}")
234
+ .replaceAll("{reverseTab}", "\\{reverseTab\\}")
235
+ .replaceAll("{tab}", "\\{tab\\}")
236
+ .replaceAll("{down}", "\\{down\\}")
237
+ .replaceAll("{right}", "\\{right\\}")
238
+ .replaceAll("{left}", "\\{left\\}")
239
+ .replaceAll("{up}", "\\{up\\}");
238
240
  }
239
241
  }
@@ -20,8 +20,8 @@ const common_1 = require("./common");
20
20
  function generateStepDefinitionForRunner(baseDir, runner, wordingFileRelativePath) {
21
21
  const runnerBaseStepDefinition = new generate_base_step_definitions_1.BaseStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BASE, wordingFileRelativePath);
22
22
  runnerBaseStepDefinition.runGenerate();
23
- const cypressBasedRoleStepDefinition = new generate_based_role_step_definitions_1.BasedRoleStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BY_ROLE, wordingFileRelativePath);
24
- cypressBasedRoleStepDefinition.runGenerate();
23
+ const runnerBasedRoleStepDefinition = new generate_based_role_step_definitions_1.BasedRoleStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BY_ROLE, wordingFileRelativePath);
24
+ runnerBasedRoleStepDefinition.runGenerate();
25
25
  }
26
26
  function generateStepDefinitionForWebRunner(baseDir, runner) {
27
27
  generateStepDefinitionForRunner(baseDir, runner, "../assets/i18n/web");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uuv/runner-commons",
3
- "version": "2.66.0",
3
+ "version": "2.67.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",
@@ -80,7 +80,8 @@
80
80
  "figlet": "1.8.1",
81
81
  "lodash": "^4.17.21",
82
82
  "minimist": "1.2.8",
83
- "node-ipc": "^12.0.0"
83
+ "node-ipc": "^12.0.0",
84
+ "@uuv/dictionary": "0.1.0"
84
85
  },
85
86
  "funding": {
86
87
  "type": "opencollective",
@@ -1,106 +0,0 @@
1
- {
2
- "enriched": [
3
- {
4
- "key": "key.when.withinElement.roleAndName",
5
- "description": "Selects the element whose [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and accessible [name](https://russmaxdesign.github.io/html-elements-names/) are specified <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
6
- "wording": "within $indefiniteArticle $roleName named {string}",
7
- "section": "general"
8
- },
9
- {
10
- "key": "key.then.element.withRoleAndName",
11
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
12
- "wording": "I should see $indefiniteArticle $roleName named {string}",
13
- "section": "general"
14
- },
15
- {
16
- "key": "key.then.element.withRoleAndNameFocused",
17
- "description": "Checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
18
- "wording": "I should see $indefiniteArticle $roleName named {string} keyboard focused",
19
- "section": "keyboard"
20
- },
21
- {
22
- "key": "key.then.element.nextWithRoleAndNameFocused",
23
- "description": "Move to the next html element that can be reached with Tab and checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
24
- "wording": "the next keyboard element focused should be $indefiniteArticle $roleName named {string}",
25
- "section": "keyboard"
26
- },
27
- {
28
- "key": "key.then.element.previousWithRoleAndNameFocused",
29
- "description": "Move to the previous html element that can be reached with Tab and checks that the Html element with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) is focused<br/><a target='_blank' href='https://github.com/e2e-test-quest/uuv/blob/main/example/en-keyboard.feature'>Examples</a>",
30
- "wording": "the previous keyboard element focused should be $indefiniteArticle $roleName named {string}",
31
- "section": "keyboard"
32
- },
33
- {
34
- "key": "key.then.element.not.withRoleAndName",
35
- "description": "Checks that an Html element does not exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/)",
36
- "wording": "I should not see $indefiniteArticle $roleName named {string}",
37
- "section": "general"
38
- },
39
- {
40
- "key": "key.then.element.withRoleAndNameAndContent",
41
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content",
42
- "wording": "I should see $indefiniteArticle $roleName named {string} and containing {string}",
43
- "section": "contains"
44
- },
45
- {
46
- "key": "key.then.element.withRoleAndNameAndValue",
47
- "description": "Checks that an Form element(input) exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and specified value",
48
- "wording": "I should see $indefiniteArticle $roleName named {string} with value {string}",
49
- "section": "contains"
50
- },
51
- {
52
- "key": "key.then.element.withRoleAndNameAndContentDisabled",
53
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content, and with the disabled attribute set to true",
54
- "wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} disabled",
55
- "section": "contains"
56
- },
57
- {
58
- "key": "key.then.element.withRoleAndNameAndContentEnabled",
59
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/) and content, and with the disabled attribute set to false",
60
- "wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} enabled",
61
- "section": "contains"
62
- },
63
- {
64
- "key": "key.then.element.withRoleAndNameDisabled",
65
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/), and with the disabled attribute set to true",
66
- "wording": "I should see $indefiniteArticle $roleName named {string} disabled",
67
- "section": "contains"
68
- },
69
- {
70
- "key": "key.then.element.withRoleAndNameEnabled",
71
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types), [name](https://russmaxdesign.github.io/html-elements-names/), and with the disabled attribute set to false",
72
- "wording": "I should see $indefiniteArticle $roleName named {string} enabled",
73
- "section": "contains"
74
- },
75
- {
76
- "key": "key.when.type",
77
- "description": "Writes the sentence given as a parameter inside the specified field (useful for example to fill in a form field)",
78
- "wording": "I type the sentence {string} in $definiteArticle $roleName named {string}",
79
- "section": "type"
80
- },
81
- {
82
- "key": "key.then.element.withRoleAndNameAndChecked",
83
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) and is checked",
84
- "wording": "I should see $indefiniteArticle $roleName named {string} checked",
85
- "section": "checkable"
86
- },
87
- {
88
- "key": "key.then.element.withRoleAndNameAndUnchecked",
89
- "description": "Checks that an Html element exists with the specified [accessible role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles#aria_role_types) and [name](https://russmaxdesign.github.io/html-elements-names/) and is unchecked",
90
- "wording": "I should see $indefiniteArticle $roleName named {string} unchecked",
91
- "section": "checkable"
92
- },
93
- {
94
- "key": "key.when.enter",
95
- "description": "Writes the sentence given as a parameter inside the specified field (useful for example to fill in a form field)",
96
- "wording": "I enter the value {string} in $definiteArticle $roleName named {string}",
97
- "section": "type"
98
- },
99
- {
100
- "key": "key.when.click",
101
- "description": "Triggers a click on the element with role $roleId and the specified name",
102
- "wording": "I click on $roleName named {string}",
103
- "section": "click"
104
- }
105
- ]
106
- }
@@ -1,2 +0,0 @@
1
- import { AccessibleRole } from "../../../../step-definition-generator/accessible-role";
2
- export declare const EN_ROLES: AccessibleRole[];