2
* This file is part of Checkbox
4
* Copyright 2013 Canonical Ltd.
7
* - Julia Segal <julia.segal@cellsoftware.co.uk>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
import Ubuntu.Components 0.1
25
import Ubuntu.Components.Popups 0.1
27
/* TODO - Default Yes/No/Skip based on plainbox interpretation of result
28
* which the user can then change if they wish.
33
property var testItem;
34
/* Manual jobs may define a shell command as part of the test procedure.
35
* When such command exists, the following property is set, enabling
36
* the corresponding "Test" button. Otherwise it's greyed out.
38
property var showTestButton;
39
property var testStatus;
41
title: i18n.tr("Manual Test")
42
text: testItem.testname//i18n.tr("Name of the Test.")
45
id: manual_interaction_activity
47
anchors.horizontalCenter: instructions.horizontalCenter
54
text: testItem.description
57
cursorDelegate: Item { id: emptycursor }
63
color: UbuntuColors.orange
64
enabled: showTestButton ? true : false
66
/* So the user knows this is happening, grey the buttons until
69
manualtestbutton.enabled = false;
70
continuebutton.enabled = false;
71
yescheck.enabled = false;
72
nocheck.enabled = false;
73
skipcheck.enabled = false;
75
manual_interaction_activity.running = true;
77
// Ok, run this test. Result and comments dont matter here
78
guiEngine.ResumeFromManualInteractionDialog(true,"fail","no comment")
87
checked: testStatus === 2 /* PBJobResult_Pass */ ? true : false
90
nocheck.checked = !checked
91
skipcheck.checked = !checked
97
anchors.left: yescheck.right
98
anchors.verticalCenter: parent.verticalCenter
99
anchors.leftMargin: units.gu(1)
107
checked: testStatus === 3 /* PBJobResult_Fail */ ? true : false
110
yescheck.checked = !checked
111
skipcheck.checked = !checked
117
anchors.left: nocheck.right
118
anchors.verticalCenter: parent.verticalCenter
119
anchors.leftMargin: units.gu(1)
126
text: i18n.tr("Skip")
127
checked: testStatus === 1 /* PBJobResult_Skip */ ? true : false
130
nocheck.checked = !checked
131
yescheck.checked = !checked
137
anchors.left: skipcheck.right
138
anchors.verticalCenter: parent.verticalCenter
139
anchors.leftMargin: units.gu(1)
140
text: i18n.tr("Skip")
148
text: i18n.tr("Comments")
162
text: i18n.tr("Continue")
163
color: UbuntuColors.warmGrey
165
if (skipcheck.checked && comments.text === "")
167
PopupUtils.open(skip_warning_dialog, continuebutton);
170
// Ok, we can continue
172
// Get the right outcome...
173
if (yescheck.checked) {
175
guiEngine.ResumeFromManualInteractionDialog(false,"pass",comments.text)
176
} else if (nocheck.checked) {
178
guiEngine.ResumeFromManualInteractionDialog(false,"fail",comments.text)
179
} else if (skipcheck.checked) {
181
guiEngine.ResumeFromManualInteractionDialog(false,"skip",comments.text)
184
PopupUtils.close(dialog)
192
id: skip_warning_dialog
194
text: i18n.tr("Skipping a test requires a reason to be entered in the Comments field. Please update that field and click 'Continue' again.");
206
id: manual_interaction_connections
208
onUpdateManualInteractionDialog: {
209
// Remove the activity indicator
210
manual_interaction_activity.running = false;
212
// Re-enable these buttons as the test has completed
214
manualtestbutton.enabled = true;
216
manualtestbutton.enabled = false;
218
continuebutton.enabled = true;
219
yescheck.enabled = true;
220
nocheck.enabled = true;
221
skipcheck.enabled = true;
223
// Outcome values refer to PBJobResult enums
224
if (suggested_outcome === 2 /* PBJobResult_Pass */) {
225
yescheck.checked = true;
226
nocheck.checked = false;
227
skipcheck.checked = false; // we didnt skip it
229
yescheck.checked = false;
230
nocheck.checked = true;
231
skipcheck.checked = false; // we didnt skip it
234
onCloseManualInteractionDialog: {
235
PopupUtils.close(dialog)
238
Component.onCompleted:
240
instructions.focus = true