@uuv/assistant 2.72.0 → 2.73.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/launcher/conf.json +1 -1
- package/dist/launcher/uuv-assistant.js +30 -19
- 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/dist/uuv-assistant-resources.bundle.js +104 -99
- package/package.json +22 -4
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.computeSentence = computeSentence;
|
|
25
|
+
exports.isTextualNode = isTextualNode;
|
|
26
|
+
const model_1 = require("./model");
|
|
27
|
+
const expect_translator_1 = require("./expect-translator");
|
|
28
|
+
const stepCase = model_1.StepCaseEnum.THEN;
|
|
29
|
+
function computeSentence(element) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!isTextualNode(element)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const sentenceKey = "key.then.element.withContent";
|
|
35
|
+
const sentence = getData(element);
|
|
36
|
+
const response = {
|
|
37
|
+
suggestion: undefined,
|
|
38
|
+
sentences: []
|
|
39
|
+
};
|
|
40
|
+
response.sentences = [stepCase + new expect_translator_1.ExpectTranslator().computeSentenceFromKeyAndContent(sentenceKey, sentence)];
|
|
41
|
+
return Promise.resolve(response);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function isTextualNode(element) {
|
|
45
|
+
return [
|
|
46
|
+
"caption",
|
|
47
|
+
"code",
|
|
48
|
+
"del",
|
|
49
|
+
"em",
|
|
50
|
+
"span",
|
|
51
|
+
"div",
|
|
52
|
+
"ins",
|
|
53
|
+
"p",
|
|
54
|
+
"strong",
|
|
55
|
+
"sub",
|
|
56
|
+
"sup"
|
|
57
|
+
].includes(element.tagName.toLowerCase())
|
|
58
|
+
&& element.childNodes.length === 1
|
|
59
|
+
&& element.childNodes[0].nodeName.toLowerCase() === "#text";
|
|
60
|
+
}
|
|
61
|
+
function getData(element) {
|
|
62
|
+
var _a;
|
|
63
|
+
return (_a = element === null || element === void 0 ? void 0 : element.childNodes[0].textContent) !== null && _a !== void 0 ? _a : "";
|
|
64
|
+
}
|
|
@@ -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;
|