testchimp-runner-core 0.0.32 → 0.0.33
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/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +47 -3
- package/dist/prompts.js.map +1 -1
- package/package.json +1 -1
- package/src/prompts.ts +47 -3
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,OAAO;;;yBAKC,MAAM;;;;yBAON,MAAM;;;;yBAON,MAAM;;;;gCAWC,MAAM,oBAAoB,MAAM,EAAE,YAAY,GAAG;;;;gCAiIjD,MAAM,gBAAgB,MAAM,gBAAgB,MAAM,YAAY,GAAG;;;;gCA6DjE,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;gCA0R7F,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;gCAwC7F,MAAM,0BAA0B,MAAM,sBAAsB,MAAM,iBAAiB,MAAM,EAAE,oBAAoB,MAAM,EAAE,YAAY,GAAG;;;;gCA0CtI,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;uBAuCtG,MAAM;;;;gCAiBG,MAAM,YAAY,MAAM,gBAAgB,MAAM,YAAY,GAAG,kBAAkB,MAAM,iBAAiB,MAAM;;;;+
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,OAAO;;;yBAKC,MAAM;;;;yBAON,MAAM;;;;yBAON,MAAM;;;;gCAWC,MAAM,oBAAoB,MAAM,EAAE,YAAY,GAAG;;;;gCAiIjD,MAAM,gBAAgB,MAAM,gBAAgB,MAAM,YAAY,GAAG;;;;gCA6DjE,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;gCA0R7F,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;gCAwC7F,MAAM,0BAA0B,MAAM,sBAAsB,MAAM,iBAAiB,MAAM,EAAE,oBAAoB,MAAM,EAAE,YAAY,GAAG;;;;gCA0CtI,MAAM,YAAY,GAAG,oBAAoB,MAAM,kBAAkB,MAAM,gBAAgB,MAAM;;;;uBAuCtG,MAAM;;;;gCAiBG,MAAM,YAAY,MAAM,gBAAgB,MAAM,YAAY,GAAG,kBAAkB,MAAM,iBAAiB,MAAM;;;;+BAoF7G,MAAM,iBAAiB,MAAM;;;;+BAqC7B,MAAM,iBAAiB,MAAM,mBAAmB,MAAM;;;;uBA+B9D,MAAM;;CAuCxB,CAAC"}
|
package/dist/prompts.js
CHANGED
|
@@ -622,7 +622,7 @@ Return JSON: {"steps": [{"description": "...", "code": "..."}, ...]}`
|
|
|
622
622
|
},
|
|
623
623
|
// Repair suggestion
|
|
624
624
|
REPAIR_SUGGESTION: {
|
|
625
|
-
SYSTEM: 'You are an expert test automation engineer specializing in fixing failing Playwright tests. Analyze the current DOM state, error message, and step description to suggest the best repair action. Consider the failure history to avoid repeating the same mistakes.',
|
|
625
|
+
SYSTEM: 'You are an expert test automation engineer specializing in fixing failing Playwright tests. Analyze the current DOM state, error message, and step description to suggest the best repair action. Consider the failure history to avoid repeating the same mistakes. CRITICAL: Only use valid Playwright API methods.',
|
|
626
626
|
USER: (stepDescription, stepCode, errorMessage, pageInfo, failureHistory, recentRepairs) => `Analyze this failing Playwright test step and suggest a repair action.
|
|
627
627
|
|
|
628
628
|
Current Step:
|
|
@@ -640,11 +640,55 @@ ${pageInfo.formattedElements}
|
|
|
640
640
|
|
|
641
641
|
${recentRepairs}
|
|
642
642
|
|
|
643
|
+
VALID PLAYWRIGHT API METHODS (DO NOT use methods not listed here):
|
|
644
|
+
|
|
645
|
+
Locator Methods:
|
|
646
|
+
- .click({ force: true }) // Force click even if element is covered
|
|
647
|
+
- .click({ timeout: 10000 }) // Increase timeout
|
|
648
|
+
- .fill(value)
|
|
649
|
+
- .type(value, { delay: 100 }) // Type with delay
|
|
650
|
+
- .press('Enter')
|
|
651
|
+
- .selectOption(value)
|
|
652
|
+
- .check() / .uncheck()
|
|
653
|
+
- .scrollIntoViewIfNeeded() // NOT scrollIntoView() - that doesn't exist!
|
|
654
|
+
- .waitFor({ state: 'visible' })
|
|
655
|
+
- .waitFor({ state: 'attached' })
|
|
656
|
+
- .isVisible()
|
|
657
|
+
- .isEnabled()
|
|
658
|
+
- .count()
|
|
659
|
+
- .first() / .last() / .nth(index)
|
|
660
|
+
- .filter({ hasText: 'text' })
|
|
661
|
+
|
|
662
|
+
Page Methods:
|
|
663
|
+
- page.goto(url, { waitUntil: 'networkidle' })
|
|
664
|
+
- page.waitForLoadState('networkidle')
|
|
665
|
+
- page.waitForTimeout(ms)
|
|
666
|
+
- page.evaluate(() => window.scrollBy(0, 500)) // Scroll page
|
|
667
|
+
- page.getByRole(role, { name: 'text' })
|
|
668
|
+
- page.getByText('text')
|
|
669
|
+
- page.getByLabel('text')
|
|
670
|
+
- page.getByPlaceholder('text')
|
|
671
|
+
- page.getByTestId('id')
|
|
672
|
+
- page.locator('selector')
|
|
673
|
+
|
|
674
|
+
COMMON FIXES FOR "element outside viewport":
|
|
675
|
+
- Use { force: true } option: await locator.click({ force: true });
|
|
676
|
+
- Scroll page first: await page.evaluate(() => window.scrollBy(0, 300));
|
|
677
|
+
- Wait longer: await locator.click({ timeout: 10000 });
|
|
678
|
+
- Click parent/container instead if element has overlays
|
|
679
|
+
|
|
680
|
+
INVALID METHODS TO AVOID:
|
|
681
|
+
- ❌ .scrollIntoView() - DOES NOT EXIST (use .scrollIntoViewIfNeeded() instead)
|
|
682
|
+
- ❌ .scrollIntoView({ behavior: 'smooth' }) - WRONG API
|
|
683
|
+
- ❌ Any jQuery methods - This is Playwright, not jQuery
|
|
684
|
+
|
|
643
685
|
Choose the best repair action:
|
|
644
686
|
1. MODIFY - Fix the current step with better selectors, waits, or logic
|
|
645
|
-
2. INSERT - Add a new step before the current one (e.g., wait for element,
|
|
687
|
+
2. INSERT - Add a new step before the current one (e.g., wait for element, handle popups)
|
|
646
688
|
3. REMOVE - Skip this step entirely if it's not essential
|
|
647
689
|
|
|
690
|
+
IMPORTANT: Your repair code MUST use ONLY valid Playwright API methods listed above!
|
|
691
|
+
|
|
648
692
|
Respond with JSON:
|
|
649
693
|
{
|
|
650
694
|
"shouldContinue": true/false,
|
|
@@ -653,7 +697,7 @@ ${pageInfo.formattedElements}
|
|
|
653
697
|
"operation": "MODIFY|INSERT|REMOVE",
|
|
654
698
|
"newStep": {
|
|
655
699
|
"description": "step description",
|
|
656
|
-
"code": "await page.getByRole('button', { name: 'Submit' }).click();"
|
|
700
|
+
"code": "await page.getByRole('button', { name: 'Submit' }).click({ force: true });"
|
|
657
701
|
}
|
|
658
702
|
}
|
|
659
703
|
}`
|
package/dist/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEU,QAAA,OAAO,GAAG;IACrB,uBAAuB;IACvB,oBAAoB,EAAE;QACpB,MAAM,EAAE,6nBAA6nB;QAEroB,IAAI,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,8EAA8E,QAAQ,i5BAAi5B;KACpgC;IAED,2CAA2C;IAC3C,kBAAkB,EAAE;QAClB,MAAM,EAAE,gRAAgR;QAExR,IAAI,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,+FAA+F,QAAQ,gzBAAgzB;KACp7B;IAED,qBAAqB;IACrB,kBAAkB,EAAE;QAClB,MAAM,EAAE,gHAAgH;QAExH,IAAI,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC;;EAE9B,QAAQ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E,YAAoB,EAAE,QAAa,EAAE,cAAsB,EAAE,aAAqB,EAAE,EAAE,CAAC;;;mBAG1H,eAAe;YACtB,QAAQ;aACP,YAAY;;;aAGZ,QAAQ,CAAC,GAAG;eACV,QAAQ,CAAC,KAAK;;EAE3B,QAAQ,CAAC,iBAAiB;;MAEtB,cAAc;;MAEd,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA8Db;KACH;IAED,+BAA+B;IAC/B,iBAAiB,EAAE;QACjB,MAAM,EAAE,sJAAsJ;QAE9J,IAAI,EAAE,CAAC,cAAsB,EAAE,aAAqB,EAAE,EAAE,CAAC;;;cAG/C,cAAc;;;cAGd,aAAa;;;;;;;;;;;;;;;;;;;;;;;;cAwBb;KACX;IAED,0BAA0B;IAC1B,YAAY,EAAE;QACZ,MAAM,EAAE,6LAA6L;QAErM,IAAI,EAAE,CAAC,cAAsB,EAAE,aAAqB,EAAE,eAAuB,EAAE,EAAE,CAAC;;;cAGxE,cAAc;;;cAGd,aAAa;;;cAGb,eAAe;;;;;;;;;;;;;;;cAef;KACX;IAED,0CAA0C;IAC1C,cAAc,EAAE;QACd,MAAM,EAAE,2JAA2J;QAEnK,IAAI,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC;;;EAG5B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCN;KACC;CACF,CAAC"}
|
package/package.json
CHANGED
package/src/prompts.ts
CHANGED
|
@@ -640,7 +640,7 @@ Return JSON: {"steps": [{"description": "...", "code": "..."}, ...]}`
|
|
|
640
640
|
|
|
641
641
|
// Repair suggestion
|
|
642
642
|
REPAIR_SUGGESTION: {
|
|
643
|
-
SYSTEM: 'You are an expert test automation engineer specializing in fixing failing Playwright tests. Analyze the current DOM state, error message, and step description to suggest the best repair action. Consider the failure history to avoid repeating the same mistakes.',
|
|
643
|
+
SYSTEM: 'You are an expert test automation engineer specializing in fixing failing Playwright tests. Analyze the current DOM state, error message, and step description to suggest the best repair action. Consider the failure history to avoid repeating the same mistakes. CRITICAL: Only use valid Playwright API methods.',
|
|
644
644
|
|
|
645
645
|
USER: (stepDescription: string, stepCode: string, errorMessage: string, pageInfo: any, failureHistory: string, recentRepairs: string) => `Analyze this failing Playwright test step and suggest a repair action.
|
|
646
646
|
|
|
@@ -659,11 +659,55 @@ ${pageInfo.formattedElements}
|
|
|
659
659
|
|
|
660
660
|
${recentRepairs}
|
|
661
661
|
|
|
662
|
+
VALID PLAYWRIGHT API METHODS (DO NOT use methods not listed here):
|
|
663
|
+
|
|
664
|
+
Locator Methods:
|
|
665
|
+
- .click({ force: true }) // Force click even if element is covered
|
|
666
|
+
- .click({ timeout: 10000 }) // Increase timeout
|
|
667
|
+
- .fill(value)
|
|
668
|
+
- .type(value, { delay: 100 }) // Type with delay
|
|
669
|
+
- .press('Enter')
|
|
670
|
+
- .selectOption(value)
|
|
671
|
+
- .check() / .uncheck()
|
|
672
|
+
- .scrollIntoViewIfNeeded() // NOT scrollIntoView() - that doesn't exist!
|
|
673
|
+
- .waitFor({ state: 'visible' })
|
|
674
|
+
- .waitFor({ state: 'attached' })
|
|
675
|
+
- .isVisible()
|
|
676
|
+
- .isEnabled()
|
|
677
|
+
- .count()
|
|
678
|
+
- .first() / .last() / .nth(index)
|
|
679
|
+
- .filter({ hasText: 'text' })
|
|
680
|
+
|
|
681
|
+
Page Methods:
|
|
682
|
+
- page.goto(url, { waitUntil: 'networkidle' })
|
|
683
|
+
- page.waitForLoadState('networkidle')
|
|
684
|
+
- page.waitForTimeout(ms)
|
|
685
|
+
- page.evaluate(() => window.scrollBy(0, 500)) // Scroll page
|
|
686
|
+
- page.getByRole(role, { name: 'text' })
|
|
687
|
+
- page.getByText('text')
|
|
688
|
+
- page.getByLabel('text')
|
|
689
|
+
- page.getByPlaceholder('text')
|
|
690
|
+
- page.getByTestId('id')
|
|
691
|
+
- page.locator('selector')
|
|
692
|
+
|
|
693
|
+
COMMON FIXES FOR "element outside viewport":
|
|
694
|
+
- Use { force: true } option: await locator.click({ force: true });
|
|
695
|
+
- Scroll page first: await page.evaluate(() => window.scrollBy(0, 300));
|
|
696
|
+
- Wait longer: await locator.click({ timeout: 10000 });
|
|
697
|
+
- Click parent/container instead if element has overlays
|
|
698
|
+
|
|
699
|
+
INVALID METHODS TO AVOID:
|
|
700
|
+
- ❌ .scrollIntoView() - DOES NOT EXIST (use .scrollIntoViewIfNeeded() instead)
|
|
701
|
+
- ❌ .scrollIntoView({ behavior: 'smooth' }) - WRONG API
|
|
702
|
+
- ❌ Any jQuery methods - This is Playwright, not jQuery
|
|
703
|
+
|
|
662
704
|
Choose the best repair action:
|
|
663
705
|
1. MODIFY - Fix the current step with better selectors, waits, or logic
|
|
664
|
-
2. INSERT - Add a new step before the current one (e.g., wait for element,
|
|
706
|
+
2. INSERT - Add a new step before the current one (e.g., wait for element, handle popups)
|
|
665
707
|
3. REMOVE - Skip this step entirely if it's not essential
|
|
666
708
|
|
|
709
|
+
IMPORTANT: Your repair code MUST use ONLY valid Playwright API methods listed above!
|
|
710
|
+
|
|
667
711
|
Respond with JSON:
|
|
668
712
|
{
|
|
669
713
|
"shouldContinue": true/false,
|
|
@@ -672,7 +716,7 @@ ${pageInfo.formattedElements}
|
|
|
672
716
|
"operation": "MODIFY|INSERT|REMOVE",
|
|
673
717
|
"newStep": {
|
|
674
718
|
"description": "step description",
|
|
675
|
-
"code": "await page.getByRole('button', { name: 'Submit' }).click();"
|
|
719
|
+
"code": "await page.getByRole('button', { name: 'Submit' }).click({ force: true });"
|
|
676
720
|
}
|
|
677
721
|
}
|
|
678
722
|
}`
|