Skip to content

Commit bf911b1

Browse files
fix: remove unused variables and prompt instructions
1 parent b3c5fc6 commit bf911b1

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

webqa_agent/testers/case_gen/graph.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def plan_test_cases(state: MainGraphState) -> Dict[str, List[Dict[str, Any
8585
logging.info(f"Deep crawling page structure and elements for initial test plan...")
8686
page = await ui_tester.get_current_page()
8787
dp = DeepCrawler(page)
88-
page_content_summary = await dp.crawl(highlight=True, viewport_only=True)
88+
await dp.crawl(highlight=True, viewport_only=True)
8989
screenshot = await ui_tester._actions.b64_page_screenshot(
9090
file_name="plan_or_replan", save_to_log=False, full_page=False
9191
)
@@ -101,23 +101,11 @@ async def plan_test_cases(state: MainGraphState) -> Dict[str, List[Dict[str, Any
101101
system_prompt = get_test_case_planning_system_prompt(
102102
business_objectives=business_objectives,
103103
completed_cases=completed_cases,
104-
reflection_history=state.get("reflection_history"),
105-
remaining_objectives=state.get("remaining_objectives"),
106104
language=language,
107105
)
108106

109-
# Use explicit template for planning to include element attributes
110-
planning_template = [
111-
str(ElementKey.TAG_NAME),
112-
str(ElementKey.INNER_TEXT),
113-
str(ElementKey.ATTRIBUTES),
114-
str(ElementKey.CENTER_X),
115-
str(ElementKey.CENTER_Y)
116-
]
117107
user_prompt = get_test_case_planning_user_prompt(
118108
state_url=state["url"],
119-
page_content_summary=page_content_summary.clean_dict(template=planning_template),
120-
page_structure=page_structure,
121109
completed_cases=completed_cases,
122110
reflection_history=state.get("reflection_history"),
123111
remaining_objectives=state.get("remaining_objectives"),
@@ -320,7 +308,6 @@ async def reflect_and_replan(state: MainGraphState) -> dict:
320308
business_objectives=state.get("business_objectives"),
321309
current_plan=state["test_cases"],
322310
completed_cases=state["completed_cases"],
323-
page_structure=page_structure,
324311
page_content_summary=page_content_summary,
325312
language=language,
326313
)

webqa_agent/testers/case_gen/prompts/planning_prompts.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ def get_shared_test_design_standards(language: str = 'zh-CN') -> str:
176176
def get_test_case_planning_system_prompt(
177177
business_objectives: str,
178178
completed_cases: list = None,
179-
reflection_history: list = None,
180-
remaining_objectives: str = None,
181179
language: str = 'zh-CN',
182180
) -> str:
183181
"""Generate system prompt for test case planning.
@@ -186,8 +184,6 @@ def get_test_case_planning_system_prompt(
186184
business_objectives: Business objectives
187185
completed_cases: Completed test cases (for replanning)
188186
language: Language for test case naming (zh-CN or en-US)
189-
reflection_history: Reflection history (for replanning)
190-
remaining_objectives: Remaining objectives (for replanning)
191187
192188
Returns:
193189
Formatted system prompt string
@@ -429,8 +425,6 @@ def get_test_case_planning_system_prompt(
429425

430426
def get_test_case_planning_user_prompt(
431427
state_url: str,
432-
page_content_summary: dict,
433-
page_structure: str ,
434428
completed_cases: list = None,
435429
reflection_history: list = None,
436430
remaining_objectives: str = None,
@@ -439,8 +433,6 @@ def get_test_case_planning_user_prompt(
439433
440434
Args:
441435
state_url: Target URL
442-
page_content_summary: Page content summary (interactive elements)
443-
page_structure: Complete page text structure
444436
completed_cases: Completed test cases (for replanning)
445437
reflection_history: Reflection history (for replanning)
446438
remaining_objectives: Remaining objectives (for replanning)
@@ -464,7 +456,7 @@ def get_test_case_planning_user_prompt(
464456
user_prompt = f"""
465457
## Application Under Test (AUT)
466458
- **Target URL**: {state_url}
467-
- **Visual Element Reference (Referenced via attached screenshot) **: The attached screenshot contains numbered markers corresponding to interactive elements. Each number in the image maps to an element ID in the Interactive Elements Map above, providing precise visual-textual correlation for comprehensive UI analysis.
459+
- **Visual Element Reference (Referenced via attached screenshot) **: The attached screenshot contains numbered markers corresponding to interactive elements.
468460
469461
{context_section}
470462
@@ -697,7 +689,6 @@ def get_reflection_user_prompt(
697689
business_objectives: str,
698690
current_plan: list,
699691
completed_cases: list,
700-
page_structure: str,
701692
page_content_summary: dict = None,
702693
) -> str:
703694
"""Generate user prompt for reflection and replanning (dynamic part).
@@ -706,7 +697,6 @@ def get_reflection_user_prompt(
706697
business_objectives: Overall business objectives
707698
current_plan: Current test plan
708699
completed_cases: Completed test cases
709-
page_structure: Current UI text structure
710700
page_content_summary: Interactive element mapping (dict from ID to element info), optional
711701
712702
Returns:
@@ -810,7 +800,6 @@ def get_reflection_prompt(
810800
business_objectives: str,
811801
current_plan: list,
812802
completed_cases: list,
813-
page_structure: str,
814803
page_content_summary: dict = None,
815804
language: str = 'zh-CN',
816805
) -> tuple[str, str]:
@@ -821,14 +810,13 @@ def get_reflection_prompt(
821810
language: Language for test case naming (zh-CN or en-US)
822811
current_plan: Current test plan
823812
completed_cases: Completed test cases
824-
page_structure: Current UI text structure
825813
page_content_summary: Interactive element mapping (dict from ID to element info), optional
826814
827815
Returns:
828816
tuple: (system_prompt, user_prompt)
829817
"""
830818
system_prompt = get_reflection_system_prompt(language)
831819
user_prompt = get_reflection_user_prompt(
832-
business_objectives, current_plan, completed_cases, page_structure, page_content_summary
820+
business_objectives, current_plan, completed_cases, page_content_summary
833821
)
834822
return system_prompt, user_prompt

0 commit comments

Comments
 (0)