blob: 01251635e962402de36213db157163ec0fa17ca7 [file] [log] [blame]
--- RCPTT testcase ---
Format-Version: 1.0
Context-Type: org.eclipse.rcptt.ctx.ecl
Element-Name: HelperScripts
Element-Type: context
Element-Version: 2.0
Id: _jPStUFRJEeaXLqlXvYQIgg
Runtime-Version: 2.1.0.201605312320
Save-Time: 11/2/16 5:36 PM
------=_.ecl.context-718f04b4-ed39-33e3-af62-0995e4561998
Content-Type: text/ecl
Entry-Name: .ecl.context
proc "add-gerrit-server" [val serverURL] [val serverName] [val userName] [val userPwd] {
get-preferences-menu | click
with [get-window Preferences] {
get-tree | select "Team/Gerrit Servers"
get-button "New..." | click
with [get-window "Gerrit Server Selection"] {
get-editbox -after [get-label "URL:"] | set-text $serverURL
with [get-editbox -after [get-label "Label:"]] {
set-text $serverName
}
try {
get-editbox -after [get-label "User:"] | set-text $userName
}
get-button OK | click
}
get-button Apply | click
get-button OK | click
}
}
proc "delete-gerrit-server" [val serverName] {
// delete server if present
get-preferences-menu | click
with [get-window Preferences] {
get-editbox | set-text gerrit
get-tree | select "Team/Gerrit Servers" | double-click
try {
get-table | select $serverName
get-button Remove | click
get-button Apply | click
} -catch {
}
get-button OK | click
}
}
// Return the dashboard view. Open it if necessary.
proc getDashboard [] {
try {
get-view "Gerrit Dashboard (EGerrit)"
} -catch {
get-menu "Window/Show View/Other..." | click
with [get-window "Show View"] {
get-tree | select "Git/Gerrit Dashboard (EGerrit)"
get-button OK | click
}
get-view "Gerrit Dashboard (EGerrit)"
}
}
// Close the dashboard view
proc closeDashboard [] {
try {
get-view "Gerrit Dashboard (EGerrit)" | close
}
}
// Enter a query in the dashboard search dialog and execute it. The query is executed against the default server.
proc runQuery [val query] [val serverName $serverName] {
selectActiveServer -serverName $serverName
get-view "Gerrit Dashboard (EGerrit)" | get-combo | set-text $query
get-button Search | click
}
proc selectActiveServer [val serverName] {
getDashboard | get-button "Select current Gerrit repository" | click -arrow
get-menu $serverName | click
}
// Run the query and open the review editor on the first match
proc runQueryAndOpenEditor [val query] [val serverName $serverName] {
try {
runQuery [$query | get lastChangeId] -serverName $serverName
} -catch {
runQuery [$query] -serverName $serverName
}
wait -ms 500
with [getDashboard] {
with [get-table] {
get-cell -row 0 -column 1 | double-click
}
}
}
proc openCompareEditor [val query] [val serverName $serverName] {
runQueryAndOpenEditor $query $serverName
with [get-table -index 1 | get-column-header "File Path"] {
click
}
// Select the first file in the list
with [get-editor | get-table -index 1] {
get-cell -row 0 -column 2 | double-click
}
try {
// Click ok on tip
get-window "EGerrit Tip" | get-button OK | click
} -catch {}
}
proc switchLeftInput [val to] [val in -input] {
with [$in | get-button -after [get-label -index 0]] {
click
get-menu $to | click
}
wait 200
}
proc switchRightInput [val to] [val in -input] {
with [$in | get-button -after [get-label -index 2]] {
click
get-menu $to | click
}
wait 200
}
proc insertComment [val on] [val text] [val atLine] [val save false] [val column 0] [val in -input] {
if [$on | equals right] {
doInsertComment -idx 1 -text $text -atLine $atLine -col $column -in $in
} -else {
doInsertComment -idx 0 -text $text -atLine $atLine -col $column -in $in
}
if [$save] {
with [$in] {
key-type "M1+s"
}
}
}
proc doInsertComment [val idx] [val text] [val atLine] [val col 0] [val in -input] {
with [$in | get-text-viewer -index $idx] {
set-caret-pos -line $atLine -column $col
type-text $text
}
}
proc "assert-that-status-in-dashboard" [val is] {
getDashboard | get-table | get-item false | get-property "columns[3]" | equals $is | verify-true
}
proc "assert-that-subject-in-dashboard" [val is] {
getDashboard | get-table | get-item false | get-property "columns[2]" | equals $is | verify-true
}
proc "assert-that-first-entry-in-history-table" [val atColumn] [val is] [val in -input] {
with [$in] {
get-tab-folder | get-tab-item History | click
}
with [get-table] {
get-cell -row 0 -column 1 | get-property [concat "columns[" $atColumn "]"] | contains $is | verify-true
}
}
proc "assert-that-status-in-editor-header" [val is] [val in -input] {
$in | get-editbox -after [get-label "ID:"] -index 1 | get-property text | equals $is | verify-true
}
proc "assert-that-radio-button" [val button] [val is] [val in -input] {
with [$in] {
if [$is | equals enabled] {
get-button $button | get-property selected | equals true | verify-true
}
if [$is | equals disabled] {
get-button $button | get-property selected | equals false | verify-true
}
if [$is | equals "not-present"] {
verify-error {
get-button $button
}
}
}
}
proc "assert-that-button" [val button] [val is] [val in -input] {
with [$in] {
if [$is | equals enabled] {
get-button $button | get-property enablement | equals true | verify-true
}
if [$is | equals disabled] {
get-button $button | get-property enablement | equals false | verify-true
}
if [$is | equals "not-present"] {
verify-error {
get-button $button
}
}
}
}
proc "assert-that-search-box-in-dashboard" [val is] {
getDashboard | get-combo | get-property selection | equals $is | verify-true
}
proc "assert-that-subject-in-editor" [val is] [val in -input] {
$in | get-editbox -after [get-label "Subject:"] | get-property text | equals $is | verify-true
}
proc "assert-that-patchset-counter-in-editor" [val is] [val in -input] {
$in | get-label "Patch Sets.*" | get-property caption | contains $is | verify-true
}
proc "assert-that-left-selected-patch" [val is] [val in -input] {
with [$in] {
get-label -index 0 | get-property caption | equals $is | verify-true
}
}
proc "assert-that-right-selected-patch" [val is] [val in -input] {
with [$in] {
get-label -index 2 | get-property caption | equals $is | verify-true
}
}
proc "assert-that-left-editor-content" [val is] [val in -input] {
with [$in] {
get-editbox -index 0 | get-property text | contains $is | verify-true
}
}
proc "assert-that-right-editor-content" [val is] [val in -input] {
with [$in] {
get-editbox -index 1 | get-property text | contains $is | verify-true
}
}
proc "assert-that-first-entry-in-reviewer-table" [val atColumn] [val is] [val in -input] {
with [$in] {
get-tab-folder | get-tab-item Details | click
}
with [get-table -index 0] {
get-cell -row 0 -column 1 | get-property [concat "columns[" $atColumn "]"] | contains $is | verify-true
}
}
proc "assert-that-no-editor-present" [] {
try {
get-editor -index 0
verify-true 0
} -catch {
verify-true 1
}
}
proc "assert-that-patchset-menu" [val contains] [val in -input] {
with [$in | get-button -after [get-label "Patch Sets.*"]] {
click
get-menu $contains
}
}
proc "assert-that-number-of-files-in-compare" [val is] [val compare -input] {
with [$compare] {
get-tree | get-property "getItems().length" | equals $is | verify-true
}
}
proc "assert-that-selected-text" [val is] [val in -input] {
$in | get-property -name "getSelectionText()" | equals $is | verify-true
}
proc "get-right-editor" [val in -input] {
get-text-viewer -index 1
}
proc "assert-that-star-in-dashboard-is-off" [val is] {
assert-that-star-in-dashboard -is "org.eclipse.egerrit.dashboard.ui/icons/view16/starOpen.gif"
}
proc "assert-that-star-in-dashboard-is-on" [val is] [val in -input] {
assert-that-star-in-dashboard -is "org.eclipse.egerrit.dashboard.ui/icons/view16/starFilled.gif"
}
proc "assert-that-star-in-dashboard" [val is] [val in -input] {
getDashboard | get-table | get-cell -row 0 -column 0 | get-property "cells[0].image.path" | equals $is | verify-true
}
proc "assert-dialog" [val named] [val containsText] [val dismiss true] {
get-window $named | get-label $containsText | get-property caption | equals $containsText | verify-true
if [$dismiss | equals true] {
get-window $named | get-button OK | click
}
}
proc "assert-marker-count-is" [val is] {
get-view Markers | get-label [concat $is " items"] | get-property caption | equals [concat $is " items"]
| verify-true
}
proc "assert-sameTopic-table" [val contains] [val in -input] {
$in | get-group "Same Topic" | get-table | get-cell -row 1 -column 0 | get-property "columns[0]" | equals $contains | verify-true
}
proc "switch-user" [val to] {
// Add a server connected by an anonymous user and make it the default server
add-gerrit-server -serverURL $serverURL -serverName $to -userName $to
selectActiveServer -serverName $to
}
proc "assert-that-itemCount-in-history-is" [val is]{
get-property itemCount | equals $is | verify-true
}
proc "assert-that-status-in-compare" [val atLine] [val is] [val in -input] {
with [$in | get-tree] {
get-item "" -index $atLine | get-property "columns[1]" | equals $is | verify-true
}
}
proc "assert-that-filename-in-compare" [val atLine] [val is] [val in -input] {
with [$in | get-tree] {
get-item "" -index $atLine | get-property "columns[2]" | equals $is | verify-true
}
}
------=_.ecl.context-718f04b4-ed39-33e3-af62-0995e4561998--