
- console:
    name: Console creation
    console_name: term
    doc: Opening the console
    key: $(test)_PASS
    steps:
        - open:
            protocol: terminal
            terminal_path: $(test_directory)
{% if os == "Linux" %}
        - writeln: echo "endOfOpen"
{% endif %}

- console:
    name: Console read_until with timeout
    console_name: term
    key: $(test)_PASS
    steps:
{% if os == "Linux" %}
        - read_until: {expected: endOfOpen, timeout: 5}
{% else %}
        - read_until: {expected: $(terminal_prompt), timeout: 5}
{% endif %}

- console:
    name: Console write
    console_name: term
    key: $(test)_PASS
    steps:
        - writeln: echo 0

- sleep:
    name: sleep item
    timeout: 1

- console:
    name: Console read_until immediate
    console_name: term
    key: $(test)_PASS
    steps:
{% if os == "Windows" %}
        - read_until: {expected: "echo 0", timeout: 0}
{% endif %}
        - read_until: {expected: "0", timeout: 0}

- console:
    name: Console write
    console_name: term
    key: $(test)_PASS
    steps:
        - writeln: echo "HelloConsole"

- console:
    name: Console read_until fail
    console_name: term
    key: $(test)_FAIL
    steps:
        - read_until: {expected: "Something never prints", timeout: 1}

- console:
    name: Console write
    console_name: term
    key: $(test)_PASS
    steps:
        - writeln: echo "HelloConsole"

- console:
    name: Console read_until no_fail
    console_name: term
    key: $(test)_PASS
    steps:
        - read_until: {expected: Something never prints, timeout: 1, no_fail: true}

- console:
    name: Console read_until muted
    console_name: term
    key: $(test)_PASS
    steps:
        - writeln: echo "HelloConsole"
{% if os == "Windows" %}
        - read_until: {expected: echo "HelloConsole", timeout: 1, mute: true}
{% endif %}
        - read_until: {expected: HelloConsole, timeout: 1, mute: true}

- console:
    name: Console read_until muted
    console_name: term
    key: $(test)_PASS
    steps:
        - writeln: echo "HelloConsole is PASS" && echo "endOfCmd"
{% if os == "Windows" %}
        - read_until: {expected: echo "endOfCmd", timeout: 1}
{% endif %}
        - read_until: {expected: endOfCmd, timeout: 1, process_result: "'Hello' in r'''$(result)''' and 'PASS' in r'''$(result)''' "}

- console:
    name: Console closure
    execute_on_stop: true
    console_name: term
    key: $(test)_PASS
    steps:
        - close: term
