@perforce-perfecto/scriptless-helpers 1.72.17 → 1.73.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/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './lib/secured-variable-helper';
|
|
|
24
24
|
export * from './lib/test-end-status-helper';
|
|
25
25
|
export * from './lib/text-helper';
|
|
26
26
|
export * from './lib/timer-helper';
|
|
27
|
+
export * from './lib/user-function-helper';
|
|
27
28
|
export * from './lib/touch-drag-helper';
|
|
28
29
|
export * from './lib/variable-attribute-checkpoint-helper';
|
|
29
30
|
export * from './lib/webdriver-session-helper';
|
package/src/index.js
CHANGED
|
@@ -27,6 +27,7 @@ tslib_1.__exportStar(require("./lib/secured-variable-helper"), exports);
|
|
|
27
27
|
tslib_1.__exportStar(require("./lib/test-end-status-helper"), exports);
|
|
28
28
|
tslib_1.__exportStar(require("./lib/text-helper"), exports);
|
|
29
29
|
tslib_1.__exportStar(require("./lib/timer-helper"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./lib/user-function-helper"), exports);
|
|
30
31
|
tslib_1.__exportStar(require("./lib/touch-drag-helper"), exports);
|
|
31
32
|
tslib_1.__exportStar(require("./lib/variable-attribute-checkpoint-helper"), exports);
|
|
32
33
|
tslib_1.__exportStar(require("./lib/webdriver-session-helper"), exports);
|
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,wEAA8C;AAC9C,qEAA2C;AAC3C,iEAAuC;AACvC,+DAAqC;AACrC,6DAAmC;AACnC,kEAAwC;AACxC,sEAA4C;AAC5C,qEAA2C;AAC3C,oEAA0C;AAC1C,sEAA4C;AAC5C,mEAAyC;AACzC,wEAA8C;AAC9C,oEAA0C;AAC1C,+DAAqC;AACrC,oEAA0C;AAC1C,6EAAmD;AACnD,+DAAqC;AACrC,iEAAuC;AACvC,+EAAqD;AACrD,kEAAwC;AACxC,8DAAoC;AACpC,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;AACrD,uEAA6C;AAC7C,gEAAsC;AACtC,kEAAwC"}
|
|
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,sEAA4C;AAC5C,qEAA2C;AAC3C,oEAA0C;AAC1C,sEAA4C;AAC5C,mEAAyC;AACzC,wEAA8C;AAC9C,oEAA0C;AAC1C,+DAAqC;AACrC,oEAA0C;AAC1C,6EAAmD;AACnD,+DAAqC;AACrC,iEAAuC;AACvC,+EAAqD;AACrD,kEAAwC;AACxC,8DAAoC;AACpC,mEAAyC;AACzC,wEAA8C;AAC9C,uEAA6C;AAC7C,4DAAkC;AAClC,6DAAmC;AACnC,qEAA2C;AAC3C,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;AACrD,uEAA6C;AAC7C,gEAAsC;AACtC,kEAAwC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ScriptlessHelper } from '../types/scriptless-helper';
|
|
2
|
+
type UserFunctionRule = {
|
|
3
|
+
conditions: Record<string, string>;
|
|
4
|
+
scriptKey: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class UserFunctionHelper extends ScriptlessHelper {
|
|
7
|
+
resolveScript(webdriverSession: {
|
|
8
|
+
capabilities: {
|
|
9
|
+
platform: string;
|
|
10
|
+
};
|
|
11
|
+
}, rules: UserFunctionRule[]): string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserFunctionHelper = void 0;
|
|
4
|
+
const scriptless_helper_1 = require("../types/scriptless-helper");
|
|
5
|
+
class UserFunctionHelper extends scriptless_helper_1.ScriptlessHelper {
|
|
6
|
+
resolveScript(webdriverSession, rules) {
|
|
7
|
+
const platform = JSON.parse(webdriverSession.capabilities.platform || '{}');
|
|
8
|
+
const mobileInfo = platform.mobileInfo || {};
|
|
9
|
+
const deviceProps = {
|
|
10
|
+
deviceId: platform.deviceId,
|
|
11
|
+
os: platform.os,
|
|
12
|
+
osVersion: platform.osVersion,
|
|
13
|
+
location: platform.location,
|
|
14
|
+
manufacturer: mobileInfo.manufacturer,
|
|
15
|
+
model: mobileInfo.model
|
|
16
|
+
};
|
|
17
|
+
let resolvedScript;
|
|
18
|
+
for (const rule of rules) {
|
|
19
|
+
const ruleMatches = Object.entries(rule.conditions).every(([col, val]) => {
|
|
20
|
+
if (!val)
|
|
21
|
+
return true;
|
|
22
|
+
const deviceVal = deviceProps[col];
|
|
23
|
+
if (deviceVal == null)
|
|
24
|
+
return true;
|
|
25
|
+
return typeof deviceVal === 'string' && typeof val === 'string'
|
|
26
|
+
? deviceVal.toLowerCase() === val.toLowerCase()
|
|
27
|
+
: deviceVal === val;
|
|
28
|
+
});
|
|
29
|
+
if (ruleMatches) {
|
|
30
|
+
resolvedScript = rule.scriptKey;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!resolvedScript) {
|
|
35
|
+
throw new Error('No matching user function rule found for the current device.');
|
|
36
|
+
}
|
|
37
|
+
return resolvedScript;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.UserFunctionHelper = UserFunctionHelper;
|
|
41
|
+
//# sourceMappingURL=user-function-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-function-helper.js","sourceRoot":"","sources":["../../../../../libs/execution-helpers-public/src/lib/user-function-helper.ts"],"names":[],"mappings":";;;AAAA,kEAA8D;AAO9D,MAAa,kBAAmB,SAAQ,oCAAgB;IACtD,aAAa,CACX,gBAAwD,EACxD,KAAyB;QAEzB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7C,MAAM,WAAW,GAA4B;YAC3C,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,YAAY,EAAE,UAAU,CAAC,YAAY;YACrC,KAAK,EAAE,UAAU,CAAC,KAAK;SACxB,CAAC;QAEF,IAAI,cAAkC,CAAC;QACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CACvD,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;gBACb,IAAI,CAAC,GAAG;oBAAE,OAAO,IAAI,CAAC;gBACtB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;gBACnC,IAAI,SAAS,IAAI,IAAI;oBAAE,OAAO,IAAI,CAAC;gBACnC,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ;oBAC7D,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE;oBAC/C,CAAC,CAAC,SAAS,KAAK,GAAG,CAAC;YACxB,CAAC,CACF,CAAC;YACF,IAAI,WAAW,EAAE,CAAC;gBAChB,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;gBAChC,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;QACJ,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AAxCD,gDAwCC"}
|