@sap_oss/wdio-qmate-service 2.9.8 → 2.10.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/CONTRIBUTING.md +34 -0
- package/docs/doc.md +417 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/reuse/helper/elementResolving.js +1 -2
- package/lib/reuse/helper/elementResolving.js.map +1 -1
- package/lib/reuse/helper/inputValidation.js +1 -2
- package/lib/reuse/helper/inputValidation.js.map +1 -1
- package/lib/reuse/index.js +17 -0
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/mobile/Mobile.d.ts +16 -0
- package/lib/reuse/modules/mobile/Mobile.js +25 -0
- package/lib/reuse/modules/mobile/Mobile.js.map +1 -0
- package/lib/reuse/modules/mobile/android.d.ts +29 -0
- package/lib/reuse/modules/mobile/android.js +84 -0
- package/lib/reuse/modules/mobile/android.js.map +1 -0
- package/lib/reuse/modules/mobile/device.d.ts +29 -0
- package/lib/reuse/modules/mobile/device.js +63 -0
- package/lib/reuse/modules/mobile/device.js.map +1 -0
- package/lib/reuse/modules/mobile/element.d.ts +76 -0
- package/lib/reuse/modules/mobile/element.js +132 -0
- package/lib/reuse/modules/mobile/element.js.map +1 -0
- package/lib/reuse/modules/mobile/gestures.d.ts +22 -0
- package/lib/reuse/modules/mobile/gestures.js +46 -0
- package/lib/reuse/modules/mobile/gestures.js.map +1 -0
- package/lib/reuse/modules/mobile/ios.d.ts +10 -0
- package/lib/reuse/modules/mobile/ios.js +21 -0
- package/lib/reuse/modules/mobile/ios.js.map +1 -0
- package/lib/reuse/modules/mobile/userInteraction.d.ts +28 -0
- package/lib/reuse/modules/mobile/userInteraction.js +75 -0
- package/lib/reuse/modules/mobile/userInteraction.js.map +1 -0
- package/lib/reuse/modules/util/Util.d.ts +1 -1
- package/lib/reuse/modules/util/browser.d.ts +24 -0
- package/lib/reuse/modules/util/browser.js +36 -0
- package/lib/reuse/modules/util/browser.js.map +1 -1
- package/lib/reuse/modules/util/data.d.ts +2 -2
- package/lib/reuse/modules/util/data.js +1 -1
- package/lib/reuse/modules/util/data.js.map +1 -1
- package/lib/reuse/modules/util/file.d.ts +0 -1
- package/lib/reuse/runner/runner.js +1 -2
- package/lib/reuse/runner/runner.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchange.js +48 -31
- package/lib/scripts/dataExchange/dataExchange.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchangeUtil.d.ts +3 -3
- package/lib/scripts/dataExchange/dataExchangeUtil.js +10 -10
- package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -1
- package/lib/scripts/hooks/after.js +1 -1
- package/lib/scripts/hooks/after.js.map +1 -1
- package/lib/scripts/hooks/before.js +1 -1
- package/lib/scripts/hooks/before.js.map +1 -1
- package/lib/scripts/hooks/beforeSession.js +2 -2
- package/lib/scripts/hooks/beforeSession.js.map +1 -1
- package/lib/scripts/hooks/onComplete.js +1 -1
- package/lib/scripts/hooks/onComplete.js.map +1 -1
- package/lib/scripts/hooks/onPrepare.js +1 -1
- package/lib/scripts/hooks/onPrepare.js.map +1 -1
- package/lib/scripts/hooks/utils/isBrowserDefined.d.ts +1 -0
- package/lib/scripts/hooks/utils/isBrowserDefined.js +7 -0
- package/lib/scripts/hooks/utils/isBrowserDefined.js.map +1 -0
- package/package.json +11 -4
- package/test/helper/configurations/mobile.conf.js +16 -0
- package/test/watchMode/config.js +18 -0
- package/test/watchMode/navigateToUrlAndClick.spec.js +16 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type KeyName = "back" | "home" | "volumeUp" | "volumeDown" | "VolumeMute" | "power" | "enter" | "space" | "delete" | "menu" | "search" | "camera" | "focus" | "notification" | "call" | "calendar" | "recent" | "settings";
|
|
2
|
+
/**
|
|
3
|
+
* @class android
|
|
4
|
+
* @memberof mobile
|
|
5
|
+
*/
|
|
6
|
+
export declare class Android {
|
|
7
|
+
private vlf;
|
|
8
|
+
private ErrorHandler;
|
|
9
|
+
/**
|
|
10
|
+
* @function pressKeyByName
|
|
11
|
+
* @memberof mobile.android
|
|
12
|
+
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
13
|
+
* @param {string} keyName - The name of the key (e.g., "back", "home", "volumeUp", etc.)
|
|
14
|
+
* @example await mobile.device.pressKeyByName("back");
|
|
15
|
+
* @example await mobile.device.pressKeyByName("home");
|
|
16
|
+
*/
|
|
17
|
+
pressKeyByName(keyName: KeyName): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* @function pressKeyByCode
|
|
20
|
+
* @memberof mobile.android
|
|
21
|
+
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
22
|
+
* @param {string} keyCode - The code of the key (e.g., 4 (back), 3 (home) , etc.)
|
|
23
|
+
* @example await mobile.android.pressKeyByCode(4);
|
|
24
|
+
* @see https://developer.android.com/reference/android/view/KeyEvent
|
|
25
|
+
*/
|
|
26
|
+
pressKeyByCode(keyCode: number): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
declare const _default: Android;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Android = void 0;
|
|
7
|
+
// Imports
|
|
8
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
9
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
10
|
+
/**
|
|
11
|
+
* @class android
|
|
12
|
+
* @memberof mobile
|
|
13
|
+
*/
|
|
14
|
+
class Android {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "android");
|
|
17
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @function pressKeyByName
|
|
21
|
+
* @memberof mobile.android
|
|
22
|
+
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
23
|
+
* @param {string} keyName - The name of the key (e.g., "back", "home", "volumeUp", etc.)
|
|
24
|
+
* @example await mobile.device.pressKeyByName("back");
|
|
25
|
+
* @example await mobile.device.pressKeyByName("home");
|
|
26
|
+
*/
|
|
27
|
+
async pressKeyByName(keyName) {
|
|
28
|
+
const vl = this.vlf.initLog(this.pressKeyByName);
|
|
29
|
+
const keyCodeMap = {
|
|
30
|
+
back: 4,
|
|
31
|
+
home: 3,
|
|
32
|
+
volumeUp: 24,
|
|
33
|
+
volumeDown: 25,
|
|
34
|
+
VolumeMute: 164,
|
|
35
|
+
power: 26,
|
|
36
|
+
enter: 66,
|
|
37
|
+
space: 62,
|
|
38
|
+
delete: 67,
|
|
39
|
+
menu: 82,
|
|
40
|
+
search: 84,
|
|
41
|
+
camera: 27,
|
|
42
|
+
focus: 80,
|
|
43
|
+
notification: 83,
|
|
44
|
+
call: 5,
|
|
45
|
+
calendar: 208,
|
|
46
|
+
recent: 312,
|
|
47
|
+
settings: 176
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const keyCode = keyCodeMap[keyName.toLowerCase()];
|
|
51
|
+
if (keyCode !== undefined) {
|
|
52
|
+
vl.log(`Pressing key: ${keyName} (code: ${keyCode})`);
|
|
53
|
+
await browser.pressKeyCode(keyCode);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw new Error(`Key code for "${keyName}" not found.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return this.ErrorHandler.logException(error, "Error: During pressKeyByName in Android", true);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @function pressKeyByCode
|
|
65
|
+
* @memberof mobile.android
|
|
66
|
+
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
67
|
+
* @param {string} keyCode - The code of the key (e.g., 4 (back), 3 (home) , etc.)
|
|
68
|
+
* @example await mobile.android.pressKeyByCode(4);
|
|
69
|
+
* @see https://developer.android.com/reference/android/view/KeyEvent
|
|
70
|
+
*/
|
|
71
|
+
async pressKeyByCode(keyCode) {
|
|
72
|
+
const vl = this.vlf.initLog(this.pressKeyByCode);
|
|
73
|
+
try {
|
|
74
|
+
vl.log(`Pressing key by code: ${keyCode}`);
|
|
75
|
+
await browser.pressKeyCode(keyCode);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return this.ErrorHandler.logException(error, "Error: During pressKeyByCode in Android", true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.Android = Android;
|
|
83
|
+
exports.default = new Android();
|
|
84
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/android.ts"],"names":[],"mappings":";;;;;;AAAA,UAAU;AACV,8DAAkE;AAClE,6EAAqD;AAKrD;;;GAGG;AACH,MAAa,OAAO;IAApB;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACpD,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAgE5C,CAAC;IA9DC;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAAC,OAAgB;QACnC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEjD,MAAM,UAAU,GAA8B;YAC5C,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,GAAG;YACf,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,E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,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class device
|
|
3
|
+
* @memberof mobile
|
|
4
|
+
*/
|
|
5
|
+
export declare class Device {
|
|
6
|
+
private vlf;
|
|
7
|
+
private ErrorHandler;
|
|
8
|
+
/**
|
|
9
|
+
* @function isAppInstalled
|
|
10
|
+
* @memberof mobile.device
|
|
11
|
+
* @description Check wether given package/bundle app is installed or not in the device.
|
|
12
|
+
* @param {string} packageIdOrBundleId - Android package Id, or iOS bundle Id.
|
|
13
|
+
* @returns {boolean} Returns true if specified app package/bundled installed in the device, or false.
|
|
14
|
+
* @example await mobile.device.isAppInstalled("com.google.android.apps.maps");
|
|
15
|
+
*/
|
|
16
|
+
isAppInstalled(packageIdOrBundleId: string): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* @function installApp
|
|
19
|
+
* @memberof mobile.device
|
|
20
|
+
* @description Install the appropriate app based on the platform the test is being executed on.
|
|
21
|
+
* @param {string} appPath - Path of the app(.apk, .ipa)
|
|
22
|
+
* @example
|
|
23
|
+
* await mobile.device.installApp("/path/to/your/app.apk");
|
|
24
|
+
* await mobile.device.installApp("/path/to/your/app.ipa");
|
|
25
|
+
*/
|
|
26
|
+
installApp(appPath: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
declare const _default: Device;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Device = void 0;
|
|
7
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
9
|
+
/**
|
|
10
|
+
* @class device
|
|
11
|
+
* @memberof mobile
|
|
12
|
+
*/
|
|
13
|
+
class Device {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "device");
|
|
16
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @function isAppInstalled
|
|
20
|
+
* @memberof mobile.device
|
|
21
|
+
* @description Check wether given package/bundle app is installed or not in the device.
|
|
22
|
+
* @param {string} packageIdOrBundleId - Android package Id, or iOS bundle Id.
|
|
23
|
+
* @returns {boolean} Returns true if specified app package/bundled installed in the device, or false.
|
|
24
|
+
* @example await mobile.device.isAppInstalled("com.google.android.apps.maps");
|
|
25
|
+
*/
|
|
26
|
+
async isAppInstalled(packageIdOrBundleId) {
|
|
27
|
+
const vl = this.vlf.initLog(this.isAppInstalled);
|
|
28
|
+
try {
|
|
29
|
+
const isAppInstalledInDevice = browser.isAppInstalled(packageIdOrBundleId);
|
|
30
|
+
vl.log(`Given app package/bundle id ${packageIdOrBundleId} installed on the device is ${isAppInstalledInDevice.toString()}`);
|
|
31
|
+
return isAppInstalledInDevice;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return this.ErrorHandler.logException(error, "Error: During isAppInstalled", true);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @function installApp
|
|
39
|
+
* @memberof mobile.device
|
|
40
|
+
* @description Install the appropriate app based on the platform the test is being executed on.
|
|
41
|
+
* @param {string} appPath - Path of the app(.apk, .ipa)
|
|
42
|
+
* @example
|
|
43
|
+
* await mobile.device.installApp("/path/to/your/app.apk");
|
|
44
|
+
* await mobile.device.installApp("/path/to/your/app.ipa");
|
|
45
|
+
*/
|
|
46
|
+
async installApp(appPath) {
|
|
47
|
+
const vl = this.vlf.initLog(this.installApp);
|
|
48
|
+
const platform = await browser.capabilities.platformName;
|
|
49
|
+
try {
|
|
50
|
+
vl.log(`Installing ${platform.toLowerCase()} app...`);
|
|
51
|
+
if (["android", "ios"].includes(platform.toLowerCase().trim())) {
|
|
52
|
+
await browser.installApp(appPath);
|
|
53
|
+
vl.log(`${platform.toLowerCase()} app installed successfully.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.ErrorHandler.logException(error, `Error: Unsupported platform while installing the app: ${platform.toLowerCase().trim()}`, true);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.Device = Device;
|
|
62
|
+
exports.default = new Device();
|
|
63
|
+
//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/device.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,MAAM;IAAnB;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnD,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IA2C5C,CAAC;IAzCC;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAAC,mBAA2B;QAC9C,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,sBAAsB,GAAY,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;YACpF,EAAE,CAAC,GAAG,CAAC,+BAA+B,mBAAmB,+BAA+B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC7H,OAAO,sBAAsB,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,8BAA8B,EAAE,IAAI,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAW,MAAM,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC;QACjE,IAAI,CAAC;YACH,EAAE,CAAC,GAAG,CAAC,cAAc,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC/D,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAClC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,8BAA8B,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,yDAAyD,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QACxI,CAAC;IACH,CAAC;CACF;AA7CD,wBA6CC;AACD,kBAAe,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Element } from "../../../../@types/wdio";
|
|
2
|
+
/**
|
|
3
|
+
* @class element
|
|
4
|
+
* @memberof mobile
|
|
5
|
+
*/
|
|
6
|
+
export declare class ElementModule {
|
|
7
|
+
private vlf;
|
|
8
|
+
private ErrorHandler;
|
|
9
|
+
/**
|
|
10
|
+
* @function isVisible
|
|
11
|
+
* @memberof mobile.element
|
|
12
|
+
* @description Returns a boolean if the mobile element is visible to the user.
|
|
13
|
+
* @param {Object} element - The Mobile Ui element.
|
|
14
|
+
* @param {Boolean} [strict=true] - If strict mode is enabled it will only return "true" if the element is visible on the mobile view and within the viewport.
|
|
15
|
+
* If "false", it will be sufficient if the element is visible on the view but not inside the current viewport.
|
|
16
|
+
* @returns {Boolean} Returns true or false.
|
|
17
|
+
* @example const elem = await mobile.element.isVisible("button01");
|
|
18
|
+
* await mobile.element.isVisible(elem);
|
|
19
|
+
*/
|
|
20
|
+
isVisible(element: Element, strict?: boolean): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* @function isPresent
|
|
23
|
+
* @memberof mobile.element
|
|
24
|
+
* @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
|
|
25
|
+
* @param {Object} elem - The element.
|
|
26
|
+
* @returns {Boolean} Returns true or false.
|
|
27
|
+
* @example
|
|
28
|
+
* await mobile.element.isPresent(elem);
|
|
29
|
+
*/
|
|
30
|
+
isPresent(element: Element): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* @function waitToBePresent
|
|
33
|
+
* @memberof mobile.element
|
|
34
|
+
* @description Waits until the element with the given selector is present.
|
|
35
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
36
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
37
|
+
* @example await mobile.element.waitToBePresent(".input01");
|
|
38
|
+
* @example await mobile.element.waitToBePresent("#button12");
|
|
39
|
+
* @example await mobile.element.waitToBePresent("p:first-child");
|
|
40
|
+
*/
|
|
41
|
+
waitToBePresent(selector: any, timeout?: number): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* @function waitToBeVisible
|
|
44
|
+
* @memberof mobile.element
|
|
45
|
+
* @description Waits until the element with the given selector is visible.
|
|
46
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
47
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
48
|
+
* @example await mobile.element.waitToBeVisible(".input01");
|
|
49
|
+
* @example await mobile.element.waitToBeVisible("#button12");
|
|
50
|
+
* @example await mobile.element.waitToBeVisible("p:first-child");
|
|
51
|
+
*/
|
|
52
|
+
waitToBeVisible(selector: any, timeout?: number): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* @function waitToBeClickable
|
|
55
|
+
* @memberof mobile.element
|
|
56
|
+
* @description Waits until the element with the given selector is clickable.
|
|
57
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
58
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
59
|
+
* @example await mobile.element.waitToBeClickable(".input01");
|
|
60
|
+
* @example await mobile.element.waitToBeClickable("#button12");
|
|
61
|
+
* @example await mobile.element.waitToBeClickable("p:first-child");
|
|
62
|
+
*/
|
|
63
|
+
waitToBeClickable(selector: any, timeout?: number): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* @function isSelected
|
|
66
|
+
* @memberof mobile.element
|
|
67
|
+
* @description Returns a boolean if the element (e.g. checkbox) is selected.
|
|
68
|
+
* @param {Object} elem - The element.
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
* @example const elem = await mobile.element.getById("elem01");
|
|
71
|
+
* const isSelected = await mobile.element.isSelected(elem);
|
|
72
|
+
*/
|
|
73
|
+
isSelected(elem: Element): Promise<boolean>;
|
|
74
|
+
}
|
|
75
|
+
declare const _default: ElementModule;
|
|
76
|
+
export default _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ElementModule = void 0;
|
|
7
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
9
|
+
/**
|
|
10
|
+
* @class element
|
|
11
|
+
* @memberof mobile
|
|
12
|
+
*/
|
|
13
|
+
class ElementModule {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "element");
|
|
16
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @function isVisible
|
|
20
|
+
* @memberof mobile.element
|
|
21
|
+
* @description Returns a boolean if the mobile element is visible to the user.
|
|
22
|
+
* @param {Object} element - The Mobile Ui element.
|
|
23
|
+
* @param {Boolean} [strict=true] - If strict mode is enabled it will only return "true" if the element is visible on the mobile view and within the viewport.
|
|
24
|
+
* If "false", it will be sufficient if the element is visible on the view but not inside the current viewport.
|
|
25
|
+
* @returns {Boolean} Returns true or false.
|
|
26
|
+
* @example const elem = await mobile.element.isVisible("button01");
|
|
27
|
+
* await mobile.element.isVisible(elem);
|
|
28
|
+
*/
|
|
29
|
+
async isVisible(element, strict = true) {
|
|
30
|
+
const vl = this.vlf.initLog(this.isVisible);
|
|
31
|
+
try {
|
|
32
|
+
if (strict) {
|
|
33
|
+
return element.isDisplayedInViewport();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return element.isDisplayed();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return this.ErrorHandler.logException(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @function isPresent
|
|
45
|
+
* @memberof mobile.element
|
|
46
|
+
* @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
|
|
47
|
+
* @param {Object} elem - The element.
|
|
48
|
+
* @returns {Boolean} Returns true or false.
|
|
49
|
+
* @example
|
|
50
|
+
* await mobile.element.isPresent(elem);
|
|
51
|
+
*/
|
|
52
|
+
async isPresent(element) {
|
|
53
|
+
const vl = this.vlf.initLog(this.isPresent);
|
|
54
|
+
return element.isExisting();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @function waitToBePresent
|
|
58
|
+
* @memberof mobile.element
|
|
59
|
+
* @description Waits until the element with the given selector is present.
|
|
60
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
61
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
62
|
+
* @example await mobile.element.waitToBePresent(".input01");
|
|
63
|
+
* @example await mobile.element.waitToBePresent("#button12");
|
|
64
|
+
* @example await mobile.element.waitToBePresent("p:first-child");
|
|
65
|
+
*/
|
|
66
|
+
async waitToBePresent(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
|
|
67
|
+
const vl = this.vlf.initLog(this.waitToBePresent);
|
|
68
|
+
try {
|
|
69
|
+
vl.log(`wdio.waitForExist invocation for selector ${selector}`);
|
|
70
|
+
await $(selector).waitForExist({ timeout: timeout });
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
this.ErrorHandler.logException(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @function waitToBeVisible
|
|
78
|
+
* @memberof mobile.element
|
|
79
|
+
* @description Waits until the element with the given selector is visible.
|
|
80
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
81
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
82
|
+
* @example await mobile.element.waitToBeVisible(".input01");
|
|
83
|
+
* @example await mobile.element.waitToBeVisible("#button12");
|
|
84
|
+
* @example await mobile.element.waitToBeVisible("p:first-child");
|
|
85
|
+
*/
|
|
86
|
+
async waitToBeVisible(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
|
|
87
|
+
const vl = this.vlf.initLog(this.waitToBeVisible);
|
|
88
|
+
try {
|
|
89
|
+
vl.log(`wdio.waitForDisplayed invocation for selector ${selector}`);
|
|
90
|
+
await $(selector).waitForDisplayed({ timeout: timeout });
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.ErrorHandler.logException(error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @function waitToBeClickable
|
|
98
|
+
* @memberof mobile.element
|
|
99
|
+
* @description Waits until the element with the given selector is clickable.
|
|
100
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
101
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
102
|
+
* @example await mobile.element.waitToBeClickable(".input01");
|
|
103
|
+
* @example await mobile.element.waitToBeClickable("#button12");
|
|
104
|
+
* @example await mobile.element.waitToBeClickable("p:first-child");
|
|
105
|
+
*/
|
|
106
|
+
async waitToBeClickable(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
|
|
107
|
+
const vl = this.vlf.initLog(this.waitToBeClickable);
|
|
108
|
+
try {
|
|
109
|
+
vl.log(`wdio.waitForClickable invocation for selector ${selector}`);
|
|
110
|
+
await $(selector).waitForClickable({ timeout: timeout });
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.ErrorHandler.logException(error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @function isSelected
|
|
118
|
+
* @memberof mobile.element
|
|
119
|
+
* @description Returns a boolean if the element (e.g. checkbox) is selected.
|
|
120
|
+
* @param {Object} elem - The element.
|
|
121
|
+
* @returns {boolean}
|
|
122
|
+
* @example const elem = await mobile.element.getById("elem01");
|
|
123
|
+
* const isSelected = await mobile.element.isSelected(elem);
|
|
124
|
+
*/
|
|
125
|
+
async isSelected(elem) {
|
|
126
|
+
const vl = this.vlf.initLog(this.isSelected);
|
|
127
|
+
return elem.isSelected();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.ElementModule = ElementModule;
|
|
131
|
+
exports.default = new ElementModule();
|
|
132
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/element.ts"],"names":[],"mappings":";;;;;;AACA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,aAAa;IAA1B;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,E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AC,UAAU,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAnHD,sCAmHC;AACD,kBAAe,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class gestures
|
|
3
|
+
* @memberof mobile
|
|
4
|
+
*/
|
|
5
|
+
export declare class Gestures {
|
|
6
|
+
private vlf;
|
|
7
|
+
private ErrorHandler;
|
|
8
|
+
/**
|
|
9
|
+
* @function swipe
|
|
10
|
+
* @memberof mobile.gestures
|
|
11
|
+
* @description Swipe from one point to another on the screen.
|
|
12
|
+
* @param {number} startX - The starting X coordinate of the swipe
|
|
13
|
+
* @param {number} startY - The starting Y coordinate of the swipe
|
|
14
|
+
* @param {number} endX - The ending X coordinate of the swipe
|
|
15
|
+
* @param {number} endY - The ending Y coordinate of the swipe
|
|
16
|
+
* @param {number} duration - The duration of the swipe in milliseconds (optional, default is 1000ms)
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
*/
|
|
19
|
+
swipe(startX: number, startY: number, endX: number, endY: number, duration?: number): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: Gestures;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Gestures = void 0;
|
|
7
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
9
|
+
/**
|
|
10
|
+
* @class gestures
|
|
11
|
+
* @memberof mobile
|
|
12
|
+
*/
|
|
13
|
+
class Gestures {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "gestures");
|
|
16
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @function swipe
|
|
20
|
+
* @memberof mobile.gestures
|
|
21
|
+
* @description Swipe from one point to another on the screen.
|
|
22
|
+
* @param {number} startX - The starting X coordinate of the swipe
|
|
23
|
+
* @param {number} startY - The starting Y coordinate of the swipe
|
|
24
|
+
* @param {number} endX - The ending X coordinate of the swipe
|
|
25
|
+
* @param {number} endY - The ending Y coordinate of the swipe
|
|
26
|
+
* @param {number} duration - The duration of the swipe in milliseconds (optional, default is 1000ms)
|
|
27
|
+
* @returns {Promise<void>}
|
|
28
|
+
*/
|
|
29
|
+
async swipe(startX, startY, endX, endY, duration = 1000) {
|
|
30
|
+
const vl = this.vlf.initLog(this.swipe);
|
|
31
|
+
try {
|
|
32
|
+
await browser.touchPerform([
|
|
33
|
+
{ action: "press", options: { x: startX, y: startY } },
|
|
34
|
+
{ action: "wait", options: { ms: duration } }, // Wait for the duration of the swipe
|
|
35
|
+
{ action: "moveTo", options: { x: endX, y: endY } },
|
|
36
|
+
{ action: "release" }
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.ErrorHandler.logException(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Gestures = Gestures;
|
|
45
|
+
exports.default = new Gestures();
|
|
46
|
+
//# sourceMappingURL=gestures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/gestures.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,QAAQ;IAArB;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACrD,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IA0B5C,CAAC;IAxBC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAAc,EAAE,IAAY,EAAE,IAAY,EAAE,WAAmB,IAAI;QAC7F,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,YAAY,CAAC;gBACzB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE;gBACtD,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,qCAAqC;gBACpF,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;gBACnD,EAAE,MAAM,EAAE,SAAS,EAAE;aACtB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AA5BD,4BA4BC;AACD,kBAAe,IAAI,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Ios = void 0;
|
|
7
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
9
|
+
/**
|
|
10
|
+
* @class ios
|
|
11
|
+
* @memberof mobile
|
|
12
|
+
*/
|
|
13
|
+
class Ios {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "ios");
|
|
16
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Ios = Ios;
|
|
20
|
+
exports.default = new Ios();
|
|
21
|
+
//# sourceMappingURL=ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/ios.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,GAAG;IAAhB;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChD,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAC5C,CAAC;CAAA;AAHD,kBAGC;AACD,kBAAe,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Element } from "../../../../@types/wdio";
|
|
2
|
+
/**
|
|
3
|
+
* @class userInteraction
|
|
4
|
+
* @memberof mobile
|
|
5
|
+
*/
|
|
6
|
+
export declare class UserInteraction {
|
|
7
|
+
private vlf;
|
|
8
|
+
private ErrorHandler;
|
|
9
|
+
/**
|
|
10
|
+
* @function tap
|
|
11
|
+
* @memberof mobile.userInteraction
|
|
12
|
+
* @description Tap's on the mobile element.
|
|
13
|
+
* @param {Element | string} element - The element or CSS selector describing the element.
|
|
14
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
15
|
+
* @example const elem = await mobile.userInteraction.tap(elem);
|
|
16
|
+
*/
|
|
17
|
+
tap(element: Element, timeout?: number): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* @function check
|
|
20
|
+
* @memberof mobile.userInteraction
|
|
21
|
+
* @description Checks the given checkbox.
|
|
22
|
+
* @param {Element} element - The element or CSS selector describing the element.
|
|
23
|
+
* @example await mobile.userInteraction.check(selector);
|
|
24
|
+
*/
|
|
25
|
+
check(element: Element): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
declare const _default: UserInteraction;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UserInteraction = void 0;
|
|
7
|
+
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
|
+
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
9
|
+
/**
|
|
10
|
+
* @class userInteraction
|
|
11
|
+
* @memberof mobile
|
|
12
|
+
*/
|
|
13
|
+
class UserInteraction {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "UserInteraction");
|
|
16
|
+
this.ErrorHandler = new errorHandler_1.default();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @function tap
|
|
20
|
+
* @memberof mobile.userInteraction
|
|
21
|
+
* @description Tap's on the mobile element.
|
|
22
|
+
* @param {Element | string} element - The element or CSS selector describing the element.
|
|
23
|
+
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
24
|
+
* @example const elem = await mobile.userInteraction.tap(elem);
|
|
25
|
+
*/
|
|
26
|
+
async tap(element, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
|
|
27
|
+
const vl = this.vlf.initLog(this.tap);
|
|
28
|
+
try {
|
|
29
|
+
vl.log("Expecting element to be displayed and enabled");
|
|
30
|
+
await Promise.all([
|
|
31
|
+
expect(element).toBeDisplayed({
|
|
32
|
+
wait: timeout,
|
|
33
|
+
interval: 100,
|
|
34
|
+
message: `Timeout '${+timeout / 1000}s' by waiting for element is displayed.`
|
|
35
|
+
}),
|
|
36
|
+
expect(element).toBeEnabled({
|
|
37
|
+
wait: timeout,
|
|
38
|
+
interval: 100,
|
|
39
|
+
message: `Timeout '${+timeout / 1000}s' by waiting for element is enabled.`
|
|
40
|
+
})
|
|
41
|
+
]);
|
|
42
|
+
vl.log("Clicking the element");
|
|
43
|
+
await element.click();
|
|
44
|
+
vl.log("Given element is successfully taped on the mobile Ui");
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.ErrorHandler.logException(error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @function check
|
|
52
|
+
* @memberof mobile.userInteraction
|
|
53
|
+
* @description Checks the given checkbox.
|
|
54
|
+
* @param {Element} element - The element or CSS selector describing the element.
|
|
55
|
+
* @example await mobile.userInteraction.check(selector);
|
|
56
|
+
*/
|
|
57
|
+
async check(element) {
|
|
58
|
+
const vl = this.vlf.initLog(this.check);
|
|
59
|
+
try {
|
|
60
|
+
const isSelected = await mobile.element.isSelected(element);
|
|
61
|
+
if (!isSelected) {
|
|
62
|
+
await this.tap(element);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
vl.log("Checkbox already selected.");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.ErrorHandler.logException(error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.UserInteraction = UserInteraction;
|
|
74
|
+
exports.default = new UserInteraction();
|
|
75
|
+
//# sourceMappingURL=userInteraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userInteraction.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/userInteraction.ts"],"names":[],"mappings":";;;;;;AACA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,eAAe;IAA5B;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAC5D,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