@skyramp/mcp 0.0.24 → 0.0.25
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.
|
@@ -49,6 +49,8 @@ export function getModularizationPromptForUI(filePath, language) {
|
|
|
49
49
|
|
|
50
50
|
**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
51
|
|
|
52
|
+
**COMMON SELECTOR FAILURE: UI tests fail when specific selectors are generalized into generic ones, causing wrong elements to be clicked.**
|
|
53
|
+
|
|
52
54
|
**MANDATORY ANALYSIS BEFORE MODULARIZATION:**
|
|
53
55
|
Before creating any helper functions, identify ALL critical patterns in the original test:
|
|
54
56
|
- Look for patterns like: page.getByTestId("navbar-*").click()
|
|
@@ -56,24 +58,28 @@ Before creating any helper functions, identify ALL critical patterns in the orig
|
|
|
56
58
|
- Look for patterns like: page.goBack()
|
|
57
59
|
- Look for complex loops with conditionals or null handling
|
|
58
60
|
- Look for unique sequences that differ between similar operations
|
|
61
|
+
- Look for specific selector chains that target exact elements
|
|
59
62
|
- These MUST remain in the main test function in their EXACT original positions and logic
|
|
60
63
|
|
|
61
64
|
**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
65
|
|
|
66
|
+
**SELECTOR PRESERVATION RULE: If the original test uses specific selector chains, DO NOT generalize them into generic selectors. Preserve the exact selector specificity.**
|
|
67
|
+
|
|
63
68
|
STEPS:
|
|
64
69
|
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
70
|
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
71
|
3. **PRESERVE UNIQUE STEPS**: If a workflow has unique steps (like clicking specific labels), DO NOT extract it into a generic helper function.
|
|
67
72
|
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. **
|
|
69
|
-
6. **
|
|
70
|
-
7. **
|
|
71
|
-
8. **
|
|
72
|
-
9. **
|
|
73
|
+
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.
|
|
74
|
+
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.
|
|
75
|
+
7. **PARAMETERIZATION**: When creating helper functions, ensure ALL required parameters (page, data objects, response promises) are passed correctly.
|
|
76
|
+
8. **VALIDATION**: Each extracted function must work independently without relying on external scope variables.
|
|
77
|
+
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.
|
|
78
|
+
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
79
|
|
|
74
80
|
**WHAT SHOULD BE EXTRACTED (SAFE TO EXTRACT):**
|
|
75
81
|
- Simple form filling sequences within a single page/modal
|
|
76
|
-
- Basic button clicking sequences within a single workflow
|
|
82
|
+
- Basic button clicking sequences within a single workflow that use the same specific selectors
|
|
77
83
|
- Simple data entry that doesn't change page state
|
|
78
84
|
- Basic assertions and validations within the same page context
|
|
79
85
|
|
|
@@ -85,21 +91,25 @@ STEPS:
|
|
|
85
91
|
- Complex loops with conditionals or special handling
|
|
86
92
|
- Operations with unique patterns that differ between similar workflows
|
|
87
93
|
- Array processing with null handling or special indexing
|
|
94
|
+
- Button clicks with complex selector chains that are unique to specific contexts
|
|
88
95
|
|
|
89
96
|
**CRITICAL CONSTRAINTS:**
|
|
90
97
|
- NO interfaces, classes, types, or data structures
|
|
91
98
|
- NO changes to the core UI interaction sequence
|
|
92
99
|
- NO extraction of partial workflows that depend on external state
|
|
93
100
|
- NO generalization of complex logic patterns into loops or helper functions
|
|
101
|
+
- NO generalization of specific selectors into generic ones
|
|
94
102
|
- ONLY extract COMPLETE, self-contained operations that occur within the same page context
|
|
95
103
|
- PRESERVE original functionality exactly
|
|
96
104
|
- DO NOT extract steps that have unique UI interactions
|
|
97
105
|
- DO NOT move navigation steps (like navbar clicks) into helper functions - keep them in the main test flow
|
|
98
106
|
- PRESERVE all navigation between similar operations exactly as in the original test
|
|
107
|
+
- PRESERVE all specific selector chains exactly as in the original test
|
|
99
108
|
- NAVIGATION STEPS MUST REMAIN IN THE MAIN TEST FUNCTION TO MAINTAIN PROPER PAGE STATE
|
|
100
109
|
- COMPLEX LOGIC PATTERNS MUST REMAIN IN THE MAIN TEST FUNCTION TO MAINTAIN EXACT BEHAVIOR
|
|
110
|
+
- SPECIFIC SELECTORS MUST BE PRESERVED TO ENSURE CORRECT ELEMENT TARGETING
|
|
101
111
|
|
|
102
|
-
**BEFORE SUBMITTING: Double-check that every navigation step
|
|
112
|
+
**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
113
|
|
|
104
114
|
**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
115
|
`;
|
|
@@ -112,6 +122,8 @@ export function getFixErrorsPromptForUI() {
|
|
|
112
122
|
|
|
113
123
|
**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
124
|
|
|
125
|
+
**COMMON UI TEST SELECTOR ERROR: Tests fail when specific selectors are replaced with generic ones, causing wrong elements to be clicked or interacted with.**
|
|
126
|
+
|
|
115
127
|
**IMMEDIATE TIMEOUT DEBUGGING STEPS:**
|
|
116
128
|
1. Compare the original test and modularized test side by side
|
|
117
129
|
2. Identify every navigation step in the original (navbar clicks, page.goto, etc.)
|
|
@@ -124,18 +136,25 @@ export function getFixErrorsPromptForUI() {
|
|
|
124
136
|
3. Verify that loops and conditional logic in helper functions match the original exactly
|
|
125
137
|
4. Look for cases where null/empty values in data arrays are handled differently
|
|
126
138
|
|
|
139
|
+
**IMMEDIATE SELECTOR ERROR DEBUGGING STEPS:**
|
|
140
|
+
1. Compare selectors in the original vs modularized test
|
|
141
|
+
2. Check if specific selector chains were replaced with generic selectors
|
|
142
|
+
3. Verify that helper functions use the same exact selectors as the original
|
|
143
|
+
4. Look for cases where container-specific selectors were made too generic
|
|
144
|
+
|
|
127
145
|
**DETAILED FIX STEPS:**
|
|
128
146
|
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
147
|
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
148
|
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
149
|
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. **
|
|
133
|
-
6. **
|
|
134
|
-
7. **
|
|
135
|
-
8. **
|
|
136
|
-
9. **
|
|
137
|
-
10. **
|
|
138
|
-
11. **
|
|
150
|
+
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.
|
|
151
|
+
6. **Parameter Passing**: Identify functions using variables from outside scope (like 'page' object, response promises, test data). Pass these as parameters.
|
|
152
|
+
7. **Response Promise Timing**: Ensure response promises are created and awaited at the exact same points as the original test.
|
|
153
|
+
8. **Unique Workflow Preservation**: If the original test has unique steps for similar operations, ensure these are preserved and not generalized incorrectly.
|
|
154
|
+
9. **Complete Workflow Validation**: Ensure that extracted helper functions contain COMPLETE workflows, not partial steps that depend on external state.
|
|
155
|
+
10. **Page State Management**: Verify that helper functions don't assume specific page states - the main test should handle navigation between different pages/states.
|
|
156
|
+
11. **Validate Correctness**: Ensure code is free of reference errors, undefined variables, runtime issues.
|
|
157
|
+
12. **Import Paths**: Ensure import paths are correct and there are no circular imports.
|
|
139
158
|
|
|
140
159
|
**TIMEOUT DEBUGGING CHECKLIST:**
|
|
141
160
|
- Are all navigation steps (navbar clicks, page.goto) in the main test function?
|
|
@@ -150,20 +169,27 @@ export function getFixErrorsPromptForUI() {
|
|
|
150
169
|
- Are loops and conditionals in helper functions exact matches to the original logic?
|
|
151
170
|
- Are quantities, prices, and other data values being processed identically?
|
|
152
171
|
|
|
153
|
-
**
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
172
|
+
**SELECTOR ERROR DEBUGGING CHECKLIST:**
|
|
173
|
+
- Are all selectors in helper functions exactly the same as in the original test?
|
|
174
|
+
- Were any specific container-based selectors replaced with generic ones?
|
|
175
|
+
- Do button clicks use the same selector specificity as the original?
|
|
176
|
+
- Are there any ambiguous selectors that could match multiple elements?
|
|
177
|
+
|
|
178
|
+
**SPECIFIC FIX FOR COMMON ERRORS:**
|
|
179
|
+
If you see timeout on button clicks or element interactions:
|
|
180
|
+
- Check if navigation steps were moved into helper functions and move them back to main test
|
|
181
|
+
- Check if specific selectors were made generic and restore original selector specificity
|
|
182
|
+
- Verify the page is in the expected state before each interaction
|
|
158
183
|
|
|
159
|
-
If you see incorrect
|
|
160
|
-
- Check if
|
|
161
|
-
- Verify
|
|
162
|
-
- Look for
|
|
184
|
+
If you see incorrect calculations or missing operations:
|
|
185
|
+
- Check if unique logic patterns were incorrectly generalized
|
|
186
|
+
- Verify all operations from original test are present in modularized version
|
|
187
|
+
- Look for null value handling differences
|
|
163
188
|
|
|
164
189
|
**KEY: Every UI interaction from the original test must be present in the modularized version.**
|
|
165
190
|
**CRITICAL: Helper functions should only contain COMPLETE, self-contained workflows.**
|
|
166
191
|
**NAVIGATION KEY: Navigation steps between operations must remain in the main test flow to maintain proper page state.**
|
|
167
192
|
**CALCULATION KEY: Unique logic patterns should not be generalized if they produce different results.**
|
|
193
|
+
**SELECTOR KEY: Specific selectors must be preserved to ensure correct element targeting.**
|
|
168
194
|
`;
|
|
169
195
|
}
|
|
@@ -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
|