@perforce-perfecto/scriptless-helpers 1.46.3 → 1.47.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/package.json +3 -2
- package/src/index.d.ts +25 -0
- package/src/index.js +25 -0
- package/src/index.js.map +1 -1
- package/src/lib/action-arguments-helper.d.ts +36 -0
- package/src/lib/action-arguments-helper.js +60 -0
- package/src/lib/action-arguments-helper.js.map +1 -0
- package/src/lib/action-result-helper.d.ts +8 -0
- package/src/lib/action-result-helper.js +28 -0
- package/src/lib/action-result-helper.js.map +1 -0
- package/src/lib/constants-helper.d.ts +10 -0
- package/src/lib/constants-helper.js +43 -0
- package/src/lib/constants-helper.js.map +1 -0
- package/src/lib/custom-error.d.ts +5 -0
- package/src/lib/custom-error.js +14 -0
- package/src/lib/custom-error.js.map +1 -0
- package/src/lib/data-table-helper.d.ts +17 -0
- package/src/lib/data-table-helper.js +88 -0
- package/src/lib/data-table-helper.js.map +1 -0
- package/src/lib/element-helper.d.ts +16 -0
- package/src/lib/element-helper.js +191 -0
- package/src/lib/element-helper.js.map +1 -0
- package/src/lib/exit-execution-helper.d.ts +13 -0
- package/src/lib/exit-execution-helper.js +50 -0
- package/src/lib/exit-execution-helper.js.map +1 -0
- package/src/lib/file-transfer-helper.d.ts +12 -0
- package/src/lib/file-transfer-helper.js +132 -0
- package/src/lib/file-transfer-helper.js.map +1 -0
- package/src/lib/handset-open-helper.d.ts +26 -0
- package/src/lib/handset-open-helper.js +53 -0
- package/src/lib/handset-open-helper.js.map +1 -0
- package/src/lib/handset-select-helper.d.ts +40 -0
- package/src/lib/handset-select-helper.js +126 -0
- package/src/lib/handset-select-helper.js.map +1 -0
- package/src/lib/handset-variable-helper.d.ts +9 -0
- package/src/lib/handset-variable-helper.js +38 -0
- package/src/lib/handset-variable-helper.js.map +1 -0
- package/src/lib/parameter-helper.d.ts +6 -0
- package/src/lib/parameter-helper.js +25 -0
- package/src/lib/parameter-helper.js.map +1 -0
- package/src/lib/perfecto-execute-script-helper.d.ts +5 -0
- package/src/lib/perfecto-execute-script-helper.js +27 -0
- package/src/lib/perfecto-execute-script-helper.js.map +1 -0
- package/src/lib/script-info-helper.d.ts +4 -0
- package/src/lib/script-info-helper.js +28 -0
- package/src/lib/script-info-helper.js.map +1 -0
- package/src/lib/secured-variable-helper.d.ts +6 -0
- package/src/lib/secured-variable-helper.js +17 -0
- package/src/lib/secured-variable-helper.js.map +1 -0
- package/src/lib/test-end-status-helper.d.ts +4 -0
- package/src/lib/test-end-status-helper.js +19 -0
- package/src/lib/test-end-status-helper.js.map +1 -0
- package/src/lib/touch-drag-helper.d.ts +17 -0
- package/src/lib/touch-drag-helper.js +96 -0
- package/src/lib/touch-drag-helper.js.map +1 -0
- package/src/lib/variable-attribute-checkpoint-helper.d.ts +4 -0
- package/src/lib/variable-attribute-checkpoint-helper.js +20 -0
- package/src/lib/variable-attribute-checkpoint-helper.js.map +1 -0
- package/src/types/active-script-function-data.d.ts +12 -0
- package/src/types/active-script-function-data.js +3 -0
- package/src/types/active-script-function-data.js.map +1 -0
- package/src/types/data-table.d.ts +30 -0
- package/src/types/data-table.js +3 -0
- package/src/types/data-table.js.map +1 -0
- package/src/types/desired-device-capabilities.d.ts +25 -0
- package/src/types/desired-device-capabilities.js +3 -0
- package/src/types/desired-device-capabilities.js.map +1 -0
- package/src/types/perfecto-device-capabilities.d.ts +128 -0
- package/src/types/perfecto-device-capabilities.js +3 -0
- package/src/types/perfecto-device-capabilities.js.map +1 -0
- package/src/types/type-utils.d.ts +3 -0
- package/src/types/type-utils.js +3 -0
- package/src/types/type-utils.js.map +1 -0
- package/src/types/user-defined-variables.d.ts +11 -0
- package/src/types/user-defined-variables.js +3 -0
- package/src/types/user-defined-variables.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perforce-perfecto/scriptless-helpers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"webdriverio": "^9.21.0",
|
|
10
10
|
"lodash": "^4.17.21",
|
|
11
11
|
"axios": "^1.12.2",
|
|
12
|
-
"jsonpointer": "^5.0.1"
|
|
12
|
+
"jsonpointer": "^5.0.1",
|
|
13
|
+
"file-type": "^21.0.0"
|
|
13
14
|
},
|
|
14
15
|
"publishConfig": {
|
|
15
16
|
"access": "public"
|
package/src/index.d.ts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
+
export * from './lib/action-arguments-helper';
|
|
2
|
+
export * from './lib/action-result-helper';
|
|
3
|
+
export * from './lib/constants-helper';
|
|
1
4
|
export * from './lib/counter-helper';
|
|
5
|
+
export * from './lib/custom-error';
|
|
6
|
+
export * from './lib/data-table-helper';
|
|
7
|
+
export * from './lib/element-helper';
|
|
8
|
+
export * from './lib/exit-execution-helper';
|
|
9
|
+
export * from './lib/file-transfer-helper';
|
|
10
|
+
export * from './lib/handset-open-helper';
|
|
11
|
+
export * from './lib/handset-select-helper';
|
|
12
|
+
export * from './lib/handset-variable-helper';
|
|
2
13
|
export * from './lib/http-request-helper';
|
|
3
14
|
export * from './lib/integer-helper';
|
|
4
15
|
export * from './lib/json-pointer-helper';
|
|
5
16
|
export * from './lib/message-helper';
|
|
17
|
+
export * from './lib/parameter-helper';
|
|
18
|
+
export * from './lib/perfecto-execute-script-helper';
|
|
19
|
+
export * from './lib/script-info-helper';
|
|
20
|
+
export * from './lib/secured-variable-helper';
|
|
21
|
+
export * from './lib/test-end-status-helper';
|
|
6
22
|
export * from './lib/text-helper';
|
|
7
23
|
export * from './lib/timer-helper';
|
|
24
|
+
export * from './lib/touch-drag-helper';
|
|
25
|
+
export * from './lib/variable-attribute-checkpoint-helper';
|
|
8
26
|
export * from './lib/webdriver-session-helper';
|
|
27
|
+
export * from './types/active-script-function-data';
|
|
28
|
+
export * from './types/scriptless-helper';
|
|
29
|
+
export * from './types/logger';
|
|
30
|
+
export * from './types/data-table';
|
|
31
|
+
export * from './types/user-defined-variables';
|
|
32
|
+
export * from './types/desired-device-capabilities';
|
|
33
|
+
export * from './types/perfecto-device-capabilities';
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/action-arguments-helper"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/action-result-helper"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/constants-helper"), exports);
|
|
4
7
|
tslib_1.__exportStar(require("./lib/counter-helper"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/custom-error"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./lib/data-table-helper"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./lib/element-helper"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./lib/exit-execution-helper"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./lib/file-transfer-helper"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./lib/handset-open-helper"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./lib/handset-select-helper"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./lib/handset-variable-helper"), exports);
|
|
5
16
|
tslib_1.__exportStar(require("./lib/http-request-helper"), exports);
|
|
6
17
|
tslib_1.__exportStar(require("./lib/integer-helper"), exports);
|
|
7
18
|
tslib_1.__exportStar(require("./lib/json-pointer-helper"), exports);
|
|
8
19
|
tslib_1.__exportStar(require("./lib/message-helper"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./lib/parameter-helper"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./lib/perfecto-execute-script-helper"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./lib/script-info-helper"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./lib/secured-variable-helper"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./lib/test-end-status-helper"), exports);
|
|
9
25
|
tslib_1.__exportStar(require("./lib/text-helper"), exports);
|
|
10
26
|
tslib_1.__exportStar(require("./lib/timer-helper"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./lib/touch-drag-helper"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./lib/variable-attribute-checkpoint-helper"), exports);
|
|
11
29
|
tslib_1.__exportStar(require("./lib/webdriver-session-helper"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./types/active-script-function-data"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./types/scriptless-helper"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./types/logger"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./types/data-table"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./types/user-defined-variables"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./types/desired-device-capabilities"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./types/perfecto-device-capabilities"), exports);
|
|
12
37
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/execution-helpers-public/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,oEAA0C;AAC1C,+DAAqC;AACrC,oEAA0C;AAC1C,+DAAqC;AACrC,4DAAkC;AAClC,6DAAmC;AACnC,yEAA+C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/execution-helpers-public/src/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,qEAA2C;AAC3C,iEAAuC;AACvC,+DAAqC;AACrC,6DAAmC;AACnC,kEAAwC;AACxC,+DAAqC;AACrC,sEAA4C;AAC5C,qEAA2C;AAC3C,oEAA0C;AAC1C,sEAA4C;AAC5C,wEAA8C;AAC9C,oEAA0C;AAC1C,+DAAqC;AACrC,oEAA0C;AAC1C,+DAAqC;AACrC,iEAAuC;AACvC,+EAAqD;AACrD,mEAAyC;AACzC,wEAA8C;AAC9C,uEAA6C;AAC7C,4DAAkC;AAClC,6DAAmC;AACnC,kEAAwC;AACxC,qFAA2D;AAC3D,yEAA+C;AAE/C,8EAAoD;AACpD,oEAA0C;AAC1C,yDAA+B;AAC/B,6DAAmC;AACnC,yEAA+C;AAC/C,8EAAoD;AACpD,+EAAqD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SecuredVariableHelper } from './secured-variable-helper';
|
|
2
|
+
import { DesiredDeviceCapability } from '../types/desired-device-capabilities';
|
|
3
|
+
import { ProcessedDataTableCell } from '../types/data-table';
|
|
4
|
+
import { UserDefinedVariable } from '../types/user-defined-variables';
|
|
5
|
+
import { ScriptlessHelper } from '../types/scriptless-helper';
|
|
6
|
+
import { Logger } from '../types/logger';
|
|
7
|
+
declare enum CommandParameterAttribute {
|
|
8
|
+
SENSITIVE = "SENSITIVE",
|
|
9
|
+
HIDDEN = "HIDDEN"
|
|
10
|
+
}
|
|
11
|
+
type ConstantActionArgument = {
|
|
12
|
+
argumentName?: string;
|
|
13
|
+
dataSource: 'CONSTANT';
|
|
14
|
+
data: string | boolean | undefined;
|
|
15
|
+
secured?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type VariableActionArgument = {
|
|
18
|
+
argumentName?: string;
|
|
19
|
+
dataSource: 'VARIABLE';
|
|
20
|
+
data: UserDefinedVariable;
|
|
21
|
+
};
|
|
22
|
+
type DataTableActionArgument = {
|
|
23
|
+
argumentName?: string;
|
|
24
|
+
dataSource: 'DATATABLE';
|
|
25
|
+
data: ProcessedDataTableCell;
|
|
26
|
+
};
|
|
27
|
+
export type ActionArgument = ConstantActionArgument | VariableActionArgument | DataTableActionArgument;
|
|
28
|
+
export declare class ActionArgumentsHelper extends ScriptlessHelper {
|
|
29
|
+
protected securedVariableHelper: SecuredVariableHelper;
|
|
30
|
+
constructor(securedVariableHelper: SecuredVariableHelper, logger?: Logger);
|
|
31
|
+
extractAndValidateActionArgumentValue(actionArgument: ActionArgument): string | number | boolean | undefined;
|
|
32
|
+
extractActionArgumentKeyOrValueAsFallback(actionArgument: ActionArgument): string | number | boolean | DesiredDeviceCapability | undefined;
|
|
33
|
+
fetchActionArgumentForReporting(actionArgument: ActionArgument): string | number | boolean | DesiredDeviceCapability | undefined;
|
|
34
|
+
extractSensitiveCommandParameterAttribute(actionArgument: ActionArgument): CommandParameterAttribute.SENSITIVE | undefined;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionArgumentsHelper = void 0;
|
|
4
|
+
const scriptless_helper_1 = require("../types/scriptless-helper");
|
|
5
|
+
var CommandParameterAttribute;
|
|
6
|
+
(function (CommandParameterAttribute) {
|
|
7
|
+
CommandParameterAttribute["SENSITIVE"] = "SENSITIVE";
|
|
8
|
+
CommandParameterAttribute["HIDDEN"] = "HIDDEN";
|
|
9
|
+
})(CommandParameterAttribute || (CommandParameterAttribute = {}));
|
|
10
|
+
class ActionArgumentsHelper extends scriptless_helper_1.ScriptlessHelper {
|
|
11
|
+
constructor(securedVariableHelper, logger) {
|
|
12
|
+
super(logger);
|
|
13
|
+
this.securedVariableHelper = securedVariableHelper;
|
|
14
|
+
}
|
|
15
|
+
extractAndValidateActionArgumentValue(actionArgument) {
|
|
16
|
+
let argumentValue;
|
|
17
|
+
if (actionArgument.dataSource === 'CONSTANT') {
|
|
18
|
+
if (actionArgument.secured) {
|
|
19
|
+
argumentValue = this.securedVariableHelper.decryptSecuredString(actionArgument.data);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
argumentValue = actionArgument.data;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (actionArgument.dataSource === 'VARIABLE' ||
|
|
26
|
+
actionArgument.dataSource === 'DATATABLE') {
|
|
27
|
+
argumentValue = actionArgument.data.value;
|
|
28
|
+
}
|
|
29
|
+
return argumentValue;
|
|
30
|
+
}
|
|
31
|
+
extractActionArgumentKeyOrValueAsFallback(actionArgument) {
|
|
32
|
+
var _a;
|
|
33
|
+
if (actionArgument.dataSource === 'CONSTANT') {
|
|
34
|
+
return actionArgument.data;
|
|
35
|
+
}
|
|
36
|
+
return (_a = actionArgument.data.key) !== null && _a !== void 0 ? _a : actionArgument.data.value;
|
|
37
|
+
}
|
|
38
|
+
fetchActionArgumentForReporting(actionArgument) {
|
|
39
|
+
// While reporting 'Device ID' we send deviceId for device
|
|
40
|
+
if (((actionArgument.dataSource === 'VARIABLE' &&
|
|
41
|
+
actionArgument.data['@type'] === 'HandsetData') ||
|
|
42
|
+
(actionArgument.dataSource === 'DATATABLE' &&
|
|
43
|
+
actionArgument.data['@type'] === 'HANDSET')) &&
|
|
44
|
+
actionArgument.data.key) {
|
|
45
|
+
return actionArgument.data.key.deviceId;
|
|
46
|
+
}
|
|
47
|
+
return this.extractActionArgumentKeyOrValueAsFallback(actionArgument);
|
|
48
|
+
}
|
|
49
|
+
extractSensitiveCommandParameterAttribute(actionArgument) {
|
|
50
|
+
if ((actionArgument.dataSource === 'CONSTANT' && actionArgument.secured) ||
|
|
51
|
+
(actionArgument.dataSource === 'VARIABLE' &&
|
|
52
|
+
actionArgument.data.secured) ||
|
|
53
|
+
(actionArgument.dataSource === 'DATATABLE' && actionArgument.data.secured)) {
|
|
54
|
+
return CommandParameterAttribute.SENSITIVE;
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.ActionArgumentsHelper = ActionArgumentsHelper;
|
|
60
|
+
//# sourceMappingURL=action-arguments-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-arguments-helper.js","sourceRoot":"","sources":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C,IAAI,CAAC,OAAO,CAAC,KAAK,aAAa,CAAC;YAC/C,CAAC,cAAc,CAAC,UAAU,KAAK,WAAW;gBACxC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC;YAChD,cAAc,CAAC,IAAI,CAAC,GAAG,EACvB,CAAC;YACD,OAAQ,cAAc,CAAC,IAAI,CAAC,GAA+B,CAAC,QAAQ,CAAC;QACvE,CAAC;QACD,OAAO,IAAI,CAAC,yCAAyC,CAAC,cAAc,CAAC,CAAC;IACxE,CAAC;IAED,yCAAyC,CAAC,cAA8B;QACtE,IACE,CAAC,cAAc,CAAC,UAAU,KAAK,UAAU,IAAI,cAAc,CAAC,OAAO,CAAC;YACpE,CAAC,cAAc,CAAC,UAAU,KAAK,UAAU;gBACvC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9B,CAAC,cAAc,CAAC,UAAU,KAAK,WAAW,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAC1E,CAAC;YACD,OAAO,yBAAyB,CAAC,SAAS,CAAC;QAC7C,CAAC;QACD,OAAO;IACT,CAAC;CACF;AA3DD,sDA2DC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScriptlessHelper } from '../types/scriptless-helper';
|
|
2
|
+
import { ActiveScriptFunctionData } from '../types/active-script-function-data';
|
|
3
|
+
import { PerfectoExecuteScriptHelper } from './perfecto-execute-script-helper';
|
|
4
|
+
export declare class ActionResultHelper extends ScriptlessHelper {
|
|
5
|
+
perfectoExecuteScriptHelper: PerfectoExecuteScriptHelper;
|
|
6
|
+
convertActionResultToMap(actionResult: string): Map<string, string>;
|
|
7
|
+
isActiveScriptFunctionSuccess(activeScriptFunctionData: ActiveScriptFunctionData): boolean;
|
|
8
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionResultHelper = void 0;
|
|
4
|
+
const scriptless_helper_1 = require("../types/scriptless-helper");
|
|
5
|
+
const perfecto_execute_script_helper_1 = require("./perfecto-execute-script-helper");
|
|
6
|
+
class ActionResultHelper extends scriptless_helper_1.ScriptlessHelper {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.perfectoExecuteScriptHelper = new perfecto_execute_script_helper_1.PerfectoExecuteScriptHelper();
|
|
10
|
+
}
|
|
11
|
+
convertActionResultToMap(actionResult) {
|
|
12
|
+
const actionResultMap = new Map();
|
|
13
|
+
const pairs = actionResult
|
|
14
|
+
.substring(1, actionResult.length - 1)
|
|
15
|
+
.split(', ');
|
|
16
|
+
for (const pair of pairs) {
|
|
17
|
+
const [key, value] = pair.split('=');
|
|
18
|
+
actionResultMap.set(key, value);
|
|
19
|
+
}
|
|
20
|
+
return actionResultMap;
|
|
21
|
+
}
|
|
22
|
+
isActiveScriptFunctionSuccess(activeScriptFunctionData) {
|
|
23
|
+
return (!activeScriptFunctionData.actionError &&
|
|
24
|
+
!this.perfectoExecuteScriptHelper.isExecuteScriptResultFailed(activeScriptFunctionData.actionResult));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ActionResultHelper = ActionResultHelper;
|
|
28
|
+
//# sourceMappingURL=action-result-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-result-helper.js","sourceRoot":"","sources":["../../../../../libs/execution-helpers-public/src/lib/action-result-helper.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAE9D,qFAA+E;AAE/E,MAAa,kBAAmB,SAAQ,oCAAgB;IAAxD;;QACE,gCAA2B,GAAG,IAAI,4DAA2B,EAAE,CAAC;IAwBlE,CAAC;IAvBC,wBAAwB,CAAC,YAAoB;QAC3C,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;QAClD,MAAM,KAAK,GAAG,YAAY;aACvB,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;aACrC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,6BAA6B,CAC3B,wBAAkD;QAElD,OAAO,CACL,CAAC,wBAAwB,CAAC,WAAW;YACrC,CAAC,IAAI,CAAC,2BAA2B,CAAC,2BAA2B,CAC3D,wBAAwB,CAAC,YAAY,CACtC,CACF,CAAC;IACJ,CAAC;CACF;AAzBD,gDAyBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ConstantsHelper {
|
|
2
|
+
private static readonly TENANT_ID_SUFFIX;
|
|
3
|
+
static getTenantId(): string;
|
|
4
|
+
static getShortTenantId(): string;
|
|
5
|
+
static getPerfectoAuthHeaders(): Record<string, string>;
|
|
6
|
+
static getExecutedByUserEmail(): string;
|
|
7
|
+
static getExecutionReportiumUrl(): string;
|
|
8
|
+
static setAppiumServer(): string;
|
|
9
|
+
static getSecurityToken(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstantsHelper = void 0;
|
|
4
|
+
class ConstantsHelper {
|
|
5
|
+
static getTenantId() {
|
|
6
|
+
if (!process.env['TENANT_ID']) {
|
|
7
|
+
throw new Error('Tenant ID is not set');
|
|
8
|
+
}
|
|
9
|
+
return process.env['TENANT_ID'];
|
|
10
|
+
}
|
|
11
|
+
static getShortTenantId() {
|
|
12
|
+
return this.getTenantId().replace(ConstantsHelper.TENANT_ID_SUFFIX, '');
|
|
13
|
+
}
|
|
14
|
+
static getPerfectoAuthHeaders() {
|
|
15
|
+
return process.env['PERFECTO_AUTH_HEADERS']
|
|
16
|
+
? JSON.parse(process.env['PERFECTO_AUTH_HEADERS'])
|
|
17
|
+
: {};
|
|
18
|
+
}
|
|
19
|
+
static getExecutedByUserEmail() {
|
|
20
|
+
if (!process.env['EXECUTED_BY_USER_EMAIL']) {
|
|
21
|
+
throw new Error('Executed by user email is not set');
|
|
22
|
+
}
|
|
23
|
+
return process.env['EXECUTED_BY_USER_EMAIL'];
|
|
24
|
+
}
|
|
25
|
+
static getExecutionReportiumUrl() {
|
|
26
|
+
if (!process.env['EXECUTION_REPORTIUM_URL']) {
|
|
27
|
+
throw new Error('Reportium URL is not set');
|
|
28
|
+
}
|
|
29
|
+
return process.env['EXECUTION_REPORTIUM_URL'];
|
|
30
|
+
}
|
|
31
|
+
static setAppiumServer() {
|
|
32
|
+
return `https://${ConstantsHelper.getShortTenantId()}.perfectomobile.com/nexperience/perfectomobile/wd/hub`;
|
|
33
|
+
}
|
|
34
|
+
static getSecurityToken() {
|
|
35
|
+
if (!process.env['SECURITY_TOKEN']) {
|
|
36
|
+
throw new Error('Security token is not set');
|
|
37
|
+
}
|
|
38
|
+
return process.env['SECURITY_TOKEN'];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ConstantsHelper = ConstantsHelper;
|
|
42
|
+
ConstantsHelper.TENANT_ID_SUFFIX = '-perfectomobile-com';
|
|
43
|
+
//# sourceMappingURL=constants-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-helper.js","sourceRoot":"","sources":["../../../../../libs/execution-helpers-public/src/lib/constants-helper.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAG1B,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,OA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 -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomError = void 0;
|
|
4
|
+
class CustomError extends Error {
|
|
5
|
+
constructor(name, message, stack, scriptTimer) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = name || this.name;
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.stack = stack || this.stack;
|
|
10
|
+
this.scriptTimer = scriptTimer;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.CustomError = CustomError;
|
|
14
|
+
//# sourceMappingURL=custom-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-error.js","sourceRoot":"","sources":["../../../../../libs/execution-helpers-public/src/lib/custom-error.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAY,SAAQ,KAAK;IAGpC,YACE,IAAY,EACZ,OAAe,EACf,KAAc,EACd,WAAuB;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAfD,kCAeC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProcessedDataTable } from '../types/data-table';
|
|
2
|
+
import { Logger } from '../types/logger';
|
|
3
|
+
import { ScriptlessHelper } from '../types/scriptless-helper';
|
|
4
|
+
import { SecuredVariableHelper } from './secured-variable-helper';
|
|
5
|
+
export declare class DataTableHelper extends ScriptlessHelper {
|
|
6
|
+
private securedVariableHelper;
|
|
7
|
+
private handsetVariableHelper;
|
|
8
|
+
constructor(securedVariableHelper: SecuredVariableHelper, logger?: Logger);
|
|
9
|
+
generateTableData(dataTableKey: string): Promise<ProcessedDataTable>;
|
|
10
|
+
private processValue;
|
|
11
|
+
private processKey;
|
|
12
|
+
private replaceSecuredPrefix;
|
|
13
|
+
private isSecuredString;
|
|
14
|
+
private getDataTable;
|
|
15
|
+
private getDataTableUrl;
|
|
16
|
+
private getNativeAutomationServiceBaseUrl;
|
|
17
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTableHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const scriptless_helper_1 = require("../types/scriptless-helper");
|
|
7
|
+
const constants_helper_1 = require("./constants-helper");
|
|
8
|
+
const handset_variable_helper_1 = require("./handset-variable-helper");
|
|
9
|
+
class DataTableHelper extends scriptless_helper_1.ScriptlessHelper {
|
|
10
|
+
/*
|
|
11
|
+
* * IMPORTANT NOTE **
|
|
12
|
+
* The securedVariableHelper must always be taken as an argument to the constructor
|
|
13
|
+
* This is to ensure that the SecuredVariableInternalHelper is passed from execution-helpers (private).
|
|
14
|
+
*/
|
|
15
|
+
constructor(securedVariableHelper, logger) {
|
|
16
|
+
super(logger);
|
|
17
|
+
this.securedVariableHelper = securedVariableHelper;
|
|
18
|
+
this.handsetVariableHelper = new handset_variable_helper_1.HandsetVariableHelper(logger);
|
|
19
|
+
}
|
|
20
|
+
generateTableData(dataTableKey) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if (!dataTableKey) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const dataTable = yield this.getDataTable(dataTableKey, constants_helper_1.ConstantsHelper.getShortTenantId(), constants_helper_1.ConstantsHelper.getPerfectoAuthHeaders());
|
|
26
|
+
const processedDataTable = dataTable.elementsData.map((row) => {
|
|
27
|
+
const obj = {};
|
|
28
|
+
dataTable.columns.forEach((col, index) => {
|
|
29
|
+
obj[`${col.name}`] = {
|
|
30
|
+
'@type': col.type,
|
|
31
|
+
secured: this.isSecuredString(row[index]),
|
|
32
|
+
value: this.processValue(col.type, row[index]),
|
|
33
|
+
key: this.processKey(col.type, row[index])
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
return obj;
|
|
37
|
+
});
|
|
38
|
+
return processedDataTable;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
processValue(type, value) {
|
|
42
|
+
if (type === 'INTEGER') {
|
|
43
|
+
return Number(value);
|
|
44
|
+
}
|
|
45
|
+
else if (type === 'STRING') {
|
|
46
|
+
if (this.isSecuredString(value)) {
|
|
47
|
+
return this.securedVariableHelper.decryptSecuredString(this.replaceSecuredPrefix(value));
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
else if (type === 'HANDSET') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
processKey(type, value) {
|
|
57
|
+
if (type === 'HANDSET') {
|
|
58
|
+
return this.handsetVariableHelper.handsetKeyToDeviceCapability(value);
|
|
59
|
+
}
|
|
60
|
+
else if (type === 'STRING' && this.isSecuredString(value)) {
|
|
61
|
+
return this.replaceSecuredPrefix(value);
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
replaceSecuredPrefix(value) {
|
|
66
|
+
return value.replace('secured.', '');
|
|
67
|
+
}
|
|
68
|
+
isSecuredString(value) {
|
|
69
|
+
return value.startsWith('secured.');
|
|
70
|
+
}
|
|
71
|
+
getDataTable(dataTableKey, tenantName, authHeaders) {
|
|
72
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const dataTableApiUrl = `${this.getDataTableUrl(tenantName)}?itemKey=${encodeURIComponent(dataTableKey)}`;
|
|
74
|
+
const dataTableApiResponse = yield axios_1.default.get(dataTableApiUrl, {
|
|
75
|
+
headers: authHeaders
|
|
76
|
+
});
|
|
77
|
+
return dataTableApiResponse.data.dataTable;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
getDataTableUrl(tenantName) {
|
|
81
|
+
return `${this.getNativeAutomationServiceBaseUrl(tenantName)}/datatable`;
|
|
82
|
+
}
|
|
83
|
+
getNativeAutomationServiceBaseUrl(tenantName) {
|
|
84
|
+
return `https://${tenantName}.app.perfectomobile.com/native-automation-webapp/rest/v1/native-automation`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.DataTableHelper = DataTableHelper;
|
|
88
|
+
//# sourceMappingURL=data-table-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table-helper.js","sourceRoot":"","sources":["../../../../../libs/execution-helpers-public/src/lib/data-table-helper.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAO1B,kEAA8D;AAC9D,yDAAqD;AACrD,uEAAkE;AAGlE,MAAa,eAAgB,SAAQ,oCAAgB;IAGnD;;;;OAIG;IACH,YACU,qBAA4C,EACpD,MAAe;QAEf,KAAK,CAAC,MAAM,CAAC,CAAC;QAHN,0BAAqB,GAArB,qBAAqB,CAAuB;QAIpD,IAAI,CAAC,qBAAqB,GAAG,IAAI,+CAAqB,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IAEK,iBAAiB,CAAC,YAAoB;;YAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,SAAS,GAAoB,MAAM,IAAI,CAAC,YAAY,CACxD,YAAY,EACZ,kCAAe,CAAC,gBAAgB,EAAE,EAClC,kCAAe,CAAC,sBAAsB,EAAE,CACzC,CAAC;YAEF,MAAM,kBAAkB,GAAuB,SAAS,CAAC,YAAY,CAAC,GAAG,CACvE,CAAC,GAAG,EAAE,EAAE;gBACN,MAAM,GAAG,GAA0B,EAAE,CAAC;gBACtC,SAAS,CAAC,OAAO,CAAC,OAAO,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AI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5D,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO;IACT,CAAC;IAEO,oBAAoB,CAAC,KAAa;QACxC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAEO,eAAe,CAAC,KAAa;QACnC,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAEa,YAAY,CACxB,YAAoB,EACpB,UAAkB,EAClB,WAAmC;;YAEnC,MAAM,eAAe,GAAG,GAAG,IAAI,CAAC,eAAe,CAC7C,UAAU,CACX,YAAY,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;YAChD,MAAM,oBAAoB,GAAG,MAAM,eAAK,CAAC,GAAG,CAEzC,eAAe,EAAE;gBAClB,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;YACH,OAAO,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC;QAC7C,CAAC;KAAA;IAEO,eAAe,CAAC,UAAkB;QACxC,OAAO,GAAG,IAAI,CAAC,iCAAiC,CAAC,UAAU,CAAC,YAAY,CAAC;IAC3E,CAAC;IAEO,iCAAiC,CAAC,UAAkB;QAC1D,OAAO,WAAW,UAAU,4EAA4E,CAAC;IAC3G,CAAC;CACF;AApGD,0CAoGC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ScriptlessHelper } from '../types/scriptless-helper';
|
|
2
|
+
import { ChainablePromiseElement } from 'webdriverio';
|
|
3
|
+
export declare class ElementHelper extends ScriptlessHelper {
|
|
4
|
+
generateElementIdentifier(identifyBy: string | undefined, identifier: string): string;
|
|
5
|
+
getElementProperty(element: ChainablePromiseElement, property: string): Promise<string | number | boolean | undefined>;
|
|
6
|
+
private getText;
|
|
7
|
+
private getClass;
|
|
8
|
+
private getDisabled;
|
|
9
|
+
private getHeight;
|
|
10
|
+
private getWidth;
|
|
11
|
+
private getOpaque;
|
|
12
|
+
private getVisibility;
|
|
13
|
+
private getX;
|
|
14
|
+
private getY;
|
|
15
|
+
private getDisplayed;
|
|
16
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElementHelper = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const scriptless_helper_1 = require("../types/scriptless-helper");
|
|
6
|
+
class ElementHelper extends scriptless_helper_1.ScriptlessHelper {
|
|
7
|
+
generateElementIdentifier(identifyBy, identifier) {
|
|
8
|
+
let elementIdentifier;
|
|
9
|
+
if (identifyBy && identifyBy === 'name') {
|
|
10
|
+
elementIdentifier = `//*[@name=${identifier}]`;
|
|
11
|
+
}
|
|
12
|
+
else if (identifyBy && identifyBy === 'id') {
|
|
13
|
+
elementIdentifier = `id=${identifier}`;
|
|
14
|
+
}
|
|
15
|
+
else if (identifyBy && identifyBy === 'className') {
|
|
16
|
+
elementIdentifier = identifier;
|
|
17
|
+
}
|
|
18
|
+
else if (identifyBy && identifyBy === 'accessibilityId') {
|
|
19
|
+
elementIdentifier = `~${identifier}`;
|
|
20
|
+
}
|
|
21
|
+
else if (identifyBy && identifyBy === 'classChain') {
|
|
22
|
+
elementIdentifier = `-ios class chain:${identifier}`;
|
|
23
|
+
}
|
|
24
|
+
else if (identifyBy && identifyBy === 'uiAutomator') {
|
|
25
|
+
elementIdentifier = `android=${identifier}`;
|
|
26
|
+
}
|
|
27
|
+
else if (identifyBy && identifyBy === 'uiAutomation') {
|
|
28
|
+
elementIdentifier = `ios=${identifier}`;
|
|
29
|
+
}
|
|
30
|
+
else if (identifyBy && identifyBy === 'tagName') {
|
|
31
|
+
elementIdentifier = `<${identifier} />`;
|
|
32
|
+
}
|
|
33
|
+
else if (identifyBy && identifyBy === 'linkText') {
|
|
34
|
+
elementIdentifier = `=${identifier}`;
|
|
35
|
+
}
|
|
36
|
+
else if (identifyBy && identifyBy === 'partialLinkText') {
|
|
37
|
+
elementIdentifier = `*=${identifier}`;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
elementIdentifier = identifier;
|
|
41
|
+
}
|
|
42
|
+
return elementIdentifier;
|
|
43
|
+
}
|
|
44
|
+
getElementProperty(element, property) {
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (property === 'text') {
|
|
47
|
+
return yield this.getText(element);
|
|
48
|
+
}
|
|
49
|
+
else if (property === 'class') {
|
|
50
|
+
return yield this.getClass(element);
|
|
51
|
+
}
|
|
52
|
+
else if (property === 'disabled') {
|
|
53
|
+
return yield this.getDisabled(element);
|
|
54
|
+
}
|
|
55
|
+
else if (property === 'height') {
|
|
56
|
+
return yield this.getHeight(element);
|
|
57
|
+
}
|
|
58
|
+
else if (property === 'width') {
|
|
59
|
+
return yield this.getWidth(element);
|
|
60
|
+
}
|
|
61
|
+
else if (property === 'opaque') {
|
|
62
|
+
return yield this.getOpaque(element);
|
|
63
|
+
}
|
|
64
|
+
else if (property === 'visibility') {
|
|
65
|
+
return yield this.getVisibility(element);
|
|
66
|
+
}
|
|
67
|
+
else if (property === 'x') {
|
|
68
|
+
return yield this.getX(element);
|
|
69
|
+
}
|
|
70
|
+
else if (property === 'y') {
|
|
71
|
+
return yield this.getY(element);
|
|
72
|
+
}
|
|
73
|
+
else if (property === 'displayed') {
|
|
74
|
+
return yield this.getDisplayed(element);
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
getText(element) {
|
|
80
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
try {
|
|
82
|
+
const result = yield element.getText();
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
getClass(element) {
|
|
91
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
try {
|
|
93
|
+
const result = yield element.getAttribute('class');
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getDisabled(element) {
|
|
102
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
try {
|
|
104
|
+
const result = !(yield element.isEnabled());
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
getHeight(element) {
|
|
113
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
try {
|
|
115
|
+
const result = (yield element.getSize()).height;
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
getWidth(element) {
|
|
124
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
try {
|
|
126
|
+
const result = (yield element.getSize()).width;
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getOpaque(element) {
|
|
135
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
try {
|
|
137
|
+
const result = yield element.getAttribute('opacity');
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
getVisibility(element) {
|
|
146
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
try {
|
|
148
|
+
const result = yield element.isDisplayed();
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
getX(element) {
|
|
157
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
try {
|
|
159
|
+
const result = (yield element.getLocation()).x;
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
getY(element) {
|
|
168
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
try {
|
|
170
|
+
const result = (yield element.getLocation()).y;
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
getDisplayed(element) {
|
|
179
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
try {
|
|
181
|
+
const result = yield element.isDisplayed();
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.ElementHelper = ElementHelper;
|
|
191
|
+
//# sourceMappingURL=element-helper.js.map
|