@sap_oss/wdio-qmate-service 3.9.0 → 3.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/lib/reuse/helper/tableHelper.js +3 -0
- package/lib/reuse/helper/tableHelper.js.map +1 -1
- package/lib/reuse/index.js +0 -17
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/flp/userSettings.d.ts +2 -0
- package/lib/reuse/modules/flp/userSettings.js +6 -1
- package/lib/reuse/modules/flp/userSettings.js.map +1 -1
- package/lib/reuse/modules/ui5/assertion.d.ts +1 -0
- package/lib/reuse/modules/ui5/assertion.js +11 -4
- package/lib/reuse/modules/ui5/assertion.js.map +1 -1
- package/lib/reuse/modules/ui5/element.d.ts +2 -2
- package/lib/reuse/modules/ui5/element.js +7 -4
- package/lib/reuse/modules/ui5/element.js.map +1 -1
- package/lib/reuse/modules/ui5/session.d.ts +4 -2
- package/lib/reuse/modules/ui5/session.js +32 -4
- package/lib/reuse/modules/ui5/session.js.map +1 -1
- package/lib/reuse/modules/ui5/table.js +25 -9
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/userInteraction.d.ts +1 -1
- package/lib/reuse/modules/ui5/userInteraction.js +47 -58
- package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/util/file.d.ts +5 -3
- package/lib/reuse/modules/util/file.js +33 -7
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/package.json +18 -26
- package/reuseApi.json +8 -468
- package/test/helper/configurations/base.conf.js +6 -3
- package/test/helper/configurations/chrome.headless.conf.js +1 -1
- package/test/reuse/ui5/assertion/expectAttributeToBe.spec.js +74 -29
- package/test/reuse/ui5/assertion/expectAttributeToContain.spec.js +42 -0
- package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +1 -1
- package/test/reuse/ui5/confirmationDialog/clickOk.spec.js +1 -1
- package/test/reuse/ui5/table/selectRowByValues.spec.js +6 -6
- package/test/reuse/ui5/userInteraction/click.spec.js +51 -13
- package/test/reuse/ui5/userInteraction/doubleClick.spec.js +1 -1
- package/test/reuse/util/file/pdfParser.spec.js +1 -2
- package/lib/reuse/modules/mobile/Mobile.d.ts +0 -16
- package/lib/reuse/modules/mobile/Mobile.js +0 -23
- package/lib/reuse/modules/mobile/Mobile.js.map +0 -1
- package/lib/reuse/modules/mobile/android.d.ts +0 -32
- package/lib/reuse/modules/mobile/android.js +0 -85
- package/lib/reuse/modules/mobile/android.js.map +0 -1
- package/lib/reuse/modules/mobile/device.d.ts +0 -173
- package/lib/reuse/modules/mobile/device.js +0 -403
- package/lib/reuse/modules/mobile/device.js.map +0 -1
- package/lib/reuse/modules/mobile/element.d.ts +0 -95
- package/lib/reuse/modules/mobile/element.js +0 -185
- package/lib/reuse/modules/mobile/element.js.map +0 -1
- package/lib/reuse/modules/mobile/gestures.d.ts +0 -42
- package/lib/reuse/modules/mobile/gestures.js +0 -86
- package/lib/reuse/modules/mobile/gestures.js.map +0 -1
- package/lib/reuse/modules/mobile/ios.d.ts +0 -10
- package/lib/reuse/modules/mobile/ios.js +0 -19
- package/lib/reuse/modules/mobile/ios.js.map +0 -1
- package/lib/reuse/modules/mobile/userInteraction.d.ts +0 -94
- package/lib/reuse/modules/mobile/userInteraction.js +0 -210
- package/lib/reuse/modules/mobile/userInteraction.js.map +0 -1
- package/test/helper/configurations/mobile.conf.js +0 -16
|
@@ -73,3 +73,45 @@ describe("assertion - expectAttributeToContain with wrong compareValue (unhappy
|
|
|
73
73
|
await expect(ui5.assertion.expectAttributeToContain(selector, "text", 123)).rejects.toThrow("Welcome to the Shopping Cart");
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
+
|
|
77
|
+
describe("assertion - expectAttributeToContain text with special spaces characters", function () {
|
|
78
|
+
const specialSpacesString = "-\u00A0-\u2002-\u2003-\u2007-\u2009-\u202F-";
|
|
79
|
+
const normalizedString = "- - - - - - -";
|
|
80
|
+
const selector = {
|
|
81
|
+
elementProperties: {
|
|
82
|
+
metadata: "sap.m.Title",
|
|
83
|
+
id: "container-cart---homeView--page-title"
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
it("Preparation", async function () {
|
|
88
|
+
await browser.url("#/categories");
|
|
89
|
+
await browser.uiControls(selector);
|
|
90
|
+
await browser.execute(`sap.ui.getCore().byId("${selector.elementProperties.id}").setText("${specialSpacesString}")`);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("Execution && Verification", async function () {
|
|
94
|
+
await ui5.assertion.expectAttributeToContain(selector, "text", normalizedString);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe("assertion - expectAttributeToContain text with invisible characters", function () {
|
|
99
|
+
const invisibleCharacters = "-\u200B-\u200C-\u200D-\uFEFF-";
|
|
100
|
+
const normalizedString = "-----";
|
|
101
|
+
const selector = {
|
|
102
|
+
elementProperties: {
|
|
103
|
+
metadata: "sap.m.Title",
|
|
104
|
+
id: "container-cart---homeView--page-title"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
it("Preparation", async function () {
|
|
109
|
+
await browser.url("#/categories");
|
|
110
|
+
await browser.uiControls(selector);
|
|
111
|
+
await browser.execute(`sap.ui.getCore().byId("${selector.elementProperties.id}").setText("${invisibleCharacters}")`);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("Execution && Verification", async function () {
|
|
115
|
+
await ui5.assertion.expectAttributeToContain(selector, "text", normalizedString);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -55,7 +55,7 @@ describe("confirmationDialog - clickButton - text 'OK' without confirmation dial
|
|
|
55
55
|
it("Execution and Verification", async function () {
|
|
56
56
|
await expect(ui5.element.getDisplayed(selectorForPopupOkButton)).rejects.toThrow(/No visible elements found/);
|
|
57
57
|
|
|
58
|
-
await expect(ui5.confirmationDialog.clickButton("OK")).rejects.toThrow(/
|
|
58
|
+
await expect(ui5.confirmationDialog.clickButton("OK")).rejects.toThrow(/No visible elements found/);
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -60,6 +60,6 @@ describe("confirmationDialog - clickOk without confirmation dialog (unhappy case
|
|
|
60
60
|
// No dialog with "Ok" button
|
|
61
61
|
await expect(ui5.element.getDisplayed(selectorForPopupOkButton)).rejects.toThrow(/No visible elements found/);
|
|
62
62
|
|
|
63
|
-
await expect(ui5.confirmationDialog.clickOk()).rejects.toThrow(/
|
|
63
|
+
await expect(ui5.confirmationDialog.clickOk()).rejects.toThrow(/No visible elements found/);
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -29,7 +29,7 @@ const tableSelector2 = {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const rowSelector2 = "__xmlview0--LineItemsSmartTable-ui5table-rows-row6";
|
|
33
33
|
|
|
34
34
|
const tableSelector3 = {
|
|
35
35
|
elementProperties: {
|
|
@@ -56,7 +56,7 @@ const tableSelector4 = {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const
|
|
59
|
+
const rowSelector4 = "sampleComp-sap.ui.mdc.demokit.sample.table.TableTypes---sample--table-innerTable-rows-row1";
|
|
60
60
|
|
|
61
61
|
describe("table - selectRowByValues - demo kit - passing value as string - ui5CheckBox", function () {
|
|
62
62
|
it("Preparation", async function () {
|
|
@@ -85,8 +85,8 @@ describe("table - selectRowByValues - demo kit - passing value as array of strin
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it("Verification", async function () {
|
|
88
|
-
const
|
|
89
|
-
const isSelected = await nonUi5.element.getAttributeValue(
|
|
88
|
+
const rowElement = await nonUi5.element.getById(rowSelector2);
|
|
89
|
+
const isSelected = await nonUi5.element.getAttributeValue(rowElement, "aria-selected");
|
|
90
90
|
common.assertion.expectEqual(isSelected, "true");
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -134,8 +134,8 @@ describe("table - selectRowByValues - demo kit - mdc table type - passing value
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
it("Verification", async function () {
|
|
137
|
-
const
|
|
138
|
-
const isSelected = await nonUi5.element.getAttributeValue(
|
|
137
|
+
const rowElement = await nonUi5.element.getById(rowSelector4);
|
|
138
|
+
const isSelected = await nonUi5.element.getAttributeValue(rowElement, "aria-selected");
|
|
139
139
|
common.assertion.expectEqual(isSelected, "true");
|
|
140
140
|
});
|
|
141
141
|
});
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const { BASE_URL } = require("../../../../src/reuse/constants.ts");
|
|
2
2
|
const { handleCookiesConsent } = require("../../../helper/utils");
|
|
3
3
|
|
|
4
|
+
// =================== CONSTANTS ==========================================
|
|
5
|
+
const NEGATIVE_TEST_TIMEOUT = 10_000;
|
|
6
|
+
|
|
7
|
+
// =================== TESTS ==============================================
|
|
8
|
+
|
|
4
9
|
describe("userInteraction - click", function () {
|
|
5
10
|
it("Preparation", async function () {
|
|
6
11
|
await browser.navigateTo(`${BASE_URL}/`);
|
|
@@ -38,8 +43,7 @@ describe("userInteraction - click on not displayed element", function () {
|
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
const index = 0;
|
|
41
|
-
|
|
42
|
-
await expect(ui5.userInteraction.click(selector, index, timeout)).rejects.toThrow(/No visible elements found/);
|
|
46
|
+
await expect(ui5.userInteraction.click(selector, index, NEGATIVE_TEST_TIMEOUT)).rejects.toThrow(/No visible elements found/);
|
|
43
47
|
});
|
|
44
48
|
});
|
|
45
49
|
|
|
@@ -65,7 +69,7 @@ describe("userInteraction - click on invisible element", function () {
|
|
|
65
69
|
const timeout = 30000;
|
|
66
70
|
await ui5.userInteraction.click(selector, index, timeout);
|
|
67
71
|
await browser.pause(1000);
|
|
68
|
-
await expect(ui5.userInteraction.click(selector, index,
|
|
72
|
+
await expect(ui5.userInteraction.click(selector, index, NEGATIVE_TEST_TIMEOUT)).rejects.toThrow(/No visible elements found with selector/);
|
|
69
73
|
});
|
|
70
74
|
});
|
|
71
75
|
|
|
@@ -91,30 +95,64 @@ describe("userInteraction - click with selector having wildcard character(*) for
|
|
|
91
95
|
});
|
|
92
96
|
});
|
|
93
97
|
|
|
94
|
-
describe("userInteraction - click
|
|
98
|
+
describe("userInteraction - click disabled button (negative test)", function () {
|
|
95
99
|
const selector = {
|
|
96
100
|
elementProperties: {
|
|
97
101
|
metadata: "sap.m.Button",
|
|
98
|
-
text: "
|
|
102
|
+
text: "Transient Message"
|
|
99
103
|
}
|
|
100
104
|
};
|
|
101
105
|
|
|
102
106
|
it("Preparation", async function () {
|
|
103
107
|
await browser.navigateTo(`${BASE_URL}/test-resources/sap/suite/ui/generic/template/demokit/demokit.html?responderOn=true&demoApp=sttasalesordertt#/?sap-iapp-state=3&sap-iapp-state--history=1`);
|
|
104
|
-
await ui5.userInteraction.click(selector);
|
|
105
108
|
});
|
|
106
109
|
|
|
107
|
-
it("Execution", async function () {
|
|
108
|
-
await ui5.userInteraction.click(selector, 0,
|
|
110
|
+
it("Execution && Verification", async function () {
|
|
111
|
+
await expect(ui5.userInteraction.click(selector, 0, NEGATIVE_TEST_TIMEOUT)).rejects.toThrow(/Element is not clickable after/);
|
|
109
112
|
});
|
|
113
|
+
});
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
describe("userInteraction - click unblocked button and ignore blocked one", function () {
|
|
116
|
+
const createButtonSelector = {
|
|
117
|
+
elementProperties: {
|
|
118
|
+
metadata: "sap.m.Button",
|
|
119
|
+
text: "Create"
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const currencyCodeSelector = {
|
|
123
|
+
elementProperties: {
|
|
124
|
+
metadata: "sap.m.Title",
|
|
125
|
+
text: "Select: ISO Currency Code"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
it("Preparation", async function () {
|
|
130
|
+
await browser.navigateTo(`${BASE_URL}/test-resources/sap/suite/ui/generic/template/demokit/demokit.html?responderOn=true&demoApp=sttasalesordertt#/?sap-iapp-state=3&sap-iapp-state--history=1`);
|
|
131
|
+
await ui5.userInteraction.click(createButtonSelector);
|
|
132
|
+
const valueHelpIconSelector = {
|
|
113
133
|
elementProperties: {
|
|
114
|
-
metadata: "sap.
|
|
115
|
-
|
|
134
|
+
metadata: "sap.ui.core.Icon",
|
|
135
|
+
alt: "Show Value Help",
|
|
136
|
+
ancestorProperties: {
|
|
137
|
+
tooltipLabel: "EPM: Total Gross Amount"
|
|
138
|
+
}
|
|
116
139
|
}
|
|
117
140
|
};
|
|
118
|
-
await ui5.
|
|
141
|
+
await ui5.userInteraction.click(valueHelpIconSelector);
|
|
142
|
+
await ui5.assertion.expectToBeVisible(currencyCodeSelector);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("Execution", async function () {
|
|
146
|
+
const cancelButtonSelector = {
|
|
147
|
+
elementProperties: {
|
|
148
|
+
metadata: "sap.m.Button",
|
|
149
|
+
text: "Cancel"
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
await ui5.userInteraction.click(cancelButtonSelector, 0, 30000);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("Verification", async function () {
|
|
156
|
+
await ui5.assertion.expectToBeNotVisible(currencyCodeSelector, NEGATIVE_TEST_TIMEOUT);
|
|
119
157
|
});
|
|
120
158
|
});
|
|
@@ -65,6 +65,6 @@ describe("userInteraction - doubleClick on invisible element", function () {
|
|
|
65
65
|
const timeout = 30000;
|
|
66
66
|
await ui5.userInteraction.doubleClick(selector, index, timeout);
|
|
67
67
|
await browser.pause(1000);
|
|
68
|
-
await expect(ui5.userInteraction.doubleClick(selector, index, timeout)).rejects.toThrow(/No
|
|
68
|
+
await expect(ui5.userInteraction.doubleClick(selector, index, timeout)).rejects.toThrow(/No visible elements found/);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -28,8 +28,7 @@ describe("PDF Parser", function () {
|
|
|
28
28
|
describe("expectPdfContainsText - from URL", function () {
|
|
29
29
|
it("Execution and Verification", async function () {
|
|
30
30
|
const pdfPath = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf";
|
|
31
|
-
|
|
32
|
-
await util.file.expectPdfContainsText(pdfPath, "Dumm y PDF fi le");
|
|
31
|
+
await util.file.expectPdfContainsText(pdfPath, "Dummy PDF file");
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Gestures } from "./gestures";
|
|
2
|
-
import { ElementModule } from "./element";
|
|
3
|
-
import { UserInteraction } from "./userInteraction";
|
|
4
|
-
import { Device } from "./device";
|
|
5
|
-
import { Android } from "./android";
|
|
6
|
-
import { Ios } from "./ios";
|
|
7
|
-
export declare class Mobile {
|
|
8
|
-
gestures: Gestures;
|
|
9
|
-
userInteraction: UserInteraction;
|
|
10
|
-
element: ElementModule;
|
|
11
|
-
device: Device;
|
|
12
|
-
android: Android;
|
|
13
|
-
ios: Ios;
|
|
14
|
-
}
|
|
15
|
-
declare const _default: Mobile;
|
|
16
|
-
export default _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
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.Mobile = void 0;
|
|
7
|
-
const gestures_1 = __importDefault(require("./gestures"));
|
|
8
|
-
const element_1 = __importDefault(require("./element"));
|
|
9
|
-
const userInteraction_1 = __importDefault(require("./userInteraction"));
|
|
10
|
-
const device_1 = __importDefault(require("./device"));
|
|
11
|
-
const android_1 = __importDefault(require("./android"));
|
|
12
|
-
const ios_1 = __importDefault(require("./ios"));
|
|
13
|
-
class Mobile {
|
|
14
|
-
gestures = gestures_1.default;
|
|
15
|
-
userInteraction = userInteraction_1.default;
|
|
16
|
-
element = element_1.default;
|
|
17
|
-
device = device_1.default;
|
|
18
|
-
android = android_1.default;
|
|
19
|
-
ios = ios_1.default;
|
|
20
|
-
}
|
|
21
|
-
exports.Mobile = Mobile;
|
|
22
|
-
exports.default = new Mobile();
|
|
23
|
-
//# sourceMappingURL=Mobile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Mobile.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/Mobile.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAgD;AAChD,wDAAmD;AACnD,wEAAqE;AACrE,sDAA0C;AAC1C,wDAA6C;AAC7C,gDAAiC;AAEjC,MAAa,MAAM;IACjB,QAAQ,GAAa,kBAAQ,CAAC;IAC9B,eAAe,GAAoB,yBAAe,CAAC;IACnD,OAAO,GAAkB,iBAAO,CAAC;IACjC,MAAM,GAAW,gBAAM,CAAC;IACxB,OAAO,GAAY,iBAAO,CAAC;IAC3B,GAAG,GAAQ,aAAG,CAAC;CAChB;AAPD,wBAOC;AACD,kBAAe,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
* @returns {Promise<void>}
|
|
15
|
-
* @example
|
|
16
|
-
* await mobile.android.pressKeyByName("back");
|
|
17
|
-
* await mobile.android.pressKeyByName("home");
|
|
18
|
-
*/
|
|
19
|
-
pressKeyByName(keyName: KeyName): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* @function pressKeyByCode
|
|
22
|
-
* @memberof mobile.android
|
|
23
|
-
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
24
|
-
* @param {string} keyCode - The code of the key (e.g., 4 (back), 3 (home) , etc.)
|
|
25
|
-
* @returns {Promise<void>}
|
|
26
|
-
* @example await mobile.android.pressKeyByCode(4);
|
|
27
|
-
* @see https://developer.android.com/reference/android/view/KeyEvent
|
|
28
|
-
*/
|
|
29
|
-
pressKeyByCode(keyCode: number): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
declare const _default: Android;
|
|
32
|
-
export default _default;
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "android");
|
|
16
|
-
ErrorHandler = new errorHandler_1.default();
|
|
17
|
-
/**
|
|
18
|
-
* @function pressKeyByName
|
|
19
|
-
* @memberof mobile.android
|
|
20
|
-
* @description Simulate pressing a hardware key on the android device (e.g., back button, home button, etc.),
|
|
21
|
-
* @param {string} keyName - The name of the key (e.g., "back", "home", "volumeUp", etc.)
|
|
22
|
-
* @returns {Promise<void>}
|
|
23
|
-
* @example
|
|
24
|
-
* await mobile.android.pressKeyByName("back");
|
|
25
|
-
* await mobile.android.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
|
-
* @returns {Promise<void>}
|
|
69
|
-
* @example await mobile.android.pressKeyByCode(4);
|
|
70
|
-
* @see https://developer.android.com/reference/android/view/KeyEvent
|
|
71
|
-
*/
|
|
72
|
-
async pressKeyByCode(keyCode) {
|
|
73
|
-
const vl = this.vlf.initLog(this.pressKeyByCode);
|
|
74
|
-
try {
|
|
75
|
-
vl.log(`Pressing key by code: ${keyCode}`);
|
|
76
|
-
await browser.pressKeyCode(keyCode);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
return this.ErrorHandler.logException(error, "Error: During pressKeyByCode in Android", true);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.Android = Android;
|
|
84
|
-
exports.default = new Android();
|
|
85
|
-
//# sourceMappingURL=android.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IACV,GAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD,YAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAE1C;;;;;;;;;OASG;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,EAAE;YACT,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,GAAG;SACd,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,EAAE,CAAC,GAAG,CAAC,iBAAiB,OAAO,WAAW,OAAO,GAAG,CAAC,CAAC;gBACtD,MAAM,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,cAAc,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,yCAAyC,EAAE,IAAI,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAAC,OAAe;QAClC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC;YACH,EAAE,CAAC,GAAG,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAC;YAC3C,MAAM,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,yCAAyC,EAAE,IAAI,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;CACF;AArED,0BAqEC;AACD,kBAAe,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
type hideKeyboardStrategy = "pressKey" | "tapOutside" | "swipeDown" | "";
|
|
2
|
-
declare const ORIENTATION: {
|
|
3
|
-
readonly LANDSCAPE: "LANDSCAPE";
|
|
4
|
-
readonly PORTRAIT: "PORTRAIT";
|
|
5
|
-
readonly UNKNOWN: "UNKNOWN";
|
|
6
|
-
};
|
|
7
|
-
type Orientation = (typeof ORIENTATION)[keyof typeof ORIENTATION];
|
|
8
|
-
/**
|
|
9
|
-
* @class device
|
|
10
|
-
* @memberof mobile
|
|
11
|
-
*/
|
|
12
|
-
export declare class Device {
|
|
13
|
-
private vlf;
|
|
14
|
-
private ErrorHandler;
|
|
15
|
-
private isValidPlatform;
|
|
16
|
-
private executionPlatform;
|
|
17
|
-
/**
|
|
18
|
-
* @function isAppInstalled
|
|
19
|
-
* @memberof mobile.device
|
|
20
|
-
* @description Check if the application identified by its Package name/Bundle ID is installed on the device.
|
|
21
|
-
* @param {string} appPackageOrBundleId - Android package Name, or iOS bundle Id.
|
|
22
|
-
* @returns {boolean} - Returns `true` if specified app package/bundled installed in the device, or `false`.
|
|
23
|
-
* @example
|
|
24
|
-
* await mobile.device.isAppInstalled("com.google.android.apps.maps");
|
|
25
|
-
* await mobile.device.isAppInstalled("com.apple.AppStore")
|
|
26
|
-
*/
|
|
27
|
-
isAppInstalled(appPackageOrBundleId: string): Promise<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* @function installApp
|
|
30
|
-
* @memberof mobile.device
|
|
31
|
-
* @description Install the appropriate app based on the platform the test is being executed on.
|
|
32
|
-
* @param {string} appPath - Path of the app(.apk, .ipa)
|
|
33
|
-
* @returns {Promise<void>}
|
|
34
|
-
* @example
|
|
35
|
-
* await mobile.device.installApp("/path/to/your/app.apk");
|
|
36
|
-
* await mobile.device.installApp("/path/to/your/app.ipa");
|
|
37
|
-
*/
|
|
38
|
-
installApp(appPath: string): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* @function switchToContext
|
|
41
|
-
* @memberof mobile.device
|
|
42
|
-
* @description Switch to the specified( WEBVIEW | NATIVE_APP ) context if available.
|
|
43
|
-
* @param {string} [targetContext='WEBVIEW'] The name of the target context.
|
|
44
|
-
* @param {number} [timeout=5000] Maximum time to wait for the web context to appear, milliseconds.
|
|
45
|
-
* @returns {Promise<boolean>} Returns `true` if the context is successfully switched, otherwise `false`.
|
|
46
|
-
* @example
|
|
47
|
-
* await mobile.device.switchToContext();
|
|
48
|
-
* await mobile.device.switchToContext("NATIVE_APP", 1000);
|
|
49
|
-
*/
|
|
50
|
-
switchToContext(targetContext?: string, timeout?: number): Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* @function getTargetContextIfAvailable
|
|
53
|
-
* @memberof mobile.device
|
|
54
|
-
* @description
|
|
55
|
-
* Returns the specified target context if available within a given timeout.
|
|
56
|
-
*
|
|
57
|
-
* This method retrieves the list of available contexts and determines if a context
|
|
58
|
-
* that matches the `targetContext` string is present. If the target context is found,
|
|
59
|
-
* it returns the context name; otherwise, it returns `null`.
|
|
60
|
-
*
|
|
61
|
-
* @param {string} [targetContext='WEBVIEW'] The name of the target context to check for.
|
|
62
|
-
* Common examples are `WEBVIEW` or `NATIVE_APP`.
|
|
63
|
-
* @param {number} [timeout=5000] The maximum time, in milliseconds, to wait for the target
|
|
64
|
-
* context to become available.
|
|
65
|
-
* @returns {Promise<string | null>} The name of the target context if found, or `null` if
|
|
66
|
-
* the context is not available within the timeout.
|
|
67
|
-
* @example
|
|
68
|
-
* const context = await getTargetContextIfAvailable("WEBVIEW", 10000);
|
|
69
|
-
* const context = await getTargetContextIfAvailable("NATIVE_APP", 10000);
|
|
70
|
-
*/
|
|
71
|
-
getTargetContextIfAvailable(targetContext?: string, timeout?: number): Promise<string | null>;
|
|
72
|
-
/**
|
|
73
|
-
* @function closeApplication
|
|
74
|
-
* @memberof mobile.device
|
|
75
|
-
* @description Close the currently active mobile application.
|
|
76
|
-
* @returns {Promise<void>}
|
|
77
|
-
* @example
|
|
78
|
-
* await mobile.device.closeApplication();
|
|
79
|
-
*/
|
|
80
|
-
closeApplication(): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* @function queryAppState
|
|
83
|
-
* @memberof mobile.device
|
|
84
|
-
* @description Queries the state of the application (e.g., running, background, not installed) on the mobile device(Android or iOS).
|
|
85
|
-
* @param {string} appPackageOrBundleId - Package name (Android) or bundle ID (iOS) of the application.
|
|
86
|
-
* @returns {Promise<number>} - The app state:
|
|
87
|
-
* 0 - Not running,
|
|
88
|
-
* 1 - Not installed,
|
|
89
|
-
* 2 - Running in the background (not suspended),
|
|
90
|
-
* 3 - Running in the background (suspended),
|
|
91
|
-
* 4 - Running in the foreground.
|
|
92
|
-
* @example
|
|
93
|
-
* await mobile.device.queryAppState("com.google.android.apps.maps");
|
|
94
|
-
* await mobile.device.queryAppState("com.apple.AppStore");
|
|
95
|
-
*/
|
|
96
|
-
queryAppState(appPackageOrBundleId: string): Promise<number>;
|
|
97
|
-
/**
|
|
98
|
-
* @function launchApp
|
|
99
|
-
* @memberof mobile.device
|
|
100
|
-
* @description Launches the app for both iOS and Android with a parameterized app identifier.
|
|
101
|
-
* @param {string} appPackageOrBundleId - The Android package name or iOS bundle ID of the application.
|
|
102
|
-
* @returns {Promise<void>} Resolves when the app is successfully launched.
|
|
103
|
-
* @example
|
|
104
|
-
* await mobile.device.launchApp("com.google.android.apps.maps");
|
|
105
|
-
* await mobile.device.launchApp("com.apple.AppStore");
|
|
106
|
-
*/
|
|
107
|
-
launchApp(appPackageOrBundleId: string): Promise<void>;
|
|
108
|
-
/**
|
|
109
|
-
* @function switchToLandscapeOrientation
|
|
110
|
-
* @memberof mobile.device
|
|
111
|
-
* @description Switches the device orientation to landscape mode.
|
|
112
|
-
* @returns {Promise<void>} Resolves when the orientation is successfully switched.
|
|
113
|
-
* @example
|
|
114
|
-
* await mobile.device.switchToLandscapeOrientation();
|
|
115
|
-
*/
|
|
116
|
-
switchToLandscapeOrientation(): Promise<void>;
|
|
117
|
-
/**
|
|
118
|
-
* @function switchToPortraitOrientation
|
|
119
|
-
* @memberof mobile.device
|
|
120
|
-
* @description Switches the device orientation to portrait mode.
|
|
121
|
-
* @returns {Promise<void>} Resolves when the orientation is successfully switched.
|
|
122
|
-
* @example
|
|
123
|
-
* await mobile.device.switchToPortraitOrientation();
|
|
124
|
-
*/
|
|
125
|
-
switchToPortraitOrientation(): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* @function getCurrentOrientation
|
|
128
|
-
* @memberof mobile.device
|
|
129
|
-
* @description Returns the device current orientation (PORTRAIT or LANDSCAPE)
|
|
130
|
-
* @returns {Promise<Orientation>} The current device orientation.
|
|
131
|
-
* @example
|
|
132
|
-
* await mobile.device.getCurrentOrientation();
|
|
133
|
-
*/
|
|
134
|
-
getCurrentOrientation(): Promise<Orientation>;
|
|
135
|
-
/**
|
|
136
|
-
* @function hideKeyboard
|
|
137
|
-
* @memberof mobile.device
|
|
138
|
-
* @description Hides the keyboard on both Android and iOS using specific strategies with timeout.
|
|
139
|
-
* @param {string} strategy - Strategy to use for hiding the keyboard ('pressKey', 'tapOutside', 'swipeDown').
|
|
140
|
-
* @param {string} key - Key to press if using the 'pressKey' strategy (e.g., 'Done', 'Enter').
|
|
141
|
-
* @param {number} keyCode - Key code for Android (optional).
|
|
142
|
-
* @param {number} [timeout=5000] - Timeout in milliseconds for retrying to hide the keyboard.
|
|
143
|
-
* @returns {Promise<void>}
|
|
144
|
-
* @example
|
|
145
|
-
* await mobile.device.hideKeyboard();
|
|
146
|
-
* await mobile.device.hideKeyboard('tapOutside');
|
|
147
|
-
* await mobile.device.hideKeyboard('swipeDown');
|
|
148
|
-
* //Android only, Sends a specific key code, like 66 for "Enter."
|
|
149
|
-
* await mobile.device.hideKeyboard('pressKey', undefined, 66);
|
|
150
|
-
* await mobile.device.hideKeyboard('pressKey', 'Done');
|
|
151
|
-
*/
|
|
152
|
-
hideKeyboard(strategy?: hideKeyboardStrategy, key?: string, keyCode?: number, timeout?: number): Promise<void>;
|
|
153
|
-
/**
|
|
154
|
-
* @function isKeyboardVisible
|
|
155
|
-
* @memberof mobile.device
|
|
156
|
-
* @description Checks if the keyboard is visible or not on the mobile device.
|
|
157
|
-
* @returns {Promise<boolean>} Returns `true` if the keyboard is visible on the mobile view.
|
|
158
|
-
* @example
|
|
159
|
-
* await mobile.device.isKeyboardVisible();
|
|
160
|
-
*/
|
|
161
|
-
isKeyboardVisible(): Promise<boolean>;
|
|
162
|
-
/**
|
|
163
|
-
* @function isPlatformSupported
|
|
164
|
-
* @memberof mobile.device
|
|
165
|
-
* @description Determine if the current platform is supported, if the current device platform is either `Android` or `iOS`.
|
|
166
|
-
* @returns {Promise<boolean>} If neither Android nor iOS is detected (e.g., Windows, Linux, or web), the condition evaluates to false
|
|
167
|
-
* @example
|
|
168
|
-
* await mobile.device.isPlatformSupported();
|
|
169
|
-
*/
|
|
170
|
-
isPlatformSupported(): Promise<boolean>;
|
|
171
|
-
}
|
|
172
|
-
declare const _default: Device;
|
|
173
|
-
export default _default;
|