@skyramp/mcp 0.0.24 → 0.0.26

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.
@@ -13,12 +13,35 @@ Only if NO existing function can be reused:
13
13
  4. Parameterize the test function(s) with meaningful parameters to make it more flexible. Preserve the original order of code lines within each function.
14
14
  5. Only extract reusable logical sections into helper functions. Use inline parameter types instead of creating interfaces or type definitions.
15
15
 
16
+ **IMPORT CLEANUP AFTER MODULARIZATION:**
17
+ After applying modularization principles:
18
+ 1. **Analyze Remaining Imports**: Review all import statements at the top of the file
19
+ 2. **Identify Unused Imports**: Check which imported modules, functions, or classes are no longer referenced in the modularized code
20
+ 3. **Remove Unused Imports**: Delete any import statements that are not used in the final modularized code
21
+ 4. **Preserve Required Imports**: Keep all imports that are actually used by the modularized functions
22
+ 5. **Maintain Import Order**: Preserve the original ordering of remaining imports for consistency
23
+
24
+ **IMPORT REMOVAL RULES:**
25
+ - Only remove imports that are completely unused after modularization
26
+ - Keep imports used by any function, even if usage decreased
27
+ - Preserve imports for types used in function parameters (inline types)
28
+ - Do not remove imports for testing frameworks or utilities
29
+ - Maintain proper import syntax and formatting
30
+
31
+ **LANGUAGE-SPECIFIC IMPORT HANDLING:**
32
+ - **Python**: Remove unused import and from...import statements
33
+ - **JavaScript/TypeScript**: Remove unused import and require() statements
34
+ - **Java**: Remove unused import statements
35
+ - **All Languages**: Preserve framework-specific imports (testing libraries, etc.)
36
+
16
37
  **CRITICAL CONSTRAINTS:**
17
38
  - NO interfaces, classes, types, or data structures
18
39
  - NO new test cases or logic
19
40
  - NO additional files
20
41
  - ONLY helper functions with inline types
21
42
  - PRESERVE original functionality exactly
43
+ - REMOVE unused imports after modularization
44
+ - DO NOT CREATE/UPDATE package.json or requirements.txt or pom.xml or build.gradle file
22
45
 
23
46
  **CRITICAL: If you skip any step, the modularization is incomplete. You MUST complete all steps before proceeding.FIX ERRORS IN MODULARIZED CODE USING skyramp_fix_errors TOOL**
24
47
  `;
@@ -30,11 +53,20 @@ export function getFixErrorsPrompt() {
30
53
  1. **Parameter Passing:** Identify functions using variables from outside scope (like 'page' object). Pass these as parameters.
31
54
  2. **Validate Correctness:** Ensure code is free of reference errors, undefined variables, runtime issues.
32
55
  3. **Import Paths:** Ensure import paths are correct and there are no circular imports.
33
- 4. **UI State Management:** Check for UI state conflicts, modal interference, or element interaction issues.
34
- 5. **Sequential Operations:** Ensure UI operations don't interfere with each other when called in sequence.
56
+ 4. **Import Validation:** Ensure all remaining imports are necessary and no missing imports cause reference errors.
57
+ 5. **Unused Import Cleanup:** Verify that unused imports were properly removed without breaking functionality.
58
+ 6. **UI State Management:** Check for UI state conflicts, modal interference, or element interaction issues.
59
+ 7. **Sequential Operations:** Ensure UI operations don't interfere with each other when called in sequence.
60
+
61
+ **IMPORT ERROR DEBUGGING:**
62
+ - Check for missing imports that cause undefined reference errors
63
+ - Verify that import removal didn't break existing functionality
64
+ - Ensure all imported modules are actually available in the project
65
+ - Confirm that import syntax is correct for the target language
35
66
 
36
67
  **KEY: Variables not defined within function scope MUST be passed as parameters.**
37
68
  **UI KEY: Helper functions that perform UI operations must be self-contained and not leave modals/dialogs open.**
69
+ **IMPORT KEY: All imports must be either used in the code or properly removed.**
38
70
  `;
39
71
  }
40
72
  export function getModularizationPromptForUI(filePath, language) {
@@ -49,6 +81,8 @@ export function getModularizationPromptForUI(filePath, language) {
49
81
 
50
82
  **COMMON CALCULATION FAILURE: UI tests fail when complex logic patterns (loops, conditionals, array handling) are incorrectly generalized in helper functions, causing wrong quantities, prices, or missing operations.**
51
83
 
84
+ **COMMON SELECTOR FAILURE: UI tests fail when specific selectors are generalized into generic ones, causing wrong elements to be clicked.**
85
+
52
86
  **MANDATORY ANALYSIS BEFORE MODULARIZATION:**
53
87
  Before creating any helper functions, identify ALL critical patterns in the original test:
54
88
  - Look for patterns like: page.getByTestId("navbar-*").click()
@@ -56,24 +90,28 @@ Before creating any helper functions, identify ALL critical patterns in the orig
56
90
  - Look for patterns like: page.goBack()
57
91
  - Look for complex loops with conditionals or null handling
58
92
  - Look for unique sequences that differ between similar operations
93
+ - Look for specific selector chains that target exact elements
59
94
  - These MUST remain in the main test function in their EXACT original positions and logic
60
95
 
61
96
  **CRITICAL RULE: If the original test performs operations in a specific sequence with unique logic for each step, DO NOT generalize this into a loop or helper function. Keep the exact original sequence.**
62
97
 
98
+ **SELECTOR PRESERVATION RULE: If the original test uses specific selector chains, DO NOT generalize them into generic selectors. Preserve the exact selector specificity.**
99
+
63
100
  STEPS:
64
101
  1. **PRESERVE EXACT UI SEQUENCE**: For UI TESTS, maintain the EXACT sequence of UI interactions. Do NOT extract steps that break the natural flow.
65
102
  2. **CAREFUL EXTRACTION**: Only extract helper functions for COMPLETE, REPEATABLE workflows that do NOT include navigation between different pages/sections and do NOT contain complex conditional logic.
66
103
  3. **PRESERVE UNIQUE STEPS**: If a workflow has unique steps (like clicking specific labels), DO NOT extract it into a generic helper function.
67
104
  4. **PRESERVE COMPLEX LOGIC**: If the original test has loops, conditionals, or array processing with unique patterns, DO NOT generalize these - keep them exactly as written.
68
- 5. **RESPONSE PROMISES**: Maintain the exact timing of response promise creation and awaiting. Do not move these into helper functions unless the entire request-response cycle is contained.
69
- 6. **PARAMETERIZATION**: When creating helper functions, ensure ALL required parameters (page, data objects, response promises) are passed correctly.
70
- 7. **VALIDATION**: Each extracted function must work independently without relying on external scope variables.
71
- 8. **PRESERVE ORIGINAL FLOW**: If the original code has different patterns for similar operations (like product creation), preserve those differences - they exist for a reason.
72
- 9. **NAVIGATION PRESERVATION**: CRITICAL - If the original test has navigation steps between similar operations (like clicking "navbar-products" between product creations), these MUST be preserved in the main test flow, NOT moved into helper functions.
105
+ 5. **PRESERVE SPECIFIC SELECTORS**: If the original test uses specific selector chains, maintain the exact same selectors in helper functions. Do not make them more generic.
106
+ 6. **RESPONSE PROMISES**: Maintain the exact timing of response promise creation and awaiting. Do not move these into helper functions unless the entire request-response cycle is contained.
107
+ 7. **PARAMETERIZATION**: When creating helper functions, ensure ALL required parameters (page, data objects, response promises) are passed correctly.
108
+ 8. **VALIDATION**: Each extracted function must work independently without relying on external scope variables.
109
+ 9. **PRESERVE ORIGINAL FLOW**: If the original code has different patterns for similar operations (like product creation), preserve those differences - they exist for a reason.
110
+ 10. **NAVIGATION PRESERVATION**: CRITICAL - If the original test has navigation steps between similar operations (like clicking "navbar-products" between product creations), these MUST be preserved in the main test flow, NOT moved into helper functions.
73
111
 
74
112
  **WHAT SHOULD BE EXTRACTED (SAFE TO EXTRACT):**
75
113
  - Simple form filling sequences within a single page/modal
76
- - Basic button clicking sequences within a single workflow
114
+ - Basic button clicking sequences within a single workflow that use the same specific selectors
77
115
  - Simple data entry that doesn't change page state
78
116
  - Basic assertions and validations within the same page context
79
117
 
@@ -85,21 +123,56 @@ STEPS:
85
123
  - Complex loops with conditionals or special handling
86
124
  - Operations with unique patterns that differ between similar workflows
87
125
  - Array processing with null handling or special indexing
126
+ - Button clicks with complex selector chains that are unique to specific contexts
127
+
128
+ **IMPORT CLEANUP AFTER MODULARIZATION:**
129
+ After applying modularization principles:
130
+ 1. **Analyze Remaining Imports**: Review all import statements at the top of the file
131
+ 2. **Identify Unused Imports**: Check which imported modules, functions, or classes are no longer referenced in the modularized code
132
+ 3. **Remove Unused Imports**: Delete any import statements that are not used in the final modularized code
133
+ 4. **Preserve Required Imports**: Keep all imports that are actually used by the modularized functions
134
+ 5. **Maintain Import Order**: Preserve the original ordering of remaining imports for consistency
135
+
136
+ **UI-SPECIFIC IMPORT CONSIDERATIONS:**
137
+ - Preserve all Playwright/testing framework imports (page, expect, test, etc.)
138
+ - Keep UI-specific utility imports even if usage appears reduced
139
+ - Maintain browser-specific imports that may be needed for UI operations
140
+ - Do not remove imports for UI components or page object models
141
+ - Preserve imports for locators, selectors, and UI interaction utilities
142
+
143
+ **IMPORT REMOVAL RULES FOR UI TESTS:**
144
+ - Only remove imports that are completely unused after modularization
145
+ - Keep imports used by any function, even if usage decreased
146
+ - Preserve imports for types used in function parameters (inline types)
147
+ - Do not remove imports for testing frameworks or utilities
148
+ - Maintain proper import syntax and formatting
149
+ - Be extra cautious with UI framework imports - they may be used in ways not immediately obvious
150
+
151
+ **LANGUAGE-SPECIFIC UI IMPORT HANDLING:**
152
+ - **Python**: Remove unused import and from...import statements, but keep pytest, playwright imports
153
+ - **JavaScript/TypeScript**: Remove unused import and require() statements, but preserve @playwright/test imports
154
+ - **Java**: Remove unused import statements, but keep testing framework imports
155
+ - **All Languages**: Always preserve UI testing framework and browser automation imports
88
156
 
89
157
  **CRITICAL CONSTRAINTS:**
90
158
  - NO interfaces, classes, types, or data structures
159
+ - DO NOT CREATE/UPDATE package.json or requirements.txt or pom.xml or build.gradle file
91
160
  - NO changes to the core UI interaction sequence
92
161
  - NO extraction of partial workflows that depend on external state
93
162
  - NO generalization of complex logic patterns into loops or helper functions
163
+ - NO generalization of specific selectors into generic ones
94
164
  - ONLY extract COMPLETE, self-contained operations that occur within the same page context
95
165
  - PRESERVE original functionality exactly
96
166
  - DO NOT extract steps that have unique UI interactions
97
167
  - DO NOT move navigation steps (like navbar clicks) into helper functions - keep them in the main test flow
98
168
  - PRESERVE all navigation between similar operations exactly as in the original test
169
+ - PRESERVE all specific selector chains exactly as in the original test
99
170
  - NAVIGATION STEPS MUST REMAIN IN THE MAIN TEST FUNCTION TO MAINTAIN PROPER PAGE STATE
100
171
  - COMPLEX LOGIC PATTERNS MUST REMAIN IN THE MAIN TEST FUNCTION TO MAINTAIN EXACT BEHAVIOR
172
+ - SPECIFIC SELECTORS MUST BE PRESERVED TO ENSURE CORRECT ELEMENT TARGETING
173
+ - REMOVE unused imports after modularization (following UI-specific import rules)
101
174
 
102
- **BEFORE SUBMITTING: Double-check that every navigation step and complex operation from the original test appears in the same position with the same logic in the main test function.**
175
+ **BEFORE SUBMITTING: Double-check that every navigation step, complex operation, and specific selector from the original test appears in the same position with the same logic in the main test function.**
103
176
 
104
177
  **CRITICAL: If you skip any step, the modularization is incomplete. You MUST complete all steps before proceeding.FIX ERRORS IN MODULARIZED CODE USING skyramp_fix_errors TOOL**
105
178
  `;
@@ -112,6 +185,8 @@ export function getFixErrorsPromptForUI() {
112
185
 
113
186
  **COMMON UI TEST CALCULATION ERROR: Order totals, quantities, or other calculated values may be incorrect if the original test's unique logic was incorrectly generalized in helper functions.**
114
187
 
188
+ **COMMON UI TEST SELECTOR ERROR: Tests fail when specific selectors are replaced with generic ones, causing wrong elements to be clicked or interacted with.**
189
+
115
190
  **IMMEDIATE TIMEOUT DEBUGGING STEPS:**
116
191
  1. Compare the original test and modularized test side by side
117
192
  2. Identify every navigation step in the original (navbar clicks, page.goto, etc.)
@@ -124,18 +199,28 @@ export function getFixErrorsPromptForUI() {
124
199
  3. Verify that loops and conditional logic in helper functions match the original exactly
125
200
  4. Look for cases where null/empty values in data arrays are handled differently
126
201
 
202
+ **IMMEDIATE SELECTOR ERROR DEBUGGING STEPS:**
203
+ 1. Compare selectors in the original vs modularized test
204
+ 2. Check if specific selector chains were replaced with generic selectors
205
+ 3. Verify that helper functions use the same exact selectors as the original
206
+ 4. Look for cases where container-specific selectors were made too generic
207
+
127
208
  **DETAILED FIX STEPS:**
128
209
  1. **UI Sequence Validation**: Verify that the exact UI interaction sequence from the original test is preserved. Check for missing clicks, form openings, or navigation steps.
129
210
  2. **Navigation Step Preservation**: CRITICAL - Ensure all navigation steps between similar operations (like "navbar-products" clicks between product creations) are preserved in the main test flow, not moved into helper functions.
130
211
  3. **Page State Debugging**: If test is timing out on element interactions, check if the page is in the expected state. Often this means navigation steps were incorrectly extracted.
131
212
  4. **Logic Preservation**: If test has incorrect calculations or missing operations, check if helper functions are generalizing logic that should remain unique to each operation.
132
- 5. **Parameter Passing**: Identify functions using variables from outside scope (like 'page' object, response promises, test data). Pass these as parameters.
133
- 6. **Response Promise Timing**: Ensure response promises are created and awaited at the exact same points as the original test.
134
- 7. **Unique Workflow Preservation**: If the original test has unique steps for similar operations, ensure these are preserved and not generalized incorrectly.
135
- 8. **Complete Workflow Validation**: Ensure that extracted helper functions contain COMPLETE workflows, not partial steps that depend on external state.
136
- 9. **Page State Management**: Verify that helper functions don't assume specific page states - the main test should handle navigation between different pages/states.
137
- 10. **Validate Correctness**: Ensure code is free of reference errors, undefined variables, runtime issues.
138
- 11. **Import Paths**: Ensure import paths are correct and there are no circular imports.
213
+ 5. **Selector Preservation**: If test is clicking wrong elements or failing to find elements, check if specific selectors were made too generic in helper functions.
214
+ 6. **Parameter Passing**: Identify functions using variables from outside scope (like 'page' object, response promises, test data). Pass these as parameters.
215
+ 7. **Response Promise Timing**: Ensure response promises are created and awaited at the exact same points as the original test.
216
+ 8. **Unique Workflow Preservation**: If the original test has unique steps for similar operations, ensure these are preserved and not generalized incorrectly.
217
+ 9. **Complete Workflow Validation**: Ensure that extracted helper functions contain COMPLETE workflows, not partial steps that depend on external state.
218
+ 10. **Page State Management**: Verify that helper functions don't assume specific page states - the main test should handle navigation between different pages/states.
219
+ 11. **Import Validation**: Ensure all remaining imports are necessary and no missing imports cause reference errors.
220
+ 12. **Unused Import Cleanup**: Verify that unused imports were properly removed without breaking UI test functionality.
221
+ 13. **UI Framework Import Preservation**: Ensure that critical UI testing imports (Playwright, testing frameworks) were not accidentally removed.
222
+ 14. **Validate Correctness**: Ensure code is free of reference errors, undefined variables, runtime issues.
223
+ 15. **Import Paths**: Ensure import paths are correct and there are no circular imports.
139
224
 
140
225
  **TIMEOUT DEBUGGING CHECKLIST:**
141
226
  - Are all navigation steps (navbar clicks, page.goto) in the main test function?
@@ -150,20 +235,41 @@ export function getFixErrorsPromptForUI() {
150
235
  - Are loops and conditionals in helper functions exact matches to the original logic?
151
236
  - Are quantities, prices, and other data values being processed identically?
152
237
 
153
- **SPECIFIC FIX FOR COMMON ERROR:**
154
- If you see timeout on "Add Product" button after product creation:
155
- - Check if navbar-products click was moved into a helper function
156
- - Move it back to the main test function between product creation calls
157
- - The page must navigate back to products listing before trying to add another product
238
+ **SELECTOR ERROR DEBUGGING CHECKLIST:**
239
+ - Are all selectors in helper functions exactly the same as in the original test?
240
+ - Were any specific container-based selectors replaced with generic ones?
241
+ - Do button clicks use the same selector specificity as the original?
242
+ - Are there any ambiguous selectors that could match multiple elements?
243
+
244
+ **IMPORT ERROR DEBUGGING CHECKLIST:**
245
+ - Are there any undefined reference errors due to missing imports?
246
+ - Were any critical UI framework imports (page, expect, test) accidentally removed?
247
+ - Do all remaining imports correspond to actually used functionality?
248
+ - Are import paths correct and accessible in the project structure?
249
+ - Were any imports removed that are used in non-obvious ways (like in string templates)?
250
+
251
+ **SPECIFIC FIX FOR COMMON ERRORS:**
252
+ If you see timeout on button clicks or element interactions:
253
+ - Check if navigation steps were moved into helper functions and move them back to main test
254
+ - Check if specific selectors were made generic and restore original selector specificity
255
+ - Verify the page is in the expected state before each interaction
256
+
257
+ If you see incorrect calculations or missing operations:
258
+ - Check if unique logic patterns were incorrectly generalized
259
+ - Verify all operations from original test are present in modularized version
260
+ - Look for null value handling differences
158
261
 
159
- If you see incorrect order totals or missing items:
160
- - Check if the original test has unique patterns for adding items that were incorrectly generalized
161
- - Verify that all items from the original test are being added in the modularized version
162
- - Look for cases where null values or special array handling was changed
262
+ If you see import or reference errors:
263
+ - Check if critical UI framework imports were accidentally removed
264
+ - Verify all remaining imports are necessary and properly used
265
+ - Restore any imports needed for UI interactions, even if usage seems minimal
266
+ - Confirm import paths match the project structure
163
267
 
164
268
  **KEY: Every UI interaction from the original test must be present in the modularized version.**
165
269
  **CRITICAL: Helper functions should only contain COMPLETE, self-contained workflows.**
166
270
  **NAVIGATION KEY: Navigation steps between operations must remain in the main test flow to maintain proper page state.**
167
271
  **CALCULATION KEY: Unique logic patterns should not be generalized if they produce different results.**
272
+ **SELECTOR KEY: Specific selectors must be preserved to ensure correct element targeting.**
273
+ **IMPORT KEY: All necessary imports must be preserved, especially UI framework imports.**
168
274
  `;
169
275
  }
@@ -15,6 +15,7 @@ export function registerTestGenerationPrompt(mcpServer) {
15
15
  - Provide clear execution instructions for generated tests
16
16
  - Answer questions about Skyramp capabilities and testing concepts
17
17
  - ALWAYS SHOW STEPS TO GENERATE TEST USING MCP TOOLS AND NEVER SHOW THE CLI COMMANDS.
18
+ - CRITICAL: UI, INTEGRATION, E2E TESTS MUST BE MODULARIZED USING skyramp_modularization TOOL. ALWAYS ADD A TASK TO MODULARIZE THE TEST USING skyramp_modularization TOOL AFTER GENERATING THESE(UI, INTEGRATION, E2E) TESTS.
18
19
 
19
20
  **CONTRACT TEST:**
20
21
  - Purpose: Ensures a service is properly communicating with another service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/mcp",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "main": "build/index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.11.4",
45
- "@skyramp/skyramp": "^1.2.18",
45
+ "@skyramp/skyramp": "^1.2.19",
46
46
  "dockerode": "^4.0.6",
47
47
  "zod": "^3.25.3"
48
48
  },