@uuv/assistant 2.73.0 → 2.73.2
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/dist/src/Commons.d.ts +60 -0
- package/dist/src/Commons.js +55 -0
- package/dist/src/helper/css-helper.d.ts +47 -0
- package/dist/src/helper/css-helper.js +83 -0
- package/dist/src/helper/highlight/highlight-helper.d.ts +13 -0
- package/dist/src/helper/highlight/highlight-helper.js +51 -0
- package/dist/src/helper/highlight/inspector-dom.d.ts +7 -0
- package/dist/src/helper/highlight/inspector-dom.js +158 -0
- package/dist/src/helper/highlight/tooltip-helper.d.ts +2 -0
- package/dist/src/helper/highlight/tooltip-helper.js +67 -0
- package/dist/src/helper/index.d.ts +1 -0
- package/dist/src/helper/index.js +17 -0
- package/dist/src/helper/informative-nodes-helper.d.ts +38 -0
- package/dist/src/helper/informative-nodes-helper.js +250 -0
- package/dist/src/helper/keyboard-navigation-helper.d.ts +21 -0
- package/dist/src/helper/keyboard-navigation-helper.js +151 -0
- package/dist/src/helper/layer-helper.d.ts +12 -0
- package/dist/src/helper/layer-helper.js +149 -0
- package/dist/src/helper/result-display-helper.d.ts +2 -0
- package/dist/src/helper/result-display-helper.js +20 -0
- package/dist/src/helper/result-script-helper.d.ts +1 -0
- package/dist/src/helper/result-script-helper.js +30 -0
- package/dist/src/helper/selection-helper.d.ts +26 -0
- package/dist/src/helper/selection-helper.js +92 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +19 -0
- package/dist/src/service/abstract-component-service.d.ts +21 -0
- package/dist/src/service/abstract-component-service.js +107 -0
- package/dist/src/service/dialog-service.d.ts +22 -0
- package/dist/src/service/dialog-service.js +90 -0
- package/dist/src/service/form-completion-service.d.ts +23 -0
- package/dist/src/service/form-completion-service.js +72 -0
- package/dist/src/service/index.d.ts +4 -0
- package/dist/src/service/index.js +20 -0
- package/dist/src/service/table-and-grid-service.d.ts +17 -0
- package/dist/src/service/table-and-grid-service.js +87 -0
- package/dist/src/translator/abstract-translator.d.ts +29 -0
- package/dist/src/translator/abstract-translator.js +137 -0
- package/dist/src/translator/click-translator.d.ts +21 -0
- package/dist/src/translator/click-translator.js +60 -0
- package/dist/src/translator/expect-translator.d.ts +23 -0
- package/dist/src/translator/expect-translator.js +157 -0
- package/dist/src/translator/index.d.ts +8 -0
- package/dist/src/translator/index.js +24 -0
- package/dist/src/translator/keyboard-navigation-translator.d.ts +19 -0
- package/dist/src/translator/keyboard-navigation-translator.js +42 -0
- package/dist/src/translator/model.d.ts +38 -0
- package/dist/src/translator/model.js +31 -0
- package/dist/src/translator/textual-translator.d.ts +15 -0
- package/dist/src/translator/textual-translator.js +64 -0
- package/dist/src/translator/type-translator.d.ts +24 -0
- package/dist/src/translator/type-translator.js +121 -0
- package/dist/src/translator/within-translator.d.ts +19 -0
- package/dist/src/translator/within-translator.js +42 -0
- package/package.json +5 -4
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
*/
|
|
13
|
+
import { Translator } from "./abstract-translator";
|
|
14
|
+
import { TranslateSentences } from "./model";
|
|
15
|
+
export declare class TypeTranslator extends Translator {
|
|
16
|
+
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
|
+
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
+
getSentenceFromDomSelector(htmlElem: HTMLElement | SVGElement): TranslateSentences;
|
|
19
|
+
computeSentenceFromKeyRoleNameAndContent(computedKey: string, accessibleRole: string, accessibleName: string, content: string): string;
|
|
20
|
+
private buildSentencesWithRoleAndName;
|
|
21
|
+
private buildWording;
|
|
22
|
+
private getMockedDataForAccessibleRole;
|
|
23
|
+
private getMockedDataForHtmlElement;
|
|
24
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Software Name : UUV
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*
|
|
7
|
+
* This software is distributed under the MIT License,
|
|
8
|
+
* see the "LICENSE" file for more details
|
|
9
|
+
*
|
|
10
|
+
* Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
|
|
11
|
+
* Software description: Make test writing fast, understandable by any human
|
|
12
|
+
* understanding English or French.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TypeTranslator = void 0;
|
|
16
|
+
const abstract_translator_1 = require("./abstract-translator");
|
|
17
|
+
const model_1 = require("./model");
|
|
18
|
+
const stepCase = model_1.StepCaseEnum.WHEN;
|
|
19
|
+
class TypeTranslator extends abstract_translator_1.Translator {
|
|
20
|
+
getSentenceFromAccessibleRoleAndName(accessibleRole, accessibleName) {
|
|
21
|
+
const response = this.initResponse();
|
|
22
|
+
response.sentences = this.buildSentencesWithRoleAndName(accessibleRole, accessibleName);
|
|
23
|
+
return response;
|
|
24
|
+
}
|
|
25
|
+
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole, accessibleName, content) {
|
|
26
|
+
const response = this.initResponse();
|
|
27
|
+
const computedKey = accessibleRole === "textbox" ? "key.when.type" : "key.when.enter";
|
|
28
|
+
const sentence = this.computeSentenceFromKeyRoleNameAndContent(computedKey, accessibleRole, accessibleName, content);
|
|
29
|
+
response.sentences = [
|
|
30
|
+
stepCase + sentence,
|
|
31
|
+
];
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
getSentenceFromDomSelector(htmlElem) {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
const response = this.initResponse();
|
|
37
|
+
const computedKey = "key.when.withinElement.selector";
|
|
38
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, abstract_translator_1.Translator.getSelector(htmlElem));
|
|
39
|
+
const clickSentence = this.getSentenceFromKey("key.when.type.withContext");
|
|
40
|
+
const resetContextSentence = this.getSentenceFromKey("key.when.resetContext");
|
|
41
|
+
const isInputHtmlorTextArea = htmlElem instanceof HTMLInputElement || htmlElem instanceof HTMLTextAreaElement;
|
|
42
|
+
const content = isInputHtmlorTextArea ?
|
|
43
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
44
|
+
htmlElem.value :
|
|
45
|
+
(_a = htmlElem.getAttribute("value")) !== null && _a !== void 0 ? _a : (_c = (_b = htmlElem.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
46
|
+
response.sentences = [
|
|
47
|
+
stepCase + sentence,
|
|
48
|
+
model_1.StepCaseEnum.AND + clickSentence.wording.replace("{string}", this.getMockedDataForHtmlElement(htmlElem, content)),
|
|
49
|
+
model_1.StepCaseEnum.AND + resetContextSentence.wording
|
|
50
|
+
];
|
|
51
|
+
return response;
|
|
52
|
+
}
|
|
53
|
+
computeSentenceFromKeyRoleNameAndContent(computedKey, accessibleRole, accessibleName, content) {
|
|
54
|
+
return this.dictionary.getRoleBasedSentencesTemplate()
|
|
55
|
+
.filter((value) => value.key === computedKey)
|
|
56
|
+
.map(sentence => {
|
|
57
|
+
return this.dictionary.computeSentence({
|
|
58
|
+
sentence,
|
|
59
|
+
accessibleRole,
|
|
60
|
+
parameters: [content, accessibleName]
|
|
61
|
+
});
|
|
62
|
+
})[0];
|
|
63
|
+
}
|
|
64
|
+
buildSentencesWithRoleAndName(accessibleRole, accessibleName) {
|
|
65
|
+
const sentenceKey = accessibleRole === "textbox" ? "key.when.type" : "key.when.enter";
|
|
66
|
+
const wording = this.buildWording(sentenceKey, accessibleRole, accessibleName);
|
|
67
|
+
return [stepCase + wording];
|
|
68
|
+
}
|
|
69
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
70
|
+
buildWording(computedKey, accessibleRole, accessibleName) {
|
|
71
|
+
const typeSentence = [
|
|
72
|
+
...this.dictionary.getRoleBasedSentencesTemplate(),
|
|
73
|
+
...this.dictionary.getBaseSentences()
|
|
74
|
+
].find((el) => (el.key === computedKey));
|
|
75
|
+
return this.dictionary.computeSentence({
|
|
76
|
+
mock: this.getMockedDataForAccessibleRole(accessibleRole),
|
|
77
|
+
sentence: typeSentence,
|
|
78
|
+
accessibleRole,
|
|
79
|
+
parameters: [accessibleName]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getMockedDataForAccessibleRole(accessibleRole) {
|
|
83
|
+
var _a, _b, _c;
|
|
84
|
+
const isInputHtmlOrTextArea = this.selectedHtmlElem instanceof HTMLInputElement || this.selectedHtmlElem instanceof HTMLTextAreaElement;
|
|
85
|
+
let content = isInputHtmlOrTextArea ?
|
|
86
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
87
|
+
this.selectedHtmlElem.value :
|
|
88
|
+
(_a = this.selectedHtmlElem.getAttribute("value")) !== null && _a !== void 0 ? _a : (_c = (_b = this.selectedHtmlElem.firstChild) === null || _b === void 0 ? void 0 : _b.textContent) === null || _c === void 0 ? void 0 : _c.trim();
|
|
89
|
+
if (!content) {
|
|
90
|
+
content = undefined;
|
|
91
|
+
}
|
|
92
|
+
if (accessibleRole === "spinbutton") {
|
|
93
|
+
return content !== null && content !== void 0 ? content : "123";
|
|
94
|
+
}
|
|
95
|
+
if (accessibleRole === "slider") {
|
|
96
|
+
return content !== null && content !== void 0 ? content : "3";
|
|
97
|
+
}
|
|
98
|
+
return content !== null && content !== void 0 ? content : "Lorem ipsum";
|
|
99
|
+
}
|
|
100
|
+
getMockedDataForHtmlElement(htmlElem, content) {
|
|
101
|
+
if (content) {
|
|
102
|
+
content = "\"" + content + "\"";
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
content = undefined;
|
|
106
|
+
}
|
|
107
|
+
if (htmlElem.tagName.toLowerCase() === "input") {
|
|
108
|
+
if (htmlElem.getAttribute("type") === "number") {
|
|
109
|
+
return content !== null && content !== void 0 ? content : "\"123\"";
|
|
110
|
+
}
|
|
111
|
+
if (htmlElem.getAttribute("type") === "date") {
|
|
112
|
+
return content !== null && content !== void 0 ? content : "\"30/07/2024\"";
|
|
113
|
+
}
|
|
114
|
+
if (htmlElem.getAttribute("type") === "time") {
|
|
115
|
+
return content !== null && content !== void 0 ? content : "\"14:03\"";
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return content !== null && content !== void 0 ? content : "\"Lorem ipsum\"";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.TypeTranslator = TypeTranslator;
|
|
@@ -0,0 +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
|
+
*/
|
|
13
|
+
import { Translator } from "./abstract-translator";
|
|
14
|
+
import { TranslateSentences } from "./model";
|
|
15
|
+
export declare class WithinTranslator extends Translator {
|
|
16
|
+
getSentenceFromAccessibleRoleAndName(accessibleRole: string, accessibleName: string): TranslateSentences;
|
|
17
|
+
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole: string, accessibleName: string, content: string): TranslateSentences;
|
|
18
|
+
getSentenceFromDomSelector(htmlElem: HTMLElement | SVGElement): TranslateSentences;
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Software Name : UUV
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*
|
|
7
|
+
* This software is distributed under the MIT License,
|
|
8
|
+
* see the "LICENSE" file for more details
|
|
9
|
+
*
|
|
10
|
+
* Authors: NJAKO MOLOM Louis Fredice & SERVICAL Stanley
|
|
11
|
+
* Software description: Make test writing fast, understandable by any human
|
|
12
|
+
* understanding English or French.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WithinTranslator = void 0;
|
|
16
|
+
const abstract_translator_1 = require("./abstract-translator");
|
|
17
|
+
const model_1 = require("./model");
|
|
18
|
+
const stepCase = model_1.StepCaseEnum.WHEN;
|
|
19
|
+
class WithinTranslator extends abstract_translator_1.Translator {
|
|
20
|
+
getSentenceFromAccessibleRoleAndName(accessibleRole, accessibleName) {
|
|
21
|
+
const response = this.initResponse();
|
|
22
|
+
const computedKey = "key.when.withinElement.roleAndName";
|
|
23
|
+
const sentence = this.computeSentenceFromKeyRoleAndName(computedKey, accessibleRole, accessibleName);
|
|
24
|
+
response.sentences = [stepCase + sentence];
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
getSentenceFromAccessibleRoleAndNameAndContent(accessibleRole, accessibleName, content) {
|
|
28
|
+
const response = this.initResponse();
|
|
29
|
+
const computedKey = "key.when.withinElement.roleAndName";
|
|
30
|
+
const sentence = this.computeSentenceFromKeyRoleNameAndContent(computedKey, accessibleRole, accessibleName, content);
|
|
31
|
+
response.sentences = [stepCase + sentence];
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
getSentenceFromDomSelector(htmlElem) {
|
|
35
|
+
const response = this.initResponse();
|
|
36
|
+
const computedKey = "key.when.withinElement.selector";
|
|
37
|
+
const sentence = this.computeSentenceFromKeyAndSelector(computedKey, abstract_translator_1.Translator.getSelector(htmlElem));
|
|
38
|
+
response.sentences = [stepCase + sentence];
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.WithinTranslator = WithinTranslator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/assistant",
|
|
3
|
-
"version": "2.73.
|
|
3
|
+
"version": "2.73.2",
|
|
4
4
|
"author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
|
|
5
5
|
"description": "UUV Helper used to improve the life of testers and developers by generating cucumber phrases from the GUI.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,8 +59,9 @@
|
|
|
59
59
|
"@codemirror/view": "^6.26.3",
|
|
60
60
|
"@uiw/codemirror-theme-github": "^4.22.1",
|
|
61
61
|
"@uiw/react-codemirror": "^4.22.1",
|
|
62
|
-
"@uuv/dictionary": "0.1.
|
|
62
|
+
"@uuv/dictionary": "0.1.1",
|
|
63
63
|
"antd": "5.27.4",
|
|
64
|
+
"dom-accessibility-api": "0.7.0",
|
|
64
65
|
"eslint-config-react-app": "7.0.1",
|
|
65
66
|
"figlet": "1.8.1",
|
|
66
67
|
"playwright-chromium": "1.56.1",
|
|
@@ -92,9 +93,8 @@
|
|
|
92
93
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
93
94
|
"@typescript-eslint/eslint-plugin": "5.62.0",
|
|
94
95
|
"@typescript-eslint/parser": "5.62.0",
|
|
95
|
-
"@uuv/playwright": "3.54.
|
|
96
|
+
"@uuv/playwright": "3.54.1",
|
|
96
97
|
"@vitejs/plugin-react": "4.7.0",
|
|
97
|
-
"dom-accessibility-api": "0.7.0",
|
|
98
98
|
"eslint-plugin-react": "7.37.5",
|
|
99
99
|
"jest-environment-jsdom": "^29.5.0",
|
|
100
100
|
"minimist": "1.2.8",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"files": [
|
|
114
114
|
"dist/uuv-assistant-resources.bundle.js",
|
|
115
115
|
"dist/launcher/**/*",
|
|
116
|
+
"dist/src/**/*",
|
|
116
117
|
"postinstall.js"
|
|
117
118
|
],
|
|
118
119
|
"main": "./dist/src/index.js",
|