@nbakka/mcp-appium 2.0.32 → 2.0.34
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/app_context.txt +6 -4
- package/lib/server.js +3 -3
- package/package.json +1 -1
package/lib/app_context.txt
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
You have to first manually execute the steps till you reach the end goal by intelligently navigating through the app and then generate the code based on the elements you find. Follow these instructions carefully:
|
|
1
2
|
When asked to open buy SRP, use deeplink to open https://housing.com/in/buy/mumbai/<locality name>. For example: if asked to open 'Mira Road East' buy SRP, then open this deeplink: https://housing.com/in/buy/mumbai/mira_road_east
|
|
2
3
|
Homepage deeplink -> https://housing.com/in/buy/real-estate-mumbai
|
|
3
4
|
Only use the locator data from the Google Sheet at the end while generating test cases, don't use to navigate through screens, always get current screen elements and navigate then at end use locator data to generate code, if xpath is already present in sheet then directly add xpath locatorName to code if not then add the required xpath in comments which will then be added to the sheet manually
|
|
4
|
-
Project dedicated page deeplink -> https://housing.com/in/buy/projects/page/
|
|
5
|
+
Project dedicated page deeplink -> https://housing.com/in/buy/projects/page/16192-lotus-sky-garden-by-a-m-construction-and-lotus-group-in-malad-west
|
|
5
6
|
Filters on the filter screen may initially be offscreen and require scrolling to view.
|
|
6
7
|
Stop execution if any step fails.
|
|
7
8
|
IMPORTANT: If the element you looking for is not present you can use swipe
|
|
8
9
|
(Remember this properly - Very important) After the execution is successful/completed, do NOT analyze what you found or did; only generate Appium code.
|
|
9
10
|
Print the Java/Appium code. In our framework, we use the following methods:
|
|
10
11
|
- waitForElementToBeVisible("locator_key", Wait.SHORT); locator_key is locator key and wait can be SHORT, MEDIUM, or LONG.
|
|
11
|
-
-
|
|
12
|
+
- w3CGestures.scrollUp(n);; // n is the number of times to scroll. Up and Down in scroll methods are direction of finger movement.
|
|
13
|
+
- w3CGestures.scrollScreen("image_tour_navbar", ScrollDirection.MEDIUM_UP, 2); // image_tour_navbar is locator key, ScrollDirection can be SMALL_UP, MEDIUM_UP, LARGE_UP, SMALL_DOWN, MEDIUM_DOWN, LARGE_DOWN.
|
|
12
14
|
- navigateBack(); // for back action.
|
|
13
15
|
- deepLink.OpenDeepLink("deeplink_key"); // deeplink_key is deeplink name.
|
|
14
16
|
- getText("locator_key"); // to get text of element.
|
|
@@ -17,7 +19,7 @@ deepLink.OpenDeepLink(deeplink); // deeplink -> https://housing.com
|
|
|
17
19
|
waitForElementToBeVisible("view_on_map", Wait.LONG); // view_on_map=//android.widget.TextView[@text="View On Map"]; here xpath should be comments so it can be pasted in xpath sheet.
|
|
18
20
|
When giving output, please remove escape characters before double quotes.
|
|
19
21
|
Do similarly for click and sendKeys methods:
|
|
20
|
-
- click("search_select")
|
|
21
|
-
- sendKeys("locator_key", "string_to_be_passed", Wait.
|
|
22
|
+
- click("search_select", Wait.SHORT)
|
|
23
|
+
- sendKeys("locator_key", "string_to_be_passed", Wait.SHORT)
|
|
22
24
|
Figure out dynamic paths like //android.widget.TextView[@text="View 180 Properties"] here 180 is not constant so create a xpath like //android.widget.TextView[contains(@text,"View") and contains(@text,"Properties")]
|
|
23
25
|
For repeating logic, create loops
|
package/lib/server.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createMcpServer = void 0;
|
|
4
4
|
const fs = require('fs').promises;
|
|
5
|
+
const os = require('os');
|
|
5
6
|
const path = require('path');
|
|
6
7
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
7
8
|
const zod_1 = require("zod");
|
|
@@ -161,7 +162,7 @@ const createMcpServer = () => {
|
|
|
161
162
|
|
|
162
163
|
if (sheetName && sheetName.trim() !== '') {
|
|
163
164
|
// Load Google Sheets credentials with keyFile option (no manual parse)
|
|
164
|
-
|
|
165
|
+
const keyFile = path.join(os.homedir(), 'Desktop', 'secret.json');
|
|
165
166
|
|
|
166
167
|
|
|
167
168
|
const auth = new google.auth.GoogleAuth({
|
|
@@ -198,8 +199,7 @@ const createMcpServer = () => {
|
|
|
198
199
|
androidLocator: row[androidLocatorIdx],
|
|
199
200
|
}));
|
|
200
201
|
|
|
201
|
-
context.locatorData =
|
|
202
|
-
}
|
|
202
|
+
context.locatorData = lo
|
|
203
203
|
|
|
204
204
|
return `App context learned: ${JSON.stringify(context)}`;
|
|
205
205
|
} catch (error) {
|