@@ -16,7 +16,7 @@ class BIABPage(BasePage):
1616 AI_TEXT = "//span[.='AI-generated content may be incorrect']"
1717 CONTOSO_LOGO = "//span[.='Contoso']"
1818 NEW_TASK_PROMPT = "//div[@class='tab tab-new-task']"
19- SEND_BUTTON = "//button[@class='fui-Button r1alrhcs home-input-send-button ___w3o4yv0 fhovq9v f1p3nwhy f11589ue f1q5o8ev f1pdflbu fkfq4zb f1t94bn6 f1s2uweq fr80ssc f1ukrpxl fecsdlb fnwyq0v ft1hn21 fuxngvv fy5bs14 fsv2rcd f1h0usnq fs4ktlq f16h9ulv fx2bmrt f1omzyqd f1dfjoow f1j98vj9 fj8yq94 f4xjyn1 f1et0tmh f9ddjv3 f1wi8ngl f18ktai2 fwbmr0d f44c6la' ]"
19+ SEND_BUTTON = "//button[contains( @class, ' home-input-send-button') ]"
2020 PROMPT_INPUT = "//textarea[@placeholder=\" Tell us what needs planning, building, or connecting—we'll handle the rest.\" ]"
2121 QUICK_TASK = "//div[@role='group']"
2222 CURRENT_TEAM = "//button[contains(.,'Current Team')]"
@@ -46,7 +46,7 @@ class BIABPage(BasePage):
4646 HR_HELPER_AGENT = "//span[normalize-space()='HR Helper Agent']"
4747 TECH_SUPPORT_AGENT = "//span[normalize-space()='Technical Support Agent']"
4848 INPUT_CLARIFICATION = "//textarea[@placeholder='Type your message here...']"
49- SEND_BUTTON_CLARIFICATION = "//button[@class='fui-Button r1alrhcs home-input-send-button ___w3o4yv0 fhovq9v f1p3nwhy f11589ue f1q5o8ev f1pdflbu fkfq4zb f1t94bn6 f1s2uweq fr80ssc f1ukrpxl fecsdlb fnwyq0v ft1hn21 fuxngvv fy5bs14 fsv2rcd f1h0usnq fs4ktlq f16h9ulv fx2bmrt f1omzyqd f1dfjoow f1j98vj9 fj8yq94 f4xjyn1 f1et0tmh f9ddjv3 f1wi8ngl f18ktai2 fwbmr0d f44c6la' ]"
49+ SEND_BUTTON_CLARIFICATION = "//button[contains( @class, ' home-input-send-button') ]"
5050 HR_COMPLETED_TASK = "//div[@title='onboard new employee']"
5151 RETAIL_COMPLETED_TASK = "//div[contains(@title,'Analyze the satisfaction of Emily Thompson with Contoso. If needed, provide a plan to increase her satisfaction.')]"
5252 ORDER_DATA = "//span[normalize-space()='Order Data']"
@@ -439,6 +439,33 @@ def approve_product_marketing_task_plan(self):
439439 logger .info ("Waiting for plan processing to complete..." )
440440 self .page .locator (self .PROCESSING_PLAN ).wait_for (state = "hidden" , timeout = 200000 )
441441 logger .info ("✓ Plan processing completed" )
442+
443+ # Handle subsequent clarification requests (e.g., additional user preferences)
444+ logger .info ("Checking if additional clarification is requested..." )
445+ try :
446+ second_clarification = self .page .locator (self .INPUT_CLARIFICATION )
447+ if second_clarification .is_visible (timeout = 5000 ) and second_clarification .is_enabled ():
448+ logger .info ("⚠ Additional clarification requested - Responding with 'Not applicable'" )
449+ second_clarification .fill ("Not applicable" )
450+ self .page .wait_for_timeout (1000 )
451+ logger .info ("✓ 'Not applicable' entered" )
452+
453+ self .page .locator (self .SEND_BUTTON_CLARIFICATION ).click ()
454+ self .page .wait_for_timeout (2000 )
455+ logger .info ("✓ Additional clarification submitted" )
456+
457+ try :
458+ expect (self .page .locator (self .PROCESSING_PLAN )).to_be_visible (timeout = 15000 )
459+ logger .info ("✓ 'Processing your plan' message is visible after additional clarification" )
460+ self .page .locator (self .PROCESSING_PLAN ).wait_for (state = "hidden" , timeout = 200000 )
461+ logger .info ("✓ Plan processing completed after additional clarification" )
462+ except Exception as proc_e :
463+ logger .info (f"Processing message not detected after additional clarification: { proc_e } " )
464+ self .page .wait_for_timeout (3000 )
465+ else :
466+ logger .info ("✓ No additional clarification required" )
467+ except (TimeoutError , Exception ) as e :
468+ logger .info (f"✓ No additional clarification detected - proceeding normally: { e } " )
442469 else :
443470 logger .info ("✓ No clarification required - task completed successfully" )
444471 except (TimeoutError , Exception ) as e :
@@ -519,15 +546,16 @@ def validate_retail_customer_response(self):
519546
520547 logger .info ("Validating retail customer response..." )
521548
522- # Wait for AI Thinking Process to complete (if visible)
549+ # Wait briefly for any AI Thinking Process to settle, then proceed
523550 logger .info ("Checking if AI is still thinking..." )
524551 try :
525- if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 5000 ):
526- logger .info ("AI Thinking Process detected, waiting for it to complete..." )
527- self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 120000 )
528- logger .info ("✓ AI Thinking Process completed" )
529- # Add buffer time after thinking completes
530- self .page .wait_for_timeout (3000 )
552+ if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 3000 ):
553+ logger .info ("AI Thinking Process detected, waiting briefly for it to complete..." )
554+ try :
555+ self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 10000 )
556+ logger .info ("✓ AI Thinking Process completed" )
557+ except Exception :
558+ logger .info ("AI Thinking Process still visible - element persists in DOM, proceeding to response validation" )
531559 except Exception as e :
532560 logger .info ("AI Thinking Process not detected or already completed" )
533561
@@ -586,15 +614,16 @@ def validate_product_marketing_response(self):
586614
587615 logger .info ("Validating product marketing response..." )
588616
589- # Wait for AI Thinking Process to complete (if visible)
617+ # Wait briefly for any AI Thinking Process to settle, then proceed
590618 logger .info ("Checking if AI is still thinking..." )
591619 try :
592- if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 5000 ):
593- logger .info ("AI Thinking Process detected, waiting for it to complete..." )
594- self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 120000 )
595- logger .info ("✓ AI Thinking Process completed" )
596- # Add buffer time after thinking completes
597- self .page .wait_for_timeout (3000 )
620+ if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 3000 ):
621+ logger .info ("AI Thinking Process detected, waiting briefly for it to complete..." )
622+ try :
623+ self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 10000 )
624+ logger .info ("✓ AI Thinking Process completed" )
625+ except Exception :
626+ logger .info ("AI Thinking Process still visible - element persists in DOM, proceeding to response validation" )
598627 except Exception as e :
599628 logger .info ("AI Thinking Process not detected or already completed" )
600629
@@ -645,15 +674,16 @@ def validate_hr_response(self):
645674
646675 logger .info ("Validating HR response..." )
647676
648- # Wait for AI Thinking Process to complete (if visible)
677+ # Wait briefly for any AI Thinking Process to settle, then proceed
649678 logger .info ("Checking if AI is still thinking..." )
650679 try :
651- if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 5000 ):
652- logger .info ("AI Thinking Process detected, waiting for it to complete..." )
653- self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 120000 )
654- logger .info ("✓ AI Thinking Process completed" )
655- # Add buffer time after thinking completes
656- self .page .wait_for_timeout (3000 )
680+ if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 3000 ):
681+ logger .info ("AI Thinking Process detected, waiting briefly for it to complete..." )
682+ try :
683+ self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 10000 )
684+ logger .info ("✓ AI Thinking Process completed" )
685+ except Exception :
686+ logger .info ("AI Thinking Process still visible - element persists in DOM, proceeding to response validation" )
657687 except Exception as e :
658688 logger .info ("AI Thinking Process not detected or already completed" )
659689
@@ -706,15 +736,16 @@ def validate_rfp_response(self):
706736
707737 logger .info ("Validating RFP response..." )
708738
709- # Wait for AI Thinking Process to complete (if visible)
739+ # Wait briefly for any AI Thinking Process to settle, then proceed
710740 logger .info ("Checking if AI is still thinking..." )
711741 try :
712- if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 5000 ):
713- logger .info ("AI Thinking Process detected, waiting for it to complete..." )
714- self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 120000 )
715- logger .info ("✓ AI Thinking Process completed" )
716- # Add buffer time after thinking completes
717- self .page .wait_for_timeout (3000 )
742+ if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 3000 ):
743+ logger .info ("AI Thinking Process detected, waiting briefly for it to complete..." )
744+ try :
745+ self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 10000 )
746+ logger .info ("✓ AI Thinking Process completed" )
747+ except Exception :
748+ logger .info ("AI Thinking Process still visible - element persists in DOM, proceeding to response validation" )
718749 except Exception as e :
719750 logger .info ("AI Thinking Process not detected or already completed" )
720751
@@ -751,15 +782,16 @@ def validate_contract_compliance_response(self):
751782
752783 logger .info ("Validating Contract Compliance response..." )
753784
754- # Wait for AI Thinking Process to complete (if visible)
785+ # Wait briefly for any AI Thinking Process to settle, then proceed
755786 logger .info ("Checking if AI is still thinking..." )
756787 try :
757- if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 5000 ):
758- logger .info ("AI Thinking Process detected, waiting for it to complete..." )
759- self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 120000 )
760- logger .info ("✓ AI Thinking Process completed" )
761- # Add buffer time after thinking completes
762- self .page .wait_for_timeout (3000 )
788+ if self .page .locator (self .AI_THINKING_PROCESS ).is_visible (timeout = 3000 ):
789+ logger .info ("AI Thinking Process detected, waiting briefly for it to complete..." )
790+ try :
791+ self .page .locator (self .AI_THINKING_PROCESS ).wait_for (state = "hidden" , timeout = 10000 )
792+ logger .info ("✓ AI Thinking Process completed" )
793+ except Exception :
794+ logger .info ("AI Thinking Process still visible - element persists in DOM, proceeding to response validation" )
763795 except Exception as e :
764796 logger .info ("AI Thinking Process not detected or already completed" )
765797
0 commit comments