@sap_oss/wdio-qmate-service 2.13.1 → 2.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/sections/features/selectors.md +8 -8
- package/lib/reuse/helper/elementResolving.d.ts +1 -0
- package/lib/reuse/helper/elementResolving.js +12 -0
- package/lib/reuse/helper/elementResolving.js.map +1 -1
- package/lib/reuse/modules/mobile/device.d.ts +160 -4
- package/lib/reuse/modules/mobile/device.js +367 -13
- package/lib/reuse/modules/mobile/device.js.map +1 -1
- package/lib/reuse/modules/mobile/element.d.ts +44 -25
- package/lib/reuse/modules/mobile/element.js +80 -26
- package/lib/reuse/modules/mobile/element.js.map +1 -1
- package/lib/reuse/modules/mobile/userInteraction.d.ts +73 -7
- package/lib/reuse/modules/mobile/userInteraction.js +159 -23
- package/lib/reuse/modules/mobile/userInteraction.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Device = void 0;
|
|
7
|
+
// Imports
|
|
7
8
|
const verboseLogger_1 = require("../../helper/verboseLogger");
|
|
8
9
|
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
|
|
10
|
+
const ORIENTATION = {
|
|
11
|
+
LANDSCAPE: "LANDSCAPE",
|
|
12
|
+
PORTRAIT: "PORTRAIT",
|
|
13
|
+
UNKNOWN: "UNKNOWN"
|
|
14
|
+
};
|
|
9
15
|
/**
|
|
10
16
|
* @class device
|
|
11
17
|
* @memberof mobile
|
|
@@ -15,47 +21,395 @@ class Device {
|
|
|
15
21
|
this.vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "device");
|
|
16
22
|
this.ErrorHandler = new errorHandler_1.default();
|
|
17
23
|
}
|
|
24
|
+
//==================================Private Methods===============================================
|
|
25
|
+
/**
|
|
26
|
+
* @function isValidPlatform
|
|
27
|
+
* @memberof mobile.device
|
|
28
|
+
* @description Check the mobile platform from the session's capabilities.
|
|
29
|
+
* @returns {boolean} Returns 'true' if the platform in the session's capabilities is either Android or iOS.
|
|
30
|
+
*/
|
|
31
|
+
async isValidPlatform() {
|
|
32
|
+
const vl = this.vlf.initLog(this.isValidPlatform);
|
|
33
|
+
const SUPPORTED_PLATFORMS = ["android", "ios"];
|
|
34
|
+
const platform = await browser.capabilities.platformName;
|
|
35
|
+
return SUPPORTED_PLATFORMS.includes(platform.toLowerCase().trim());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @function executionPlatform
|
|
39
|
+
* @memberof mobile.device
|
|
40
|
+
* @description Check the mobile platform from the session's capabilities.
|
|
41
|
+
* @returns {string} Return current execution platform in the session's capabilities.
|
|
42
|
+
*/
|
|
43
|
+
async executionPlatform() {
|
|
44
|
+
const vl = this.vlf.initLog(this.executionPlatform);
|
|
45
|
+
const platform = browser.capabilities.platformName;
|
|
46
|
+
return platform.toLowerCase().trim();
|
|
47
|
+
}
|
|
48
|
+
//==================================Public Methods================================================
|
|
18
49
|
/**
|
|
19
50
|
* @function isAppInstalled
|
|
20
51
|
* @memberof mobile.device
|
|
21
52
|
* @description Check wether given package/bundle app is installed or not in the device.
|
|
22
|
-
* @param {string}
|
|
23
|
-
* @returns {boolean} Returns true if specified app package/bundled installed in the device, or false.
|
|
24
|
-
* @example
|
|
53
|
+
* @param {string} appPackageOrBundleId - Android package Id, or iOS bundle Id.
|
|
54
|
+
* @returns {boolean} Returns 'true' if specified app package/bundled installed in the device, or 'false'.
|
|
55
|
+
* @example
|
|
56
|
+
* await mobile.device.isAppInstalled("com.google.android.apps.maps");
|
|
57
|
+
* await mobile.device.isAppInstalled("com.apple.AppStore")
|
|
25
58
|
*/
|
|
26
|
-
async isAppInstalled(
|
|
59
|
+
async isAppInstalled(appPackageOrBundleId) {
|
|
27
60
|
const vl = this.vlf.initLog(this.isAppInstalled);
|
|
61
|
+
let isAppInstalledInDevice = false;
|
|
28
62
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
if (await this.isValidPlatform()) {
|
|
64
|
+
isAppInstalledInDevice = browser.isAppInstalled(appPackageOrBundleId);
|
|
65
|
+
vl.log(`${await this.executionPlatform()} app installed successfully.`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
vl.log(`Unsupported platform while checking the is app installed or not`);
|
|
69
|
+
}
|
|
32
70
|
}
|
|
33
71
|
catch (error) {
|
|
34
|
-
|
|
72
|
+
this.ErrorHandler.logException(error, "Error: Could not determine if app is installed, The provided package name is invalid.", true);
|
|
35
73
|
}
|
|
74
|
+
return isAppInstalledInDevice;
|
|
36
75
|
}
|
|
37
76
|
/**
|
|
38
77
|
* @function installApp
|
|
39
78
|
* @memberof mobile.device
|
|
40
79
|
* @description Install the appropriate app based on the platform the test is being executed on.
|
|
41
80
|
* @param {string} appPath - Path of the app(.apk, .ipa)
|
|
81
|
+
* @returns {Promise<void>}
|
|
42
82
|
* @example
|
|
43
83
|
* await mobile.device.installApp("/path/to/your/app.apk");
|
|
44
84
|
* await mobile.device.installApp("/path/to/your/app.ipa");
|
|
45
85
|
*/
|
|
46
86
|
async installApp(appPath) {
|
|
47
87
|
const vl = this.vlf.initLog(this.installApp);
|
|
48
|
-
const platform = await browser.capabilities.platformName;
|
|
49
88
|
try {
|
|
50
|
-
vl.log(`Installing ${
|
|
51
|
-
if (
|
|
89
|
+
vl.log(`Installing ${await this.executionPlatform()} app...`);
|
|
90
|
+
if (await this.isValidPlatform()) {
|
|
52
91
|
await browser.installApp(appPath);
|
|
53
|
-
vl.log(`${
|
|
92
|
+
vl.log(`${await this.executionPlatform()} app installed successfully.`);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
vl.log(`Unsupported platform ${await this.executionPlatform()} while installing app`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
this.ErrorHandler.logException(error, `Error: Unable to install app. The provided app path ${appPath} does not exist`, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @function switchToContext
|
|
104
|
+
* @memberof mobile.device
|
|
105
|
+
* @description Switch to the specified( WEBVIEW | NATIVE_APP ) context if available.
|
|
106
|
+
* @param {string} [targetContext='WEBVIEW'] The name of the target context.
|
|
107
|
+
* @param {number} [timeout=5000] Maximum time to wait for the web context to appear, milliseconds.
|
|
108
|
+
* @returns {Promise<boolean>} Returns 'true' if the context is successfully switched, otherwise 'false'.
|
|
109
|
+
* @example
|
|
110
|
+
* await mobile.device.switchToContext();
|
|
111
|
+
* await mobile.device.switchToContext("NATIVE_APP", 1000);
|
|
112
|
+
*/
|
|
113
|
+
async switchToContext(targetContext = "WEBVIEW", timeout = 5000) {
|
|
114
|
+
const vl = this.vlf.initLog(this.switchToContext);
|
|
115
|
+
try {
|
|
116
|
+
let target = this.getTargetContextIfAvailable(targetContext, timeout);
|
|
117
|
+
if (target) {
|
|
118
|
+
await browser.switchContext(target);
|
|
119
|
+
vl.log(`Switched to ${target} context successfully...`);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
vl.log(`Switched to ${target} context not successful, it may be null`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
this.ErrorHandler.logException(error, `Error: No contexts available, Could not switch to ${targetContext} context 'INVALID_CONTEXT'. `, true);
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @function getTargetContextIfAvailable
|
|
133
|
+
* @memberof mobile.device
|
|
134
|
+
* @description
|
|
135
|
+
* Returns the specified target context if available within a given timeout.
|
|
136
|
+
*
|
|
137
|
+
* This method retrieves the list of available contexts and determines if a context
|
|
138
|
+
* that matches the `targetContext` string is present. If the target context is found,
|
|
139
|
+
* it returns the context name; otherwise, it returns `null`.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} [targetContext="WEBVIEW"] - The name of the target context to check for.
|
|
142
|
+
* Common examples are "WEBVIEW" or "NATIVE_APP".
|
|
143
|
+
* @param {number} [timeout=5000] - The maximum time, in milliseconds, to wait for the target
|
|
144
|
+
* context to become available.
|
|
145
|
+
* @returns {Promise<string | null>} - The name of the target context if found, or `null` if
|
|
146
|
+
* the context is not available within the timeout.
|
|
147
|
+
* @example
|
|
148
|
+
* const context = await getTargetContextIfAvailable("WEBVIEW", 10000);
|
|
149
|
+
* const context = await getTargetContextIfAvailable("NATIVE_APP", 10000);
|
|
150
|
+
*/
|
|
151
|
+
async getTargetContextIfAvailable(targetContext = "WEBVIEW", timeout = 5000) {
|
|
152
|
+
const vl = this.vlf.initLog(this.getTargetContextIfAvailable);
|
|
153
|
+
try {
|
|
154
|
+
let availableContexts = [];
|
|
155
|
+
const isContextAvailable = await browser.waitUntil(async () => {
|
|
156
|
+
// Get all available contexts
|
|
157
|
+
availableContexts = await browser.getContexts();
|
|
158
|
+
return availableContexts.some((context) => context.includes(targetContext));
|
|
159
|
+
}, {
|
|
160
|
+
timeout,
|
|
161
|
+
timeoutMsg: `Target Context "${targetContext}" not found within ${timeout}ms`
|
|
162
|
+
});
|
|
163
|
+
if (isContextAvailable) {
|
|
164
|
+
const target = availableContexts.find((context) => context.includes(targetContext));
|
|
165
|
+
vl.log(`Target Context "${target}" is available.`);
|
|
166
|
+
return target || null;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
vl.log(`Target Context ${targetContext} is not available.`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
this.ErrorHandler.logException(error, `Error: No contexts available, Failed to check is target ${targetContext} context available`, true);
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @function closeApplication
|
|
179
|
+
* @memberof mobile.device
|
|
180
|
+
* @description Close the currently active mobile application.
|
|
181
|
+
* @returns {Promise<void>}
|
|
182
|
+
* @example
|
|
183
|
+
* await mobile.device.closeApplication();
|
|
184
|
+
*/
|
|
185
|
+
async closeApplication() {
|
|
186
|
+
const vl = this.vlf.initLog(this.closeApplication);
|
|
187
|
+
try {
|
|
188
|
+
await browser.closeApp();
|
|
189
|
+
vl.log("The application has been closed successfully.");
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
this.ErrorHandler.logException(error, `Error: Unable to close app, the app is not currently running`, true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @function queryAppState
|
|
197
|
+
* @memberof mobile.device
|
|
198
|
+
* @description Queries the state of the application (e.g., running, background, not installed) on the mobile device(Android or iOS).
|
|
199
|
+
* @param {string} appPackageOrBundleId - Package name (Android) or bundle ID (iOS) of the application.
|
|
200
|
+
* @returns {Promise<number>} - The app state:
|
|
201
|
+
* 0 - Not running,
|
|
202
|
+
* 1 - Not installed,
|
|
203
|
+
* 2 - Running in the background (not suspended),
|
|
204
|
+
* 3 - Running in the background (suspended),
|
|
205
|
+
* 4 - Running in the foreground.
|
|
206
|
+
* @example
|
|
207
|
+
* await mobile.device.queryAppState("com.google.android.apps.maps");
|
|
208
|
+
* await mobile.device.queryAppState("com.apple.AppStore");
|
|
209
|
+
*/
|
|
210
|
+
async queryAppState(appPackageOrBundleId) {
|
|
211
|
+
const vl = this.vlf.initLog(this.queryAppState);
|
|
212
|
+
let appState = -1;
|
|
213
|
+
try {
|
|
214
|
+
vl.log(`Querying the ${await this.executionPlatform()} app state...`);
|
|
215
|
+
if (await this.isValidPlatform()) {
|
|
216
|
+
appState = await browser.queryAppState(appPackageOrBundleId);
|
|
217
|
+
vl.log(`Application state for ${appPackageOrBundleId} : ${appState}`);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
vl.log(`Unsupported platform while query app state: ${await this.executionPlatform()}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
this.ErrorHandler.logException(error, `Error: Unable to query app state, the package name ${appPackageOrBundleId} is invalid or does not exist.`, true);
|
|
225
|
+
}
|
|
226
|
+
return appState;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @function launchApp
|
|
230
|
+
* @memberof mobile.device
|
|
231
|
+
* @description Launches the app for both iOS and Android with a parameterized app identifier.
|
|
232
|
+
* @param {string} appPackageOrBundleId - The Android package name or iOS bundle ID of the application.
|
|
233
|
+
* @returns {Promise<void>} Resolves when the app is successfully launched.
|
|
234
|
+
* @example
|
|
235
|
+
* await mobile.device.launchApp("com.google.android.apps.maps");
|
|
236
|
+
* await mobile.device.launchApp("com.apple.AppStore");
|
|
237
|
+
*/
|
|
238
|
+
async launchApp(appPackageOrBundleId) {
|
|
239
|
+
const vl = this.vlf.initLog(this.launchApp);
|
|
240
|
+
try {
|
|
241
|
+
vl.log(`Launching ${await this.executionPlatform()} app...`);
|
|
242
|
+
if (await this.isValidPlatform()) {
|
|
243
|
+
await browser.activateApp(appPackageOrBundleId);
|
|
244
|
+
vl.log(`${await this.executionPlatform()} App launched successfully with given ${appPackageOrBundleId} Package/bundle ID`);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
vl.log(`Unsupported platform while launching the app: ${await this.executionPlatform()}`);
|
|
54
248
|
}
|
|
55
249
|
}
|
|
56
250
|
catch (error) {
|
|
57
|
-
this.ErrorHandler.logException(error, `Error:
|
|
251
|
+
this.ErrorHandler.logException(error, `Error: Unable to launch the app, the package name ${appPackageOrBundleId} is invalid or does not exist.`, true);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @function switchToLandscapeOrientation
|
|
256
|
+
* @memberof mobile.device
|
|
257
|
+
* @description Switches the device orientation to landscape mode.
|
|
258
|
+
* @returns {Promise<void>} Resolves when the orientation is successfully switched.
|
|
259
|
+
* @example
|
|
260
|
+
* await mobile.device.switchToLandscapeOrientation();
|
|
261
|
+
*/
|
|
262
|
+
async switchToLandscapeOrientation() {
|
|
263
|
+
const vl = this.vlf.initLog(this.switchToLandscapeOrientation);
|
|
264
|
+
try {
|
|
265
|
+
const currentOrientation = await browser.getOrientation();
|
|
266
|
+
if (currentOrientation === ORIENTATION.LANDSCAPE) {
|
|
267
|
+
vl.log("Device is already in landscape mode.");
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
vl.log("Switching device orientation to landscape...");
|
|
271
|
+
await browser.setOrientation(ORIENTATION.LANDSCAPE);
|
|
272
|
+
vl.log("Device orientation successfully switched to landscape.");
|
|
58
273
|
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
this.ErrorHandler.logException(error, `Error: Could not change device orientation, Invalid argument: The orientation must be 'LANDSCAPE'.`, true);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @function switchToPortraitOrientation
|
|
280
|
+
* @memberof mobile.device
|
|
281
|
+
* @description Switches the device orientation to portrait mode.
|
|
282
|
+
* @returns {Promise<void>} Resolves when the orientation is successfully switched.
|
|
283
|
+
* @example
|
|
284
|
+
* await mobile.device.switchToPortraitOrientation();
|
|
285
|
+
*/
|
|
286
|
+
async switchToPortraitOrientation() {
|
|
287
|
+
const vl = this.vlf.initLog(this.switchToPortraitOrientation);
|
|
288
|
+
try {
|
|
289
|
+
const currentOrientation = await browser.getOrientation();
|
|
290
|
+
if (currentOrientation === ORIENTATION.PORTRAIT) {
|
|
291
|
+
vl.log("Device is already in portrait mode.");
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
vl.log("Switching device orientation to portrait...");
|
|
295
|
+
await browser.setOrientation(ORIENTATION.PORTRAIT);
|
|
296
|
+
vl.log("Device orientation successfully switched to portrait.");
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
this.ErrorHandler.logException(error, `Error: Could not change device orientation, Invalid argument: The orientation must be 'PORTRAIT`, true);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* @function getCurrentOrientation
|
|
304
|
+
* @memberof mobile.device
|
|
305
|
+
* @description Returns the device current orientation (PORTRAIT or LANDSCAPE)
|
|
306
|
+
* @returns {Promise<Orientation>} The current device orientation.
|
|
307
|
+
* @example
|
|
308
|
+
* await mobile.device.getCurrentOrientation();
|
|
309
|
+
*/
|
|
310
|
+
async getCurrentOrientation() {
|
|
311
|
+
const vl = this.vlf.initLog(this.getCurrentOrientation);
|
|
312
|
+
let orientation = ORIENTATION.UNKNOWN; // Default value
|
|
313
|
+
try {
|
|
314
|
+
orientation = await browser.getOrientation();
|
|
315
|
+
vl.log(`Current device orientation: ${orientation}`);
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
this.ErrorHandler.logException(error, `Error: Could not get the current device orientation`, true);
|
|
319
|
+
}
|
|
320
|
+
return orientation;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* @function hideKeyboard
|
|
324
|
+
* @memberof mobile.device
|
|
325
|
+
* @description Hides the keyboard on both Android and iOS using specific strategies with timeout.
|
|
326
|
+
* @param {string} strategy - Strategy to use for hiding the keyboard ('pressKey', 'tapOutside', 'swipeDown').
|
|
327
|
+
* @param {string} key - Key to press if using the 'pressKey' strategy (e.g., 'Done', 'Enter').
|
|
328
|
+
* @param {number} keyCode - Key code for Android (optional).
|
|
329
|
+
* @param {number} [timeout=5000] - Timeout in milliseconds for retrying to hide the keyboard.
|
|
330
|
+
* @returns {Promise<void>}
|
|
331
|
+
* @example
|
|
332
|
+
* await mobile.device.hideKeyboard();
|
|
333
|
+
* await mobile.device.hideKeyboard('tapOutside');
|
|
334
|
+
* await mobile.device.hideKeyboard('swipeDown');
|
|
335
|
+
* //Android only, Sends a specific key code, like 66 for "Enter."
|
|
336
|
+
* await mobile.device.hideKeyboard('pressKey', undefined, 66);
|
|
337
|
+
* await mobile.device.hideKeyboard('pressKey', 'Done');
|
|
338
|
+
*/
|
|
339
|
+
async hideKeyboard(strategy, key, keyCode, timeout = 5000) {
|
|
340
|
+
const vl = this.vlf.initLog(this.hideKeyboard);
|
|
341
|
+
const startTime = Date.now();
|
|
342
|
+
while (Date.now() - startTime < timeout) {
|
|
343
|
+
try {
|
|
344
|
+
if (await util.browser.isAndroid()) {
|
|
345
|
+
vl.log("Hiding keyboard on Android.");
|
|
346
|
+
await browser.hideKeyboard(strategy, key, keyCode);
|
|
347
|
+
}
|
|
348
|
+
else if (await util.browser.isIos()) {
|
|
349
|
+
vl.log("Hiding keyboard on iOS.");
|
|
350
|
+
await browser.execute("mobile: hideKeyboard", { strategy });
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
vl.log("Unsupported platform: Unable to hide the keyboard.");
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
vl.log("Keyboard hidden successfully.");
|
|
357
|
+
return; // Exit if the keyboard is successfully hidden
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
// Wait briefly before retrying
|
|
361
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
362
|
+
this.ErrorHandler.logException(error, `Error: Failed to hide the keyboard, Retrying...`, true);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
vl.log(`Failed to hide the keyboard within the timeout of ${timeout}ms.`);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* @function isKeyboardVisible
|
|
369
|
+
* @memberof mobile.device
|
|
370
|
+
* @description Checks if the keyboard is visible or not on the mobile device.
|
|
371
|
+
* @returns {Promise<boolean>} Returns 'true' if the keyboard is visible on the mobile view.
|
|
372
|
+
* @example
|
|
373
|
+
* await mobile.device.isKeyboardVisible();
|
|
374
|
+
*/
|
|
375
|
+
async isKeyboardVisible() {
|
|
376
|
+
const vl = this.vlf.initLog(this.isKeyboardVisible);
|
|
377
|
+
let isKeyboardVisible = false;
|
|
378
|
+
try {
|
|
379
|
+
if (await util.browser.isAndroid()) {
|
|
380
|
+
vl.log("check if the screen height is reduced due to the keyboard");
|
|
381
|
+
// For Android, check if the screen height is reduced due to the keyboard
|
|
382
|
+
const windowRect = await browser.getWindowRect();
|
|
383
|
+
const screenSize = await browser.getWindowSize();
|
|
384
|
+
// If the visible height is less, keyboard is visible
|
|
385
|
+
vl.log("if visible height is less, keyboard is visible");
|
|
386
|
+
isKeyboardVisible = windowRect.height < screenSize.height;
|
|
387
|
+
}
|
|
388
|
+
else if (await util.browser.isIos()) {
|
|
389
|
+
// For iOS, check if the keyboard is displayed via Appium's mobile API
|
|
390
|
+
const isKeyboardShown = await browser.execute("mobile: isKeyboardShown");
|
|
391
|
+
isKeyboardVisible = isKeyboardShown === true; // Returns true if the keyboard is visible
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
vl.log("Unsupported platform: Unable to detect keyboard visibility.");
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
this.ErrorHandler.logException(error, `Error: Failed to get the is keyboard visible`, true);
|
|
400
|
+
}
|
|
401
|
+
return isKeyboardVisible;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* @function isPlatformSupported
|
|
405
|
+
* @memberof mobile.device
|
|
406
|
+
* @description Determine if the current platform is supported, if the current device platform is either Android or iOS.
|
|
407
|
+
* @returns {Promise<boolean>} If neither Android nor iOS is detected (e.g., Windows, Linux, or web), the condition evaluates to false
|
|
408
|
+
* @example
|
|
409
|
+
* await mobile.device.isPlatformSupported();
|
|
410
|
+
*/
|
|
411
|
+
async isPlatformSupported() {
|
|
412
|
+
return (await util.browser.isAndroid()) || (await util.browser.isIos());
|
|
59
413
|
}
|
|
60
414
|
}
|
|
61
415
|
exports.Device = Device;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/device.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,8DAAkE;AAClE,6EAAqD;
|
|
1
|
+
{"version":3,"file":"device.js","sourceR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gBACpE,yEAAyE;gBACzE,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;gBACjD,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;gBACjD,qDAAqD;gBACrD,EAAE,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;gBACzD,iBAAiB,GAAG,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YAC5D,CAAC;iBAAM,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;gBACtC,sEAAsE;gBACtE,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;gBACzE,iBAAiB,GAAG,eAAe,KAAK,IAAI,CAAC,CAAC,0CAA0C;YAC1F,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;gBACtE,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,8CAA8C,EAAE,IAAI,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,mBAAmB;QACvB,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AArZD,wBAqZC;AACD,kBAAe,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -10,11 +10,11 @@ export declare class ElementModule {
|
|
|
10
10
|
* @function isVisible
|
|
11
11
|
* @memberof mobile.element
|
|
12
12
|
* @description Returns a boolean if the mobile element is visible to the user.
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
13
|
+
* @param {Element} 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
15
|
* If "false", it will be sufficient if the element is visible on the view but not inside the current viewport.
|
|
16
|
-
* @returns {
|
|
17
|
-
* @example
|
|
16
|
+
* @returns {boolean} Returns true or false.
|
|
17
|
+
* @example
|
|
18
18
|
* await mobile.element.isVisible(elem);
|
|
19
19
|
*/
|
|
20
20
|
isVisible(element: Element, strict?: boolean): Promise<boolean>;
|
|
@@ -22,8 +22,8 @@ export declare class ElementModule {
|
|
|
22
22
|
* @function isPresent
|
|
23
23
|
* @memberof mobile.element
|
|
24
24
|
* @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
|
|
25
|
-
* @param {
|
|
26
|
-
* @returns {
|
|
25
|
+
* @param {Element} element - The element.
|
|
26
|
+
* @returns {boolean} Returns true or false.
|
|
27
27
|
* @example
|
|
28
28
|
* await mobile.element.isPresent(elem);
|
|
29
29
|
*/
|
|
@@ -33,44 +33,63 @@ export declare class ElementModule {
|
|
|
33
33
|
* @memberof mobile.element
|
|
34
34
|
* @description Waits until the element with the given selector is present.
|
|
35
35
|
* @param {Object} selector - The CSS selector describing the element.
|
|
36
|
-
* @param {
|
|
37
|
-
* @
|
|
38
|
-
* @example
|
|
39
|
-
*
|
|
36
|
+
* @param {number} [timeout = 30000] - The timeout to wait (ms).
|
|
37
|
+
* @returns {boolean} Returns true or false.
|
|
38
|
+
* @example
|
|
39
|
+
* await mobile.element.waitToBePresent(".input01");
|
|
40
|
+
* await mobile.element.waitToBePresent("#button12");
|
|
41
|
+
* await mobile.element.waitToBePresent("p:first-child");
|
|
40
42
|
*/
|
|
41
|
-
waitToBePresent(selector: any, timeout?: number): Promise<
|
|
43
|
+
waitToBePresent(selector: any, timeout?: number): Promise<boolean>;
|
|
42
44
|
/**
|
|
43
45
|
* @function waitToBeVisible
|
|
44
46
|
* @memberof mobile.element
|
|
45
47
|
* @description Waits until the element with the given selector is visible.
|
|
46
48
|
* @param {Object} selector - The CSS selector describing the element.
|
|
47
|
-
* @param {
|
|
48
|
-
* @
|
|
49
|
-
* @example
|
|
50
|
-
*
|
|
49
|
+
* @param {number} [timeout=30000] - The timeout to wait (ms).
|
|
50
|
+
* @returns {boolean} Returns true or false.
|
|
51
|
+
* @example
|
|
52
|
+
* await mobile.element.waitToBeVisible(".input01");
|
|
53
|
+
* await mobile.element.waitToBeVisible("#button12");
|
|
54
|
+
* await mobile.element.waitToBeVisible("p:first-child");
|
|
51
55
|
*/
|
|
52
|
-
waitToBeVisible(selector: any, timeout?: number): Promise<
|
|
56
|
+
waitToBeVisible(selector: any, timeout?: number): Promise<boolean>;
|
|
53
57
|
/**
|
|
54
58
|
* @function waitToBeClickable
|
|
55
59
|
* @memberof mobile.element
|
|
56
60
|
* @description Waits until the element with the given selector is clickable.
|
|
57
61
|
* @param {Object} selector - The CSS selector describing the element.
|
|
58
|
-
* @param {
|
|
59
|
-
* @
|
|
60
|
-
* @example
|
|
61
|
-
*
|
|
62
|
+
* @param {number} [timeout=30000] - The timeout to wait (ms).
|
|
63
|
+
* @returns {boolean} Returns true or false.
|
|
64
|
+
* @example
|
|
65
|
+
* await mobile.element.waitToBeClickable(".input01");
|
|
66
|
+
* await mobile.element.waitToBeClickable("#button12");
|
|
67
|
+
* await mobile.element.waitToBeClickable("p:first-child");
|
|
62
68
|
*/
|
|
63
|
-
waitToBeClickable(selector: any, timeout?: number): Promise<
|
|
69
|
+
waitToBeClickable(selector: any, timeout?: number): Promise<boolean>;
|
|
64
70
|
/**
|
|
65
71
|
* @function isSelected
|
|
66
72
|
* @memberof mobile.element
|
|
67
73
|
* @description Returns a boolean if the element (e.g. checkbox) is selected.
|
|
68
|
-
* @param {
|
|
69
|
-
* @returns {boolean}
|
|
70
|
-
* @example
|
|
74
|
+
* @param {Element | string} elementOrSelector - The element.
|
|
75
|
+
* @returns {boolean} Returns true or false.
|
|
76
|
+
* @example
|
|
71
77
|
* const isSelected = await mobile.element.isSelected(elem);
|
|
72
78
|
*/
|
|
73
|
-
isSelected(
|
|
79
|
+
isSelected(elementOrSelector: Element | string): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* @function waitToBeEnabled
|
|
82
|
+
* @memberof mobile.element
|
|
83
|
+
* @description Waits until the element with the given selector is present.
|
|
84
|
+
* @param {Object} selector - The CSS selector describing the element.
|
|
85
|
+
* @param {number} [timeout=30000] - The timeout to wait (ms).
|
|
86
|
+
* @returns {boolean} Returns true or false.
|
|
87
|
+
* @example
|
|
88
|
+
* await mobile.element.waitToBeEnabled(".input01");
|
|
89
|
+
* await mobile.element.waitToBeEnabled("#button12");
|
|
90
|
+
* await mobile.element.waitToBeEnabled("p:first-child");
|
|
91
|
+
*/
|
|
92
|
+
waitToBeEnabled(selector: any, timeout?: number): Promise<boolean>;
|
|
74
93
|
}
|
|
75
94
|
declare const _default: ElementModule;
|
|
76
95
|
export default _default;
|