*** Settings ***
Documentation    Smoke tests for automation-profile CLI commands
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_automation_profile_cli.py

*** Test Cases ***
Add Automation Profile
    [Documentation]    Add a custom automation profile from YAML config
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    add    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    add-profile-ok

Show Automation Profile
    [Documentation]    Show a built-in automation profile
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    show    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    show-profile-ok

Show Automation Profile JSON
    [Documentation]    Show a profile in JSON format
    [Tags]    tdd_issue    tdd_issue_4204    tdd_expected_fail
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    show-json    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    show-json-ok

Show Automation Profile YAML
    [Documentation]    Show a profile in YAML format
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    show-yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    show-yaml-ok

List Automation Profiles
    [Documentation]    List all automation profiles
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    list    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    list-profiles-ok

List Automation Profiles JSON
    [Documentation]    List profiles in JSON format
    [Tags]    tdd_issue    tdd_issue_4204    tdd_expected_fail
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    list-json    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    list-json-ok

Remove Automation Profile
    [Documentation]    Remove a custom automation profile
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    remove    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    remove-profile-ok

Remove Built-in Profile Fails
    [Documentation]    Verify built-in profiles cannot be removed
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    remove-builtin-fails    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    remove-builtin-fails-ok

All Automation Profile CLI Tests
    [Documentation]    Run all automation-profile CLI tests
    [Tags]    tdd_issue    tdd_issue_4204    tdd_expected_fail
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    all    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    all-tests-ok
