Skip to content

Commit 7086eb3

Browse files
Add HR workflow test and update input method names
Added a test for the HR workflow to validate the Human Resources process steps. Updated function calls to use the correct naming convention for input methods.
1 parent 722c280 commit 7086eb3

1 file changed

Lines changed: 134 additions & 11 deletions

File tree

tests/e2e-test/tests/test_MACAE_Smoke_test.py

Lines changed: 134 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,129 @@ def test_macae_v4_gp_workflow(login_logout, request):
447447
raise
448448

449449

450+
@pytest.mark.gp
451+
def test_hr_workflow_only(login_logout, request):
452+
"""
453+
Validate HR workflow only (Steps 14-19).
454+
455+
This test focuses on just the Human Resources workflow for easier debugging.
456+
Note: This assumes a fresh page state.
457+
458+
Steps:
459+
1. Validate home page elements are visible
460+
2. Select Human Resources team
461+
3. Select quick task and create plan
462+
4. Validate all HR agents are displayed
463+
5. Approve the task plan
464+
6. Send human clarification with employee details
465+
7. Validate HR response
466+
"""
467+
page = login_logout
468+
biab_page = BIABPage(page)
469+
470+
# Update test node ID for HTML report
471+
request.node._nodeid = "(MACAE V4) HR Workflow Only - Steps 14-19"
472+
473+
logger.info("=" * 80)
474+
logger.info("Starting HR Workflow Test")
475+
logger.info("=" * 80)
476+
477+
start_time = time.time()
478+
479+
try:
480+
# Reload home page before starting test
481+
biab_page.reload_home_page()
482+
483+
# Step 1: Validate Home Page
484+
logger.info("\n" + "=" * 80)
485+
logger.info("STEP 1: Validating Home Page")
486+
logger.info("=" * 80)
487+
step1_start = time.time()
488+
biab_page.validate_home_page()
489+
step1_end = time.time()
490+
logger.info(f"Step 1 completed in {step1_end - step1_start:.2f} seconds")
491+
492+
# Step 2: Select Human Resources Team
493+
logger.info("\n" + "=" * 80)
494+
logger.info("STEP 2: Selecting Human Resources Team")
495+
logger.info("=" * 80)
496+
step2_start = time.time()
497+
biab_page.select_human_resources_team()
498+
step2_end = time.time()
499+
logger.info(f"Step 2 completed in {step2_end - step2_start:.2f} seconds")
500+
501+
# Step 3: Select Quick Task and Create Plan (HR)
502+
logger.info("\n" + "=" * 80)
503+
logger.info("STEP 3: Selecting Quick Task and Creating Plan (HR)")
504+
logger.info("=" * 80)
505+
step3_start = time.time()
506+
biab_page.select_quick_task_and_create_plan()
507+
step3_end = time.time()
508+
logger.info(f"Step 3 completed in {step3_end - step3_start:.2f} seconds")
509+
510+
# Step 4: Validate All HR Agents Visible
511+
logger.info("\n" + "=" * 80)
512+
logger.info("STEP 4: Validating All HR Agents Are Displayed")
513+
logger.info("=" * 80)
514+
step4_start = time.time()
515+
biab_page.validate_hr_agents()
516+
step4_end = time.time()
517+
logger.info(f"Step 4 completed in {step4_end - step4_start:.2f} seconds")
518+
519+
# Step 5: Approve Task Plan (HR)
520+
logger.info("\n" + "=" * 80)
521+
logger.info("STEP 5: Approving HR Task Plan")
522+
logger.info("=" * 80)
523+
step5_start = time.time()
524+
biab_page.approve_task_plan()
525+
step5_end = time.time()
526+
logger.info(f"Step 5 completed in {step5_end - step5_start:.2f} seconds")
527+
528+
# Step 6: Send Human Clarification with Employee Details
529+
logger.info("\n" + "=" * 80)
530+
logger.info("STEP 6: Sending Human Clarification with Employee Details")
531+
logger.info("=" * 80)
532+
step6_start = time.time()
533+
biab_page.input_clarification_and_send(HR_CLARIFICATION_TEXT)
534+
step6_end = time.time()
535+
logger.info(f"Step 6 completed in {step6_end - step6_start:.2f} seconds")
536+
537+
# Step 7: Validate HR Response
538+
logger.info("\n" + "=" * 80)
539+
logger.info("STEP 7: Validating HR Response")
540+
logger.info("=" * 80)
541+
step7_start = time.time()
542+
biab_page.validate_hr_response()
543+
step7_end = time.time()
544+
logger.info(f"Step 7 completed in {step7_end - step7_start:.2f} seconds")
545+
546+
# Test completed successfully
547+
end_time = time.time()
548+
total_duration = end_time - start_time
549+
550+
logger.info("\n" + "=" * 80)
551+
logger.info("✓ HR Workflow Test PASSED")
552+
logger.info("=" * 80)
553+
logger.info(f"Total execution time: {total_duration:.2f} seconds")
554+
logger.info("=" * 80)
555+
556+
# Attach execution time to pytest report
557+
request.node._report_sections.append(
558+
("call", "log", f"Total execution time: {total_duration:.2f}s")
559+
)
560+
561+
except Exception as e:
562+
end_time = time.time()
563+
total_duration = end_time - start_time
564+
logger.error("\n" + "=" * 80)
565+
logger.error("TEST EXECUTION FAILED")
566+
logger.error("=" * 80)
567+
logger.error(f"Error: {str(e)}")
568+
logger.error(f"Execution time before failure: {total_duration:.2f}s")
569+
logger.error("=" * 80)
570+
raise
571+
572+
450573
def test_validate_source_text_not_visible(login_logout, request):
451574
"""
452575
Validate that source text is not visible after retail customer response.
@@ -640,7 +763,7 @@ def test_rai_validation_unable_to_create_plan(login_logout, request):
640763
biab_page.select_retail_customer_success_team()
641764

642765
logger.info(f"Entering RAI prompt: {RAI_PROMPT}")
643-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
766+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
644767

645768
logger.info("Validating 'Unable to create plan' message is visible...")
646769
biab_page.validate_rai_error_message()
@@ -661,7 +784,7 @@ def test_rai_validation_unable_to_create_plan(login_logout, request):
661784
biab_page.select_product_marketing_team()
662785

663786
logger.info(f"Entering RAI prompt: {RAI_PROMPT}")
664-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
787+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
665788

666789
logger.info("Validating 'Unable to create plan' message is visible...")
667790
biab_page.validate_rai_error_message()
@@ -682,7 +805,7 @@ def test_rai_validation_unable_to_create_plan(login_logout, request):
682805
biab_page.select_human_resources_team()
683806

684807
logger.info(f"Entering RAI prompt: {RAI_PROMPT}")
685-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
808+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
686809

687810
logger.info("Validating 'Unable to create plan' message is visible...")
688811
biab_page.validate_rai_error_message()
@@ -703,7 +826,7 @@ def test_rai_validation_unable_to_create_plan(login_logout, request):
703826
biab_page.select_rfp_team()
704827

705828
logger.info(f"Entering RAI prompt: {RAI_PROMPT}")
706-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
829+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
707830

708831
logger.info("Validating 'Unable to create plan' message is visible...")
709832
biab_page.validate_rai_error_message()
@@ -724,7 +847,7 @@ def test_rai_validation_unable_to_create_plan(login_logout, request):
724847
biab_page.select_contract_compliance_team()
725848

726849
logger.info(f"Entering RAI prompt: {RAI_PROMPT}")
727-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
850+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
728851

729852
logger.info("Validating 'Unable to create plan' message is visible...")
730853
biab_page.validate_rai_error_message()
@@ -1396,7 +1519,7 @@ def test_rai_prompts_all_teams(login_logout, request):
13961519
step2_start = time.time()
13971520

13981521
biab_page.select_human_resources_team()
1399-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
1522+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
14001523
biab_page.validate_rai_error_message()
14011524

14021525
step2_end = time.time()
@@ -1409,7 +1532,7 @@ def test_rai_prompts_all_teams(login_logout, request):
14091532
step3_start = time.time()
14101533

14111534
biab_page.select_product_marketing_team()
1412-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
1535+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
14131536
biab_page.validate_rai_error_message()
14141537

14151538
step3_end = time.time()
@@ -1422,7 +1545,7 @@ def test_rai_prompts_all_teams(login_logout, request):
14221545
step4_start = time.time()
14231546

14241547
biab_page.select_retail_customer_success_team()
1425-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
1548+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
14261549
biab_page.validate_rai_error_message()
14271550

14281551
step4_end = time.time()
@@ -1435,7 +1558,7 @@ def test_rai_prompts_all_teams(login_logout, request):
14351558
step5_start = time.time()
14361559

14371560
biab_page.select_rfp_team()
1438-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
1561+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
14391562
biab_page.validate_rai_error_message()
14401563

14411564
step5_end = time.time()
@@ -1448,7 +1571,7 @@ def test_rai_prompts_all_teams(login_logout, request):
14481571
step6_start = time.time()
14491572

14501573
biab_page.select_contract_compliance_team()
1451-
biab_page.input_RAI_PROMPT_and_send(RAI_PROMPT)
1574+
biab_page.input_rai_prompt_and_send(RAI_PROMPT)
14521575
biab_page.validate_rai_error_message()
14531576

14541577
step6_end = time.time()
@@ -1552,7 +1675,7 @@ def test_chat_input_validation(login_logout, request):
15521675

15531676
# Create a long query (>5000 characters)
15541677
long_query = "a" * 5001
1555-
biab_page.input_RAI_PROMPT_and_send(long_query)
1678+
biab_page.input_rai_prompt_and_send(long_query)
15561679
biab_page.validate_rai_error_message()
15571680

15581681
step5_end = time.time()

0 commit comments

Comments
 (0)