
scriptname_generation_task:
  description: >
    Based on the following human-readable steps, generate a descriptive and unique script name from `{human_steps}`
    The script name should be lowercase, snake_case, and include keywords from the steps (e.g., site name or product name).
    If the user has already provided a script name, use that.
    If not, you MUST generate a new script name.
    Never return an empty value or "None".
  expected_output: >
    scriptname
  agent: ScriptNameGenerator

script_writer_task:
  description: >
    Generate browser automation script from navigation steps and pick up the script name from the scriptname generation task as `{scriptname}` for the user :"{user_id}".
  expected_output: >
    expected_output: >
    Call the Create Script Tool with the following parameters:
    - steps: "{steps}" called steps from the crew
    - human_steps: "{human_steps}" called human_steps from the crew
    - script_name: "{scriptname_generation_task output.script_name}"
    - user_id: "{user_id}" called user_id from the crew
  agent: ScriptWriter

scenario_creation_task:
  description: >
    Generate a test scenario using the output from the previous tool for the user :"{user_id}".
    This scenario will be used to execute a test that simulates user actions.
  expected_output: > 
    Call the Scenario Generator Tool with the following parameters:
    - script: "{second task output}" called script from the second tool (create script tool)
    - scenName: "{scenName}"
    - userName: "{userName}"
    - groupName: "{groupName}"
  agent: ScenarioGenerator

test_execution_and_monitoring_task:
  description: >
    Your task is to first execute the test using the "TestExecutorTool" by passing the scenario for the user :"{user_id}".
    Then, use the result (test result) from that tool to monitor the test using "TestMonitorTool".
    Do not stop after executing the test — always monitor the result afterward until the test completes or fails.
  expected_output: >
    Call the Test Executor Tool with:
    - scenario: "{scenario_creation_task output.scenario}"
    - user_id: "{user_id}"
    Then call the Test Monitor Tool with:
    - scenario: "{scenario_creation_task output.scenario}"
    - test_result: "{test_executor_tool output.test_result}"
    - controller_name: "{script_writer_task output.controller_name}"
    - user_id: "{user_id}"
    Return the final status of the test after monitoring (e.g., completed, failed).
  agent: TestExecutor

create_load_test_script_task:
  description: >
    Create a load test script using the output from the previous tool for the user :"{user_id}".
    This script will be used to execute a load test that simulates user actions.
    If `{scriptInfo}` from the crew is provided, use it.
    Otherwise, use "default/default/{scriptname}" where scriptname is from the scriptname_generation_task.
  expected_output: >
    If `{scriptInfo}` from the crew is "None" or empty, then construct:
    scriptInfo = "default/default/{scriptname}"
    Otherwise, use the provided `scriptInfo`. 
    Call the Create Load Test Script Tool with the following parameters:
    - har: "{test execution and monitoring task output}" called har from the tool (test monitor tool)
    - scriptInfo: "<calculated scriptInfo>"
    - scriptType: "{scriptType}"
    - workprofile: "{workprofile}"
    - steps: "{steps}" called steps from the crew
    - human_steps: "{human_steps}" called human_steps from the crew
  agent: LoadScriptGenerator

register_in_net_test_task:
  description: >
    Register the created script in Net Test for the user :"{user_id}".
    Use the output from the previous tool to register in Net Test.
  expected_output: >
    Call the Register In Net Test Tool with the following parameters:
    - script_name: "{scriptname_generation_task output.script_name}"
    - tag_name: "1"
    - user_id: "{user_id}"
  agent: NetTestRegistrar

save_load_test_script_task:
  description: >
    Save a load test script using the output from the previous tool for the user :"{user_id}".
    This script will be used to execute a load test that simulates user actions.
    If project_subproject from the crew is provided, use it.
    Otherwise, use "default/default" & scriptname is from the scriptname_generation_task.
  expected_output: >
    If project_subproject from the crew is "None" or empty, then construct:
    project_subproject = "default/default"
    Otherwise, use the provided `project_subproject`. 
    Call the Save Test Cases Tool with the following parameters:
    - script_name: "{scriptname_generation_task output.script_name}"
    - project_subproject: "default/default"
    - functional: "{functional}"
    - user_id: "{user_id}"
    - user_name: "cavisson"
    - steps: "{steps}" called steps from the crew
  agent: SaveTestAgent

