*** Settings ***
Documentation    Integration tests for merge strategy configuration (prefer-parent, prefer-subplan, manual)
Resource         ${CURDIR}/common.resource

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

*** Test Cases ***
Prefer-Parent Auto-Resolves Conflicts
    [Documentation]    Verify prefer-parent strategy resolves all conflicts in favor of parent values
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    prefer_parent    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-prefer-parent-ok

Prefer-Subplan Auto-Resolves Conflicts
    [Documentation]    Verify prefer-subplan strategy resolves all conflicts in favor of subplan values
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    prefer_subplan    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-prefer-subplan-ok

Manual Strategy Requires Resolution
    [Documentation]    Verify manual strategy raises ValueError on attempted auto-resolution
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    manual    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-manual-ok

No Conflicts Returns Empty Result
    [Documentation]    Verify empty conflict list returns empty resolution
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    no_conflicts    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-no-conflicts-ok

Strategy From String Creates Correct Enum
    [Documentation]    Verify MergeStrategy.from_string creates proper enum values
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    from_string    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-from-string-ok

Invalid String Raises Error
    [Documentation]    Verify invalid string raises ValueError with descriptive message
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    invalid_string    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-invalid-string-ok

Enum Values And Methods Validated
    [Documentation]    Verify all enum member values and helper methods are correct
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    enums    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    merge-strategy-enums-ok
