@nbakka/mcp-appium 3.0.11 → 3.0.13
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 +3 -3
- package/lib/server.js +101 -2
- package/lib/testcases-generation-context.txt +12 -3
- package/package.json +1 -1
package/lib/app_context.txt
CHANGED
|
@@ -18,9 +18,9 @@ IMPORTANT: If the element you looking for is not present you can use swipe
|
|
|
18
18
|
- sendKeys("locator_key", "string_to_be_passed", Wait.SHORT)
|
|
19
19
|
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")]
|
|
20
20
|
For repeating logic, create loops
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
** SAMPLE
|
|
21
|
+
No need to add comments in code and only mention locators that are new and not present in the locator sheet in comments at end of file as shown in sample code below.
|
|
22
|
+
Automation code has to be generated only for approved test cases
|
|
23
|
+
** SAMPLE TESTCASES Automation code has to be generated only for approved test cases**
|
|
24
24
|
/**
|
|
25
25
|
* Test Method for Nearby Properties Verification on New Project Dedicated Page
|
|
26
26
|
* Verifies that clicking on nearby properties opens the correct detail page
|
package/lib/server.js
CHANGED
|
@@ -149,9 +149,9 @@ const createMcpServer = () => {
|
|
|
149
149
|
|
|
150
150
|
tool(
|
|
151
151
|
"mobile_learn_current_app_context",
|
|
152
|
-
"Follow these instructions strictly to navigate through the app. This should be the first step after launching the app and before performing any tests.
|
|
152
|
+
"Follow these instructions strictly to navigate through the app. This should be the first step after launching the app and before performing any tests. Google Sheet name to fetch locatorName and androidLocator from the specified sheet. NOTE: Only use the locator data from the Google Sheet at the end while generating test cases, don't use to navigate through screens",
|
|
153
153
|
{
|
|
154
|
-
sheetName: zod_1.z.string().describe("The name of the Google Sheet to fetch locator data from"),
|
|
154
|
+
sheetName: zod_1.z.string().describe("The name of the Google Sheet to fetch locator data from").default("PDP"),
|
|
155
155
|
},
|
|
156
156
|
async ({ sheetName }) => {
|
|
157
157
|
try {
|
|
@@ -1568,6 +1568,105 @@ tool(
|
|
|
1568
1568
|
}
|
|
1569
1569
|
);
|
|
1570
1570
|
|
|
1571
|
+
tool(
|
|
1572
|
+
"update_testcases_to_tcms",
|
|
1573
|
+
"Create new test cases in TCMS from approved test cases. Only processes test cases with 'New' status, ignores Modify and Remove cases since APIs are not available.",
|
|
1574
|
+
{
|
|
1575
|
+
testCases: zod_1.z.array(zod_1.z.array(zod_1.z.string())).describe("Array of test case arrays from approved test cases")
|
|
1576
|
+
},
|
|
1577
|
+
async ({ testCases }) => {
|
|
1578
|
+
try {
|
|
1579
|
+
// Load AIO token from Desktop/aio.json
|
|
1580
|
+
const aioConfigPath = path.join(os.homedir(), "Desktop", "aio.json");
|
|
1581
|
+
const configContent = await fs.readFile(aioConfigPath, "utf-8");
|
|
1582
|
+
const { token } = JSON.parse(configContent);
|
|
1583
|
+
|
|
1584
|
+
if (!token) throw new Error("AIO token missing in aio.json");
|
|
1585
|
+
|
|
1586
|
+
// Filter test cases to extract only "New" test cases
|
|
1587
|
+
const newTestCases = [];
|
|
1588
|
+
|
|
1589
|
+
for (const testCase of testCases) {
|
|
1590
|
+
if (Array.isArray(testCase) && testCase.length >= 2) {
|
|
1591
|
+
// Check if the last element or second-to-last element is "New"
|
|
1592
|
+
const status = testCase.length === 2 ? testCase[1] : testCase[testCase.length - 2];
|
|
1593
|
+
|
|
1594
|
+
if (status && status.toLowerCase() === 'new') {
|
|
1595
|
+
const title = testCase[0]; // First element is always the title
|
|
1596
|
+
if (title && title.trim().length > 0) {
|
|
1597
|
+
newTestCases.push(title.trim());
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
if (newTestCases.length === 0) {
|
|
1604
|
+
return "No new test cases found to create in TCMS. Only test cases marked as '(New)' are processed.";
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
// Hard-coded values as requested
|
|
1608
|
+
const projectKey = "SCRUM";
|
|
1609
|
+
const folderId = 1;
|
|
1610
|
+
const ownerId = "712020:37085ff2-5a05-47eb-8977-50a485355755";
|
|
1611
|
+
|
|
1612
|
+
// Create test cases in TCMS one by one
|
|
1613
|
+
for (let i = 0; i < newTestCases.length; i++) {
|
|
1614
|
+
const title = newTestCases[i];
|
|
1615
|
+
|
|
1616
|
+
try {
|
|
1617
|
+
const requestBody = {
|
|
1618
|
+
title: title,
|
|
1619
|
+
ownedByID: ownerId,
|
|
1620
|
+
folder: {
|
|
1621
|
+
ID: folderId
|
|
1622
|
+
},
|
|
1623
|
+
status: {
|
|
1624
|
+
name: "Published",
|
|
1625
|
+
description: "The test is ready for execution",
|
|
1626
|
+
ID: 1
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1630
|
+
(0, logger_1.trace)(`Creating test case ${i + 1}/${newTestCases.length}: ${title}`);
|
|
1631
|
+
|
|
1632
|
+
const response = await axios.post(
|
|
1633
|
+
`https://tcms.aiojiraapps.com/aio-tcms/api/v1/project/${projectKey}/testcase`,
|
|
1634
|
+
requestBody,
|
|
1635
|
+
{
|
|
1636
|
+
headers: {
|
|
1637
|
+
"accept": "application/json;charset=utf-8",
|
|
1638
|
+
"Authorization": `AioAuth ${token}`,
|
|
1639
|
+
"Content-Type": "application/json"
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
);
|
|
1643
|
+
|
|
1644
|
+
if (response.status === 200 || response.status === 201) {
|
|
1645
|
+
const testCaseKey = response.data.key || `${projectKey}-TC-${response.data.ID}`;
|
|
1646
|
+
(0, logger_1.trace)(`Successfully created test case: ${testCaseKey} - ${title}`);
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
// Add a small delay between requests to avoid rate limiting
|
|
1650
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
1651
|
+
|
|
1652
|
+
} catch (error) {
|
|
1653
|
+
(0, logger_1.trace)(`Failed to create test case: ${title} - ${error.message}`);
|
|
1654
|
+
throw new Error(`Failed to create test case "${title}": ${error.message}`);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
return "All test cases have been updated to TCMS";
|
|
1659
|
+
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
console.error('TCMS update error:', error);
|
|
1662
|
+
if (error.response) {
|
|
1663
|
+
return `❌ TCMS API Error: ${error.response.status} - ${error.response.data?.message || error.response.statusText}`;
|
|
1664
|
+
}
|
|
1665
|
+
return `❌ Error updating test cases to TCMS: ${error.message}`;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
);
|
|
1669
|
+
|
|
1571
1670
|
return server;
|
|
1572
1671
|
};
|
|
1573
1672
|
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
When asked to generate automation test cases for a jira ticket, the flow is as follows (Should not ask for user input till the last step):
|
|
2
|
+
by using mcp tools
|
|
3
|
+
1. Read the jira summary and description to understand the changes made in the feature.
|
|
4
|
+
2. Look at the figma design link provided in the jira ticket to understand the UI changes
|
|
5
|
+
3. Based on the changes mentioned in the jira summary and description, and the figma design, generate test cases
|
|
6
|
+
4. Approval from user is needed for the generated test cases
|
|
7
|
+
5. Once the test cases are approved by user, learn mobile app context
|
|
8
|
+
6. Generate automation code for the approved test cases or modify existing for linked test files
|
|
1
9
|
generate test cases using jira summary, description and figma image,
|
|
2
10
|
don't wait for extra user input,
|
|
3
11
|
test cases scope should be only for the changes mentioned in jira summary and description,
|
|
@@ -16,9 +24,10 @@ should contains before test case from tcms and after testcase that is generated,
|
|
|
16
24
|
existing in TCMS and if change is to be done to it should be marked as Modify
|
|
17
25
|
"SCRUM-TC-2" - id of existing test case in TCMS, only for Remove and Modify test cases
|
|
18
26
|
if any new test case is to be created then don't mention any id against it
|
|
19
|
-
for review_testcases
|
|
27
|
+
for review_testcases and update_testcases_to_tcms tool data should be in this format, strictly follow this format espcially for Modify test cases
|
|
20
28
|
{"testCases":[["Verify that brochure section is visible under overview tab","Verify brochure section is removed from property tour tab","Modify","SCRUM-TC-1"],
|
|
21
29
|
["Verify similar properties section is visible under over tab in pdp section","Remove","SCRUM-TC-2"],
|
|
22
30
|
["Verify Project Brochure section appears above the 'Explore on map' section in Overview tab","New"]]}
|
|
23
|
-
|
|
24
|
-
NOTE: keep polling continously for 10 times max till the test cases are approved by user
|
|
31
|
+
for update_testcases_to_tcms tool, send only test cases approved by user
|
|
32
|
+
NOTE: keep polling continously for 10 times max till the test cases are approved by user, don't wait for user input
|
|
33
|
+
Automation code has to be generated only for approved test cases
|