--- RCPTT testcase ---
Format-Version: 1.0
Contexts: _wTZJsDblEeaeH4-rLFMbKA,_CkEGoDx2EeaeH4-rLFMbKA,_sSEj4Dx4EeaeH4-rLFMbKA
Element-Name: ConnectTwoComponents
Element-Type: testcase
Element-Version: 3.0
External-Reference: 
Id: _wq1yQLMZEea3QLlSwdMehg
Runtime-Version: 2.0.0.201506120617
Save-Time: 11/25/16 3:45 PM
Testcase-Type: ecl

------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa
Content-Type: text/plain
Entry-Name: .description

Basic component adding, configuration and connection drawing

- checks number of connections
- number of components
- number of labels
- execute and check finished state
------=_.description-216f885c-d591-38ce-8ea2-e4f8cb4d6ffa--
------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
Content-Type: text/ecl
Entry-Name: .content

with [get-editor "MyWorkflow.wf"] {
    with [get-palette] {
        with [get-palette-entry Execution] {
            mouse-move 77 14 button1 -height 22 -width 125
            mouse-press 77 14 button1 -height 22 -width 125
            mouse-release 77 14 button1 524288 -height 22 -width 125
        }
        with [get-palette-entry Script] {
            mouse-move 55 8 button1 -height 23 -width 125
            mouse-press 55 8 button1 -height 23 -width 125
            get-figure 0 | drag-start 55 8
        }
    }
    with [get-diagram -index 1 | get-edit-part -className WorkflowPart] {
        drag-enter 665 241 -detail move
        drag-over 110 42 -detail copy
        drag-exit
        drag-accept 110 42 -detail copy
    }
    get-palette | drag-set-data
    get-diagram -index 1 | get-edit-part -className WorkflowPart | drop 110 42 -detail copy
    with [get-palette] {
        drag-end -detail move
        with [get-palette-entry "Data Flow"] {
            mouse-move 43 13 button1 -height 22 -width 125
            mouse-press 43 13 button1 -height 22 -width 125
            mouse-release 43 13 button1 524288 -height 22 -width 125
        }
        with [get-palette-entry "Input Provider"] {
            mouse-move 45 5 button1 -height 23 -width 125
            mouse-press 45 5 button1 -height 23 -width 125
            get-figure 0 | drag-start 45 5
        }
    }
    with [get-diagram -index 1 | get-edit-part -className WorkflowPart] {
        drag-enter 667 181 -detail move
        drag-over 157 124 -detail copy
        drag-over 31 57 -detail copy
        drag-exit
        drag-accept 31 57 -detail copy
    }
    get-palette | drag-set-data
    get-diagram -index 1 | get-edit-part -className WorkflowPart | drop 31 57 -detail copy
    get-palette | drag-end -detail move
    with [get-diagram -index 1 | get-edit-part -className WorkflowPart | get-edit-part -className WorkflowNodePart] {
        mouse-move 39 40 button1 -height 81 -width 81
        mouse-press 39 40 button1 -height 81 -width 81
        mouse-release 39 40 button1 524288 -height 81 -width 81
        mouse-press 39 40 button1 -height 81 -width 81
        mouse-double-click 39 40 button1 -height 81 -width 81
        mouse-release 39 40 button1 524288 -height 81 -width 81
    }
}
with [get-view Properties] {
    with [get-section "Configure script" | get-editbox -after [get-label "Script language:"]] {
        set-text-offset 11 0
        key-type "M1+a"
        type-text "print RCE.read_input(\"x\")"
    }
    get-property-tab "Inputs/Outputs" | click
    get-property-tab Script | click
    get-section "Configure script" | get-combo -after [get-label "Script language:"] | select Jython
    get-property-tab Script | click
    get-property-tab "Inputs/Outputs" | click
    get-section Inputs | get-button "Add..." | click
}
with [get-window "Add Input"] {
    get-editbox -after [get-label "Name:"] | set-text x
    get-button OK | click
}
with [get-editor "MyWorkflow.wf" | get-diagram -index 1 | get-edit-part -className WorkflowPart | get-edit-part 
    -className WorkflowNodePart -index 1] {
    mouse-move 12 15 button1 -height 41 -width 41
    mouse-press 12 15 button1 -height 41 -width 41
    mouse-release 12 15 button1 524288 -height 41 -width 41
}
get-view Properties | get-section Outputs | get-button "Add..." | click
with [get-window "Add Output"] {
    get-editbox -after [get-label "Name:"] | set-text x
    get-group "" | get-editbox -after [get-label "Value:"] | set-text 15
    get-button OK | click
}

with [get-editor "MyWorkflow.wf"] {
    with [get-palette | get-palette-entry "Draw Connection (ALT+D)"] {
        mouse-move 77 12 button1 -height 33 -width 125
        mouse-press 77 12 button1 -height 33 -width 125
        mouse-release 77 12 button1 524288 -height 33 -width 125
    }
    with [get-diagram -index 1 | get-edit-part -className WorkflowPart] {
        with [get-edit-part -className WorkflowNodePart -index 1] {
            mouse-move 16 23 button1 -height 41 -width 41
            mouse-press 16 23 button1 -height 41 -width 41
            mouse-release 16 23 button1 524288 -height 41 -width 41
        }
        with [get-edit-part -className WorkflowNodePart] {
            mouse-move 53 37 button1 -height 81 -width 81
            mouse-press 53 37 button1 -height 81 -width 81
            mouse-release 53 37 button1 524288 -height 81 -width 81
        }
    }
}

get-window "Connection Editor" | get-button OK | click

// verification
with [get-editor "MyWorkflow.wf" | get-diagram -index 1 | get-edit-part -className WorkflowPart] {
	get-property childrenCount | equals 2 | verify-true
	get-property "getConnections().size()" | equals 1 | verify-true
	get-property "getModel().getWorkflowLabels().size()" | equals 0 | verify-true
	get-property "getModel().getWorkflowNodes().size()" | equals 2 | verify-true
}

// execute
with [get-editor "MyWorkflow.wf" | get-diagram -index 1] {
    key-type "M1+s"
    mouse-move 84 196 button3 -height 429 -width 670
    mouse-press 84 196 button3 -height 429 -width 670
    mouse-release 84 196 button3 2097152 -height 429 -width 670
    get-menu "Execute Workflow..." | click
}
get-window "Execute workflow" | get-button Ok | click


wait 10000 // wait to make sure the workflow finished

// verification of execution
get-editor -index 1 | get-diagram | get-edit-part -className WorkflowExecutionInformationPart | get-property className
	| equals "de.rcenvironment.core.gui.workflow.parts.WorkflowExecutionInformationPart" | verify-true
get-tab-folder | get-property activePage | contains Finished | verify-true
------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--
