*** Settings ***
Documentation    Integration tests for actor run positional NAME/PROMPT signature
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_actor_run_signature.py

*** Test Cases ***
Positional Args With Config Fallback
    [Documentation]    Verify that positional NAME + PROMPT work with --config fallback
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    positional-with-config    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    positional-with-config-ok

Positional NAME From Actor Registry
    [Documentation]    Verify that NAME is resolved from the actor registry when no --config
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    positional-from-registry    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    positional-from-registry-ok

Actor App Registry Resolution
    [Documentation]    Verify that NAME is resolved from the actor registry via actor_app
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    actor-app-registry    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    actor-app-registry-ok

Unknown Actor Name Error
    [Documentation]    Verify that unknown actor name exits with error code 2
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    unknown-actor-name    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    unknown-actor-name-ok

Actor App Unknown Name Error
    [Documentation]    Verify that unknown actor name exits with error code 2 via actor_app
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    actor-app-unknown-name    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    actor-app-unknown-name-ok
