*** Settings ***
Suite Setup     Select Component Application
Resource        flex_resource.txt

*** Test Cases ***
Should Exist By Id
    Flex Element Should Exist  staticLabel

Should Exist By Name
    Flex Element Should Exist  name=stLabel

Should Exist By Attribute
    Flex Element Should Exist  htmlText=Some static text

Should Exist By Chain
    Flex Element Should Exist  chain=id:staticContainer/name:stLabel

Should Exist Fails By Id
    Element Lookup Fails  nonExisting  id:nonExisting

Should Exist Fails By Name
    Element Lookup Fails  name=not-a-name  name:not-a-name

Should Exist Fails By Chain
    ${chain}=  Set Variable  id:helpContainer/name:nonExisting
    Element Lookup Fails  chain=${chain}  ${chain}

Should Not Exist
    Flex Element Should Not Exist  nonExisting
    Flex Element Should Not Exist  label=notHere

Should Not Exist Fails
    Run Keyword And Expect Error  Element 'staticLabel' exists  Flex Element Should Not Exist  staticLabel
    Run Keyword And Expect Error  Element 'name=stLabel' exists  Flex Element Should Not Exist  name=stLabel

Should Exist With Wildcards
    Flex Element Should Exist  st*el
    Flex Element Should Exist  name=st*el
    Flex Element Should Exist  chain=id:static*er/name:stLabel

*** Keywords ***
Element Lookup Fails
    [Arguments]  ${locator}  ${error chain}
    Run Keyword And Expect Error  ERROR: The chain '${error chain}' was not found.  Flex Element Should Exist  ${locator}

