@uuv/runner-commons 1.11.0 → 1.12.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 +16 -0
- package/dist/assets/i18n/web/en/en-enriched-wordings.json +39 -0
- package/dist/assets/i18n/web/en/en-roles.d.ts +2 -0
- package/dist/assets/i18n/web/en/en-roles.js +130 -0
- package/dist/assets/i18n/web/en/en.json +222 -0
- package/dist/assets/i18n/web/en/index.d.ts +3 -0
- package/dist/assets/i18n/web/en/index.js +12 -0
- package/dist/assets/i18n/web/fr/fr-roles.d.ts +2 -0
- package/dist/assets/i18n/web/fr/fr-roles.js +560 -0
- package/dist/assets/i18n/web/index.d.ts +2 -0
- package/dist/assets/i18n/web/index.js +8 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -2
- package/dist/step-definition-generator/accessible-role.d.ts +8 -0
- package/dist/step-definition-generator/accessible-role.js +8 -0
- package/dist/step-definition-generator/common.d.ts +8 -5
- package/dist/step-definition-generator/common.js +44 -4
- package/dist/step-definition-generator/generate-base-step-definitions.d.ts +2 -3
- package/dist/step-definition-generator/generate-base-step-definitions.js +33 -15
- package/dist/step-definition-generator/generate-based-role-step-definitions.d.ts +3 -4
- package/dist/step-definition-generator/generate-based-role-step-definitions.js +41 -18
- package/dist/step-definition-generator/generate-step-definitions-documentation.js +4 -4
- package/dist/step-definition-generator/generate-step-definitions.d.ts +2 -1
- package/dist/step-definition-generator/generate-step-definitions.js +13 -6
- package/package.json +12 -1
- package/src/assets/i18n/web/en/en-enriched-wordings.json +40 -0
- package/src/assets/i18n/web/en/en.json +222 -0
- package/src/assets/i18n/web/fr/fr-enriched-wordings.json +39 -0
- package/src/assets/i18n/web/fr/fr.json +222 -0
- /package/dist/assets/i18n/{template.json → web/template.json} +0 -0
|
@@ -13,24 +13,64 @@
|
|
|
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.Common = exports.KEY_PRESS = exports.STEP_DEFINITION_FILE_NAME = exports.TEST_RUNNER_ENUM = exports.GenerateFileProcessing = exports.fs = void 0;
|
|
43
|
+
exports.Common = exports.KEY_PRESS = exports.STEP_DEFINITION_FILE_NAME = exports.TEST_RUNNER_ENUM = exports.getDefinedRoles = exports.GenerateFileProcessing = exports.fs = void 0;
|
|
21
44
|
const fs_1 = __importDefault(require("fs"));
|
|
22
45
|
exports.fs = fs_1.default;
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const lang_enum_1 = require("./lang-enum");
|
|
48
|
+
const en_roles_1 = require("../assets/i18n/web/en/en-roles");
|
|
49
|
+
const fr_roles_1 = require("../assets/i18n/web/fr/fr-roles");
|
|
23
50
|
class GenerateFileProcessing {
|
|
24
51
|
baseDir;
|
|
25
|
-
stepDefinitionFile
|
|
26
|
-
generatedDir
|
|
27
|
-
|
|
52
|
+
stepDefinitionFile;
|
|
53
|
+
generatedDir;
|
|
54
|
+
wordingFilePath;
|
|
55
|
+
constructor(baseDir, runner, stepDefinitionFileName, wordingFileRelativePath) {
|
|
28
56
|
this.baseDir = baseDir;
|
|
29
57
|
this.stepDefinitionFile = `${this.baseDir}/src/cucumber/step_definitions/${runner.toString()}/${stepDefinitionFileName.toString()}.ts`;
|
|
30
58
|
this.generatedDir = `${this.baseDir}/src/cucumber/step_definitions/${runner.toString()}/generated`;
|
|
59
|
+
this.stepDefinitionFile = path.join(this.baseDir, `src/cucumber/step_definitions/${runner.toString()}/${stepDefinitionFileName.toString()}.ts`);
|
|
60
|
+
this.generatedDir = path.join(this.baseDir, `src/cucumber/step_definitions/${runner.toString()}/generated`);
|
|
61
|
+
this.wordingFilePath = path.join(__dirname, `${wordingFileRelativePath}`);
|
|
31
62
|
}
|
|
32
63
|
}
|
|
33
64
|
exports.GenerateFileProcessing = GenerateFileProcessing;
|
|
65
|
+
function getDefinedRoles(lang) {
|
|
66
|
+
switch (lang) {
|
|
67
|
+
case lang_enum_1.LANG.FR.toString():
|
|
68
|
+
return fr_roles_1.FR_ROLES;
|
|
69
|
+
default:
|
|
70
|
+
return en_roles_1.EN_ROLES;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.getDefinedRoles = getDefinedRoles;
|
|
34
74
|
var TEST_RUNNER_ENUM;
|
|
35
75
|
(function (TEST_RUNNER_ENUM) {
|
|
36
76
|
TEST_RUNNER_ENUM["CYPRESS"] = "cypress";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { GenerateFileProcessing
|
|
1
|
+
import { GenerateFileProcessing } from "./common";
|
|
2
2
|
export declare class BaseStepDefinition extends GenerateFileProcessing {
|
|
3
|
-
constructor(baseDir: string, runner: TEST_RUNNER_ENUM, stepDefinitionFileName: STEP_DEFINITION_FILE_NAME);
|
|
4
3
|
runGenerate(): void;
|
|
5
|
-
computeWordingFile(data: string, wordingFile: string): string;
|
|
6
4
|
generateWordingFiles(generatedFile: string, lang: string): void;
|
|
5
|
+
computeWordingFile(data: string, wordingFile: string): string;
|
|
7
6
|
}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.BaseStepDefinition = void 0;
|
|
4
27
|
/**
|
|
@@ -15,19 +38,22 @@ exports.BaseStepDefinition = void 0;
|
|
|
15
38
|
*/
|
|
16
39
|
const lang_enum_1 = require("./lang-enum");
|
|
17
40
|
const common_1 = require("./common");
|
|
41
|
+
const path = __importStar(require("path"));
|
|
18
42
|
class BaseStepDefinition extends common_1.GenerateFileProcessing {
|
|
19
|
-
constructor(baseDir, runner, stepDefinitionFileName) {
|
|
20
|
-
super(baseDir, runner, stepDefinitionFileName);
|
|
21
|
-
}
|
|
22
43
|
runGenerate() {
|
|
23
44
|
Object.values(lang_enum_1.LANG).forEach((lang) => {
|
|
24
|
-
const generatedFile =
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
|
+
const generatedFile = path.join(this.generatedDir, `_${lang}-generated-cucumber-steps-definition.ts`);
|
|
26
46
|
common_1.Common.buildDirIfNotExists(this.generatedDir);
|
|
27
47
|
common_1.Common.cleanGeneratedFilesIfExists(generatedFile);
|
|
28
48
|
this.generateWordingFiles(generatedFile, lang);
|
|
29
49
|
});
|
|
30
50
|
}
|
|
51
|
+
generateWordingFiles(generatedFile, lang) {
|
|
52
|
+
const wordingFile = path.join(this.wordingFilePath, lang, `${lang}.json`);
|
|
53
|
+
const data = common_1.fs.readFileSync(this.stepDefinitionFile, { encoding: "utf8" });
|
|
54
|
+
const updatedData = this.computeWordingFile(data, wordingFile);
|
|
55
|
+
common_1.Common.writeWordingFile(generatedFile, updatedData);
|
|
56
|
+
}
|
|
31
57
|
computeWordingFile(data, wordingFile) {
|
|
32
58
|
data =
|
|
33
59
|
"/*******************************\n" +
|
|
@@ -41,8 +67,8 @@ class BaseStepDefinition extends common_1.GenerateFileProcessing {
|
|
|
41
67
|
.replace("../../../cypress/commands", "../../../../cypress/commands")
|
|
42
68
|
.replace("../../../playwright/chromium", "../../../../playwright/chromium")
|
|
43
69
|
.replace("../i18n/template.json", "../../i18n/template.json")
|
|
44
|
-
.replace("import {key} from \"@uuv/runner-commons\";", "")
|
|
45
|
-
.replace("import { key } from \"@uuv/runner-commons\";", "")
|
|
70
|
+
.replace("import {key} from \"@uuv/runner-commons/wording/web\";", "")
|
|
71
|
+
.replace("import { key } from \"@uuv/runner-commons/wording/web\";", "")
|
|
46
72
|
.replace("./core-engine", "../core-engine")
|
|
47
73
|
.replace("../../preprocessor/run/world", "../../../preprocessor/run/world");
|
|
48
74
|
const wordings = common_1.fs.readFileSync(wordingFile);
|
|
@@ -53,13 +79,5 @@ class BaseStepDefinition extends common_1.GenerateFileProcessing {
|
|
|
53
79
|
});
|
|
54
80
|
return data;
|
|
55
81
|
}
|
|
56
|
-
generateWordingFiles(generatedFile, lang) {
|
|
57
|
-
const wordingFile = `${__dirname}/../assets/i18n/${lang}.json`;
|
|
58
|
-
const data = common_1.fs.readFileSync(
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
60
|
-
this.stepDefinitionFile, { encoding: "utf8" });
|
|
61
|
-
const updatedData = this.computeWordingFile(data, wordingFile);
|
|
62
|
-
common_1.Common.writeWordingFile(generatedFile, updatedData);
|
|
63
|
-
}
|
|
64
82
|
}
|
|
65
83
|
exports.BaseStepDefinition = BaseStepDefinition;
|
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
* Software description: Make test writing fast, understandable by any human
|
|
13
13
|
* understanding English or French.
|
|
14
14
|
*/
|
|
15
|
-
import { GenerateFileProcessing
|
|
15
|
+
import { GenerateFileProcessing } from "./common";
|
|
16
|
+
import { AccessibleRole } from "./accessible-role";
|
|
16
17
|
export declare class BasedRoleStepDefinition extends GenerateFileProcessing {
|
|
17
|
-
constructor(baseDir: string, runner: TEST_RUNNER_ENUM, stepDefinitionFileName: STEP_DEFINITION_FILE_NAME);
|
|
18
|
-
generatedFile: string;
|
|
19
18
|
runGenerate(): void;
|
|
20
19
|
generateWordingFiles(generatedFile: string, lang: string): void;
|
|
21
|
-
computeWordingFile(data: string, wordingFile: string): void;
|
|
20
|
+
computeWordingFile(data: string, wordingFile: string, definedRoles: AccessibleRole[], generatedFile: string): void;
|
|
22
21
|
}
|
|
@@ -13,39 +13,58 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
40
|
exports.BasedRoleStepDefinition = void 0;
|
|
18
41
|
const common_1 = require("./common");
|
|
19
42
|
const lang_enum_1 = require("./lang-enum");
|
|
43
|
+
const path = __importStar(require("path"));
|
|
20
44
|
class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
|
|
21
|
-
constructor(baseDir, runner, stepDefinitionFileName) {
|
|
22
|
-
super(baseDir, runner, stepDefinitionFileName);
|
|
23
|
-
}
|
|
24
|
-
generatedFile = "";
|
|
25
45
|
runGenerate() {
|
|
26
46
|
Object.values(lang_enum_1.LANG).forEach((lang) => {
|
|
27
47
|
const generatedSubfolder = `enriched/${lang}`;
|
|
28
|
-
const generatedFolder =
|
|
48
|
+
const generatedFolder = path.join(this.generatedDir, generatedSubfolder);
|
|
29
49
|
common_1.Common.cleanFolderIfExists(generatedFolder);
|
|
30
50
|
common_1.Common.buildDirIfNotExists(generatedFolder);
|
|
31
|
-
|
|
51
|
+
const generatedFile = path.join(generatedFolder, `_${lang}-generated-steps-definition_$roleId.ts`);
|
|
32
52
|
// console.debug("generatedFile template", this.generatedFile)
|
|
33
|
-
this.generateWordingFiles(
|
|
53
|
+
this.generateWordingFiles(generatedFile, lang);
|
|
34
54
|
});
|
|
35
55
|
}
|
|
36
56
|
generateWordingFiles(generatedFile, lang) {
|
|
37
|
-
const wordingFile = `${
|
|
38
|
-
const data = common_1.fs.readFileSync(
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
-
this.computeWordingFile(data, wordingFile);
|
|
57
|
+
const wordingFile = path.join(this.wordingFilePath, lang, `${lang}-enriched-wordings.json`);
|
|
58
|
+
const data = common_1.fs.readFileSync(this.stepDefinitionFile, { encoding: "utf8" });
|
|
59
|
+
const definedRoles = (0, common_1.getDefinedRoles)(lang);
|
|
60
|
+
this.computeWordingFile(data, wordingFile, definedRoles, generatedFile);
|
|
42
61
|
}
|
|
43
|
-
computeWordingFile(data, wordingFile) {
|
|
62
|
+
computeWordingFile(data, wordingFile, definedRoles, generatedFile) {
|
|
44
63
|
const dataOrigin = data;
|
|
45
64
|
let dataUpdated = dataOrigin;
|
|
46
65
|
const wordings = common_1.fs.readFileSync(wordingFile);
|
|
47
66
|
const wordingsJson = JSON.parse(wordings.toString());
|
|
48
|
-
|
|
67
|
+
definedRoles.forEach((role) => {
|
|
49
68
|
// console.debug("role", role)
|
|
50
69
|
dataUpdated =
|
|
51
70
|
"/*******************************\n" +
|
|
@@ -55,8 +74,8 @@ class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
|
|
|
55
74
|
dataUpdated = dataUpdated
|
|
56
75
|
.replace("../../cypress/commands", "../../../../../../cypress/commands")
|
|
57
76
|
.replace("../i18n/template.json", "../../../../i18n/template.json")
|
|
58
|
-
.replace("import { key } from \"@uuv/runner-commons\";", "")
|
|
59
|
-
.replace("import {key} from \"@uuv/runner-commons\";", "")
|
|
77
|
+
.replace("import { key } from \"@uuv/runner-commons/wording/web\";", "")
|
|
78
|
+
.replace("import {key} from \"@uuv/runner-commons/wording/web\";", "")
|
|
60
79
|
.replace("./core-engine", "../../../core-engine")
|
|
61
80
|
.replace("../../preprocessor/run/world", "../../../../../preprocessor/run/world");
|
|
62
81
|
wordingsJson.enriched.forEach((conf) => {
|
|
@@ -65,9 +84,13 @@ class BasedRoleStepDefinition extends common_1.GenerateFileProcessing {
|
|
|
65
84
|
dataUpdated = dataUpdated
|
|
66
85
|
.replaceAll("${" + conf.key + "}", conf.wording)
|
|
67
86
|
.replaceAll("$roleId", role.id)
|
|
68
|
-
.replaceAll("$roleName", role.name)
|
|
87
|
+
.replaceAll("$roleName", role.name)
|
|
88
|
+
.replaceAll("$definiteArticle", role.getDefiniteArticle())
|
|
89
|
+
.replaceAll("$indefiniteArticle", role.getIndefiniteArticle())
|
|
90
|
+
.replaceAll("$namedAdjective", role.namedAdjective())
|
|
91
|
+
.replaceAll("$ofDefiniteArticle", role.getOfDefiniteArticle());
|
|
69
92
|
});
|
|
70
|
-
const generatedFilename =
|
|
93
|
+
const generatedFilename = generatedFile.replace("$roleId", role.id);
|
|
71
94
|
// console.debug(">>> data", dataUpdated)
|
|
72
95
|
// console.debug(">>> generatedFilename", generatedFilename)
|
|
73
96
|
common_1.Common.writeWordingFile(generatedFilename, dataUpdated);
|
|
@@ -59,8 +59,8 @@ function runGenerateDoc(destDir) {
|
|
|
59
59
|
useGrouping: false,
|
|
60
60
|
});
|
|
61
61
|
const generatedFile = `${GENERATED_DIR_DOC}/${indexOfFile}-${lang}-generated-wording-description.md`;
|
|
62
|
-
const wordingBaseFile =
|
|
63
|
-
const wordingEnrichedFile =
|
|
62
|
+
const wordingBaseFile = path.join(__dirname, `../assets/i18n/web/${lang}/${lang}.json`);
|
|
63
|
+
const wordingEnrichedFile = path.join(__dirname, `../assets/i18n/web/${lang}/${lang}-enriched-wordings.json`);
|
|
64
64
|
const autocompletionSuggestionFile = path.join(GENERATED_DIR_DOC, `${lang}-autocompletion-suggestion.json`);
|
|
65
65
|
cleanGeneratedFilesIfExists(generatedFile, lang, indexOfFile);
|
|
66
66
|
common_1.Common.cleanGeneratedFilesIfExists(autocompletionSuggestionFile);
|
|
@@ -116,8 +116,8 @@ function runGenerateDoc(destDir) {
|
|
|
116
116
|
const dataOrigin = wordingsEnriched;
|
|
117
117
|
let dataUpdated = dataOrigin;
|
|
118
118
|
// console.debug("roles", wordingsEnrichedJson.role)
|
|
119
|
-
const
|
|
120
|
-
|
|
119
|
+
const definedRoles = (0, common_1.getDefinedRoles)(lang);
|
|
120
|
+
definedRoles.forEach((role) => {
|
|
121
121
|
rows.push(`### ${role.id}`);
|
|
122
122
|
// console.debug("dataUpdated", dataUpdated)
|
|
123
123
|
dataUpdated = dataOrigin
|
|
@@ -13,4 +13,5 @@
|
|
|
13
13
|
* understanding English or French.
|
|
14
14
|
*/
|
|
15
15
|
import { TEST_RUNNER_ENUM } from "./common";
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function generateStepDefinitionForWebRunner(baseDir: string, runner: TEST_RUNNER_ENUM): void;
|
|
17
|
+
export declare function generateStepDefinitionForMobileRunner(baseDir: string, runner: TEST_RUNNER_ENUM): void;
|
|
@@ -14,14 +14,21 @@
|
|
|
14
14
|
* understanding English or French.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.generateStepDefinitionForMobileRunner = exports.generateStepDefinitionForWebRunner = void 0;
|
|
18
18
|
const generate_base_step_definitions_1 = require("./generate-base-step-definitions");
|
|
19
19
|
const generate_based_role_step_definitions_1 = require("./generate-based-role-step-definitions");
|
|
20
20
|
const common_1 = require("./common");
|
|
21
|
-
function generateStepDefinitionForRunner(baseDir, runner) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const cypressBasedRoleStepDefinition = new generate_based_role_step_definitions_1.BasedRoleStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BY_ROLE);
|
|
21
|
+
function generateStepDefinitionForRunner(baseDir, runner, wordingFileRelativePath) {
|
|
22
|
+
const runnerBaseStepDefinition = new generate_base_step_definitions_1.BaseStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BASE, wordingFileRelativePath);
|
|
23
|
+
runnerBaseStepDefinition.runGenerate();
|
|
24
|
+
const cypressBasedRoleStepDefinition = new generate_based_role_step_definitions_1.BasedRoleStepDefinition(baseDir, runner, common_1.STEP_DEFINITION_FILE_NAME.BY_ROLE, wordingFileRelativePath);
|
|
25
25
|
cypressBasedRoleStepDefinition.runGenerate();
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
function generateStepDefinitionForWebRunner(baseDir, runner) {
|
|
28
|
+
generateStepDefinitionForRunner(baseDir, runner, "../assets/i18n/web");
|
|
29
|
+
}
|
|
30
|
+
exports.generateStepDefinitionForWebRunner = generateStepDefinitionForWebRunner;
|
|
31
|
+
function generateStepDefinitionForMobileRunner(baseDir, runner) {
|
|
32
|
+
generateStepDefinitionForRunner(baseDir, runner, "../assets/i18n/mobile");
|
|
33
|
+
}
|
|
34
|
+
exports.generateStepDefinitionForMobileRunner = generateStepDefinitionForMobileRunner;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/runner-commons",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.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",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"dist/index.js",
|
|
46
46
|
"dist/step-definition-generator/**/*",
|
|
47
47
|
"dist/assets/**/*",
|
|
48
|
+
"src/assets/i18n/*/*/*.json",
|
|
48
49
|
"dist/runner/**/*",
|
|
49
50
|
"*.md"
|
|
50
51
|
],
|
|
@@ -53,6 +54,16 @@
|
|
|
53
54
|
"import": "./dist/index.js",
|
|
54
55
|
"require": "./dist/index.js",
|
|
55
56
|
"types": "./dist/index.d.ts"
|
|
57
|
+
},
|
|
58
|
+
"./wording/web": {
|
|
59
|
+
"import": "./dist/assets/i18n/web/index.js",
|
|
60
|
+
"require": "./dist/assets/i18n/web/index.js",
|
|
61
|
+
"types": "./dist/assets/i18n/web/index.d.ts"
|
|
62
|
+
},
|
|
63
|
+
"./wording/web/en": {
|
|
64
|
+
"import": "./dist/assets/i18n/web/en/index.js",
|
|
65
|
+
"require": "./dist/assets/i18n/web/en/index.js",
|
|
66
|
+
"types": "./dist/assets/i18n/web/en/index.d.ts"
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"key": "key.then.element.withRoleAndName",
|
|
10
|
+
"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/)",
|
|
11
|
+
"wording": "I should see $indefiniteArticle $roleName named {string}"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"key": "key.then.element.not.withRoleAndName",
|
|
15
|
+
"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/)",
|
|
16
|
+
"wording": "I should not see $indefiniteArticle $roleName named {string}"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"key": "key.then.element.withRoleAndNameAndContent",
|
|
20
|
+
"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",
|
|
21
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string}"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"key": "key.then.element.withRoleAndNameAndContentDisabled",
|
|
25
|
+
"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",
|
|
26
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} disabled"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"key": "key.then.element.withRoleAndNameAndContentEnabled",
|
|
30
|
+
"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",
|
|
31
|
+
"wording": "I should see $indefiniteArticle $roleName named {string} and containing {string} enabled"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "key.when.type",
|
|
35
|
+
"description": "Writes the sentence given as a parameter inside the specified field (useful for example to fill in a form field)",
|
|
36
|
+
"wording": "I type the sentence {string} in $definiteArticle $roleName named {string}"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"key": "key.when.click.withContext",
|
|
4
|
+
"description": "Triggers a click on the selected element.<br/>Make sure you've selected an element beforehand with the <strong>within...</strong> phrases.",
|
|
5
|
+
"wording": "I click"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"key": "key.when.click.button",
|
|
9
|
+
"description": "Triggers a click on the given button with specific name",
|
|
10
|
+
"wording": "I click on button named {string}"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"key": "key.when.click.link",
|
|
14
|
+
"description": "Triggers a click on the given link with specific name",
|
|
15
|
+
"wording": "I click on link named {string}"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"key": "key.when.click.withRole",
|
|
19
|
+
"description": "Triggers a click on the element with given role and specific name",
|
|
20
|
+
"wording": "I click on element with role {string} and name {string}"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "key.when.headers.forUriAndMethod",
|
|
24
|
+
"description": "Sets one or more headers to the indicated http request and only for the Http method (GET / POST / etc...) passed as a argument.<i> If you use Playwright as execution engine, <b>method</b> isn't used.</i>",
|
|
25
|
+
"wording": "I set header(s) for uri {string} and method {string}"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "key.when.headers.forUri",
|
|
29
|
+
"description": "Sets one or more headers to the indicated http request",
|
|
30
|
+
"wording": "I set header(s) for uri {string}"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"key": "key.when.resetContext",
|
|
34
|
+
"description": "Deletes selected element and timeout",
|
|
35
|
+
"wording": "I reset context"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"key": "key.when.timeout",
|
|
39
|
+
"description": "Sets the timeout value (in millisecond) for finding element in the DOM <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
|
|
40
|
+
"wording": "I set timeout with value {int}"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"key": "key.when.type",
|
|
44
|
+
"description": "Writes the sentence passed as a parameter (useful for example to fill in a form field).<br/>Make sure you've selected an element beforehand with the <strong>within...</strong> phrases.",
|
|
45
|
+
"wording": "I type the sentence {string}"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"key": "key.when.keyboard.press",
|
|
49
|
+
"description": "Press specified key: <table><thead><tr><th>Key</th><th>Description</th></tr></thead><tbody><tr><td>{tab}</td><td>Tabulation</td></tr><tr><td>{reverseTab}</td><td>Reverse tabulation</td></tr><tr><td>{down}</td><td>Arrow Down</td></tr><tr><td>{right}</td><td>Arrow Right</td></tr><tr><td>{left}</td><td>Arrow Left</td></tr><tr><td>{up}</td><td>Arrow Up</td></tr></tbody></table><br/>Make sure you've selected an element beforehand with the <strong>within...</strong> phrases.",
|
|
50
|
+
"wording": "I press {string}"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"key": "key.when.keyboard.multiplePress",
|
|
54
|
+
"description": "Press specified key multiple times using | as: num|{key}",
|
|
55
|
+
"wording": "I press {int} times on {string}"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"key": "key.when.visit",
|
|
59
|
+
"description": "Navigate to the Uri passed as a argument (full url consisting of the BASE_URL + Uri) or navigate to Url if begin with http:// or https://",
|
|
60
|
+
"wording": "I visit path {string}"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"key": "key.when.withinElement.ariaLabel",
|
|
64
|
+
"description": "Selects the element whose aria-label is specified <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
|
|
65
|
+
"wording": "within the element with aria-label {string}"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"key": "key.when.withinElement.selector",
|
|
69
|
+
"description": "Selects the element whose selector is specified <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
|
|
70
|
+
"wording": "within the element with selector {string}"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"key": "key.when.withinElement.roleAndName",
|
|
74
|
+
"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",
|
|
75
|
+
"wording": "within the element with role {string} and name {string}"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"key": "key.when.withinElement.testId",
|
|
79
|
+
"description": "Selects the element whose data-testId attribute is specified <br />⚠ remember to deselect the element with <b>[I reset context](#i-reset-context)</b> if you're no longer acting on it",
|
|
80
|
+
"wording": "within the element with testId {string}"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"key": "key.when.mock.withBody",
|
|
84
|
+
"description": "Mock a named API response with body. <i>If you use Playwright as runtime engine, <b>request</b> and <b>named</b> are unused.</i>",
|
|
85
|
+
"wording": "I mock a request {} on url {string} named {string} with content {}"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"key": "key.when.mock.withFixture",
|
|
89
|
+
"description": "Mock a named API response with file's extension .json, .js, .coffee, .html, .txt, .csv, .png, .jpg, .jpeg, .gif, .tif, .tiff, .zip",
|
|
90
|
+
"wording": "I mock a request {} on url {string} named {string} with fixture {}"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"key": "key.when.mock.withStatusCode",
|
|
94
|
+
"description": "Mock a named API response with status code",
|
|
95
|
+
"wording": "I mock a request {} on url {string} named {string} with status code {int}"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"key": "key.given.viewport.preset",
|
|
99
|
+
"description": "Sets the viewport dimensions with one of the presets defined by your runtime engine as Cypress: [Link](https://docs.cypress.io/api/commands/viewport#Arguments) or Playwright: [Link](https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json)",
|
|
100
|
+
"wording": "I set viewport to preset {string}"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"key": "key.given.viewport.withWidthAndHeight",
|
|
104
|
+
"description": "Sets the viewport dimensions to the specified width and length",
|
|
105
|
+
"wording": "I set viewport with width {int} and height {int}"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"key": "key.then.attributes.withValues",
|
|
109
|
+
"description": "Checks Html attributes of the selected element",
|
|
110
|
+
"wording": "I should see these attributes with values"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"key": "key.then.element.withAriaLabelAndContent",
|
|
114
|
+
"description": "Checks that an Html element exists with the specified aria-label attribute and content",
|
|
115
|
+
"wording": "I should see an element with aria-label {string} and content {string}"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"key": "key.then.element.withAriaLabel",
|
|
119
|
+
"description": "Checks that an Html element exists with the specified aria-label attribute",
|
|
120
|
+
"wording": "I should see an element with aria-label {string}"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"key": "key.then.element.withContent",
|
|
124
|
+
"description": "Checks that an Html element exists with the specified content",
|
|
125
|
+
"wording": "I should see an element with content {string}"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"key": "key.then.element.withSelector",
|
|
129
|
+
"description": "Checks that an Html element exists with the specified selector",
|
|
130
|
+
"wording": "I should see an element with selector {string}"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"key": "key.then.element.withRoleAndNameAndContentDisabled",
|
|
134
|
+
"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",
|
|
135
|
+
"wording": "I should see an element with role {string} and name {string} and content {string} disabled"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"key": "key.then.element.withRoleAndNameAndContentEnabled",
|
|
139
|
+
"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",
|
|
140
|
+
"wording": "I should see an element with role {string} and name {string} and content {string} not disabled"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"key": "key.then.element.withRoleAndNameAndContent",
|
|
144
|
+
"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",
|
|
145
|
+
"wording": "I should see an element with role {string} and name {string} and content {string}"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"key": "key.then.element.withRoleAndName",
|
|
149
|
+
"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/)",
|
|
150
|
+
"wording": "I should see an element with role {string} and name {string}"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"key": "key.then.element.withTestId",
|
|
154
|
+
"description": "Checks that an Html element exists with the specified data-testid attribute",
|
|
155
|
+
"wording": "I should see an element with testId {string}"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"key": "key.then.list.withNameAndContent",
|
|
159
|
+
"description": "Checks that there is a list with the specified [name](https://russmaxdesign.github.io/html-elements-names/) and content.<br/> See this <a href='https://github.com/Orange-OpenSource/uuv/blob/9e3c9914420c6d527f7ad8b0017a0f8e26250f86/example/weather-app.feature#L17'>example</a>",
|
|
160
|
+
"wording": "I should see elements of the list with name {string}"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"key": "key.then.element.not.withContent",
|
|
164
|
+
"description": "Checks that an Html element does not exists with the specified content",
|
|
165
|
+
"wording": "I should not see an element with content {string}"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"key": "key.then.element.not.withTestId",
|
|
169
|
+
"description": "Checks that an Html element does not exists with the specified data-testid attribute",
|
|
170
|
+
"wording": "I should not see an element with testId {string}"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"key": "key.then.element.not.withRoleAndName",
|
|
174
|
+
"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/)",
|
|
175
|
+
"wording": "I should not see an element with role {string} and name {string}"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"key": "key.then.element.not.withAriaLabel",
|
|
179
|
+
"description": "Checks that an Html element does not exists with the specified aria-label attribute",
|
|
180
|
+
"wording": "I should not see an element with aria-label {string}"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"key": "key.then.wait.mock",
|
|
184
|
+
"description": "Wait that a named mock has been consumed until timeout",
|
|
185
|
+
"wording": "I should consume a mock named {string}"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"key": "key.then.wait.milliSeconds",
|
|
189
|
+
"description": "Wait milliseconds. <b>Warning:</b> use this sentence <b>in production</b> can make your <b>test flaky</b>.",
|
|
190
|
+
"wording": "I wait {int} ms"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"key": "key.then.a11y.check.default",
|
|
194
|
+
"description": "Check that the current page have no [accessibility issue](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md)",
|
|
195
|
+
"wording": "I should not have any accessibility issue"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"key": "key.then.a11y.check.withFixtureContextAndFixtureOption",
|
|
199
|
+
"description": "Check that the current page have no accessibility issue [with an option](https://github.com/dequelabs/axe-core/blob/HEAD/doc/API.md#options-parameter) on the specific [context](https://github.com/dequelabs/axe-core/blob/HEAD/doc/API.md#context-parameter)",
|
|
200
|
+
"wording": "I should not have any accessibility issue with context json fixture {} and option json fixture {}"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"key": "key.then.a11y.check.withFixtureOption",
|
|
204
|
+
"description": "Check that the current page have no accessibility issue [with an option](https://github.com/dequelabs/axe-core/blob/HEAD/doc/API.md#options-parameter)",
|
|
205
|
+
"wording": "I should not have any accessibility issue with option json fixture {}"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"key": "key.then.a11y.check.onlyCritical",
|
|
209
|
+
"description": "Check that the current page have not critical accessibility issue",
|
|
210
|
+
"wording": "I should not have any critical accessibility issue"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"key": "key.then.a11y.check.withImpacts",
|
|
214
|
+
"description": "Check that the current page have not accessibility issue with one or more impacts in: 'minor','moderate','serious','critical'",
|
|
215
|
+
"wording": "I should not have any accessibility issue with {} impact(s)"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"key": "key.then.a11y.check.withTags",
|
|
219
|
+
"description": "Check that the current page have not accessibility issue [with one or more Accessibility Standards](https://github.com/dequelabs/axe-core/blob/HEAD/doc/API.md#axe-core-tags)",
|
|
220
|
+
"wording": "I should not have any accessibility issue with accessibility standard(s) {}"
|
|
221
|
+
}
|
|
222
|
+
]
|