*** Settings ***
Documentation    Smoke tests for Skill YAML schema validation
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Validate Single-Tool Skill YAML
    [Documentation]    Parse the single-tool example skill YAML and assert success
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate    ${CURDIR}/../examples/skills/single-tool.yaml    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-ok

Validate Composed Skill YAML
    [Documentation]    Parse the composed example skill YAML and assert success
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate    ${CURDIR}/../examples/skills/composed.yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-ok

Validate Inline-Tool Skill YAML
    [Documentation]    Parse the inline-tool example skill YAML and assert success
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate    ${CURDIR}/../examples/skills/inline-tool.yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-ok

Validate Validation-Only Skill YAML
    [Documentation]    Parse the validation-only example skill YAML and assert success
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate    ${CURDIR}/../examples/skills/validation-only.yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-ok

Validate MCP-Backed Skill YAML
    [Documentation]    Parse the MCP-backed example skill YAML and assert success
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate    ${CURDIR}/../examples/skills/mcp-backed.yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-ok

Reject Invalid Skill YAML
    [Documentation]    Attempt to parse an intentionally invalid YAML and assert failure
    ${invalid_yaml}=    Set Variable    ${TEMPDIR}${/}invalid_skill.yaml
    Create File    ${invalid_yaml}    description: missing required fields\n
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate-invalid    ${invalid_yaml}    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-schema-expected-fail

