<?xml version="1.0" encoding="utf-8"?>
<!--
********************************** DO NOT EDIT **********************************

This file will be replaced during upgrades so DO NOT EDIT this file. If you need to
adjust the process, reading and understanding this file is the first step.

In most cases, the adjustments can be achieved by setting properties or providing one
of the "hooks" in the form of a "-before-" or "-after-" target. Whenever possible, look
for one of these solutions.

Failing that, you can copy whole targets to your build.xml file and it will overrride
the target provided here. Doing that can create problems for upgrading to newer
versions of Cmd so it is not recommended but it will be easier to manage than editing
this file in most cases.
-->
<project name="cmd-test">
    <target name="-before-test-init"/>
    <target name="-test-init">
        <if>
            <isset property="app.dir"/>
            <then>
                <property name="cmd-test.specs.dir" value="${app.dir}/test/specs"/>
            </then>
            <else>
                <property name="cmd-test.specs.dir" value="${package.dir}/test/specs"/>
            </else>
        </if>
        <property name="cmd-test.specs.test-json" value="${cmd-test.specs.dir}/test.json"/>
    </target>
    <target name="-after-test-init"/>
    <target name="test-init"
            depends="init,-before-test-init,-test-init,-after-test-init"/>

    <target name="-before-test-console"/>
    <target name="-test-console" depends="-update-bootstrap">
        <echo>Launching Sencha Test Console</echo>
        <echo>${cmd.dir}</echo>
        <x-sencha-command
                dir="cmd-test.specs.dir">
            test
            console
                -launch=false
                -configFile
                    ${cmd-test.specs.test-json}
        </x-sencha-command>
    </target>
    <target name="-after-test-console"/>
    <target name="test-console"
            depends="test-init,-before-test-console,-test-console,-after-test-console"
            description="Run tests"/>

    <target name="-before-test-run"/>
    <target name="-test-run" depends="-update-bootstrap">
        <echo>Launching Sencha Test Runner</echo>
        <echo>${cmd.dir}</echo>
        <x-sencha-command
                dir="cmd-test.specs.dir">
            test
            run
            -configFile
                ${cmd-test.specs.test-json}
        </x-sencha-command>
    </target>
    <target name="-after-test-run"/>
    <target name="test-run"
            depends="test-init,-before-test-run,-test-run,-after-test-run"
            description="Run tests"/>

    <target name="-update-bootstrap">
        <property name="args.metadatafile" value="${cmd-test.specs.dir}/bootstrap.js"/>
        <property name="args.basepath" value="${cmd-test.specs.dir}"/>
        <x-run-bootstrap file="${args.metadatafile}"
                         basedir="${args.basepath}"/>
    </target>
</project>
