1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
use strict;
use warnings;
use lib qw(lib);
use Test::More "no_plan";
use QA::Util;
my ($sel, $config) = get_selenium();
my ($text, $bug_id);
my $admin_user_login = $config->{admin_user_login};
log_in($sel, $config, 'admin');
set_parameters($sel, { "Bug Fields" => {"useclassification-off" => undef,
"usetargetmilestone-on" => undef},
"Administrative Policies" => {"allowbugdeletion-on" => undef},
});
# create a clean bug
file_bug_in_product($sel, "TestProduct");
$sel->select_ok("component", "label=TestComponent");
$sel->type_ok("short_desc", "testing testComponent");
$sel->type_ok("comment", "testing");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
my $clean_bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']");
$sel->is_text_present_ok('has been added to the database', "Bug $clean_bug_id created");
#
# component
#
# add a new component to TestProduct
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit components:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select component of product 'TestProduct'");
$text = trim($sel->get_text("bugzilla-body"));
if ($text =~ /TempComponent/) {
$sel->click_ok("//a[contains(\@href, 'editcomponents.cgi?action=del&product=TestProduct&component=TempComponent')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete component 'TempComponent' from 'TestProduct' product");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Deleted");
}
$sel->click_ok("link=Add");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Add component to the TestProduct product");
$sel->type_ok("component", "TempComponent");
$sel->type_ok("description", "Temp component");
$sel->type_ok("initialowner", $admin_user_login);
$sel->uncheck_ok("watch_user_auto");
$sel->type_ok("watch_user", 'tempcomponent@testproduct.bugs');
$sel->check_ok("watch_user_auto");
$sel->click_ok('//input[@type="submit" and @value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Created");
# create bug into TempComponent
file_bug_in_product($sel, "TestProduct");
$sel->select_ok("component", "label=TempComponent");
$sel->type_ok("short_desc", "testing tempComponent");
$sel->type_ok("comment", "testing");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']");
$sel->is_text_present_ok('has been added to the database', "Bug $bug_id created");
# disable TestProduct:TestComponent for bug entry
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit components:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select component of product 'TestProduct'");
$sel->click_ok("link=TempComponent");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit component 'TempComponent' of product 'TestProduct'");
$sel->click_ok("isactive");
$sel->click_ok("update");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Updated");
$text = trim($sel->get_text("bugzilla-body"));
ok($text =~ /Disabled for bugs/, "Component deactivation confirmed");
# update bug TempComponent bug
go_to_bug($sel, $bug_id);
# make sure the component is still tempcomponent
$sel->selected_label_is("component", 'TempComponent');
# update
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok("Changes submitted for bug $bug_id");
$sel->click_ok("link=bug $bug_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
# make sure the component is still tempcomponent
ok($sel->get_selected_labels("component"), 'TempComponent');
# try creating new bug with TempComponent
file_bug_in_product($sel, "TestProduct");
ok(!$sel->is_element_present(
q#//select[@id='component']/option[@value='TempComponent']#),
'TempComponent is missing from create');
# try changing compoent of existing bug to TempComponent
go_to_bug($sel, $clean_bug_id);
ok(!$sel->is_element_present(
q#//select[@id='component']/option[@value='TempComponent']#),
'TempComponent is missing from update');
# delete TempComponent
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit components:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->click_ok("//a[contains(\@href, 'editcomponents.cgi?action=del&product=TestProduct&component=TempComponent')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete component 'TempComponent' from 'TestProduct' product");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Deleted");
#
# version
#
# add a new version to TestProduct
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit versions:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select version of product 'TestProduct'");
$text = trim($sel->get_text("bugzilla-body"));
if ($text =~ /TempVersion/) {
$sel->click_ok("//a[contains(\@href, 'editversions.cgi?action=del&product=TestProduct&version=TempVersion')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete Version of Product 'TestProduct'");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Version Deleted");
}
$sel->click_ok("link=Add");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Add Version to Product 'TestProduct'");
$sel->type_ok("version", "TempVersion");
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Version Created");
# create bug with new version
file_bug_in_product($sel, "TestProduct");
$sel->select_ok("version", "label=TempVersion");
$sel->type_ok("short_desc", "testing tempVersion");
$sel->type_ok("comment", "testing");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']");
$sel->is_text_present_ok('has been added to the database', "Bug $bug_id created");
# disable new version for bug entry
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit versions:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select version of product 'TestProduct'");
$sel->click_ok("link=TempVersion");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Version 'TempVersion' of product 'TestProduct'");
$sel->click_ok("isactive");
$sel->click_ok("update");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Version Updated");
$text = trim($sel->get_text("bugzilla-body"));
ok($text =~ /Disabled for bugs/, "Version deactivation confirmed");
# update new version bug
go_to_bug($sel, $bug_id);
# make sure the version is still tempversion
$sel->selected_label_is("version", 'TempVersion');
# update
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok("Changes submitted for bug $bug_id");
$sel->click_ok("link=bug $bug_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
# make sure the version is still tempversion
$sel->selected_label_is("version", 'TempVersion');
# change the version so it can be deleted
$sel->select_ok("version", "label=unspecified");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok("Changes submitted for bug $bug_id");
# try creating new bug with new version
file_bug_in_product($sel, "TestProduct");
ok(!$sel->is_element_present(
q#//select[@id='version']/option[@value='TempVersion']#),
'TempVersion is missing from create');
# try changing existing bug to new version
go_to_bug($sel, $clean_bug_id);
ok(!$sel->is_element_present(
q#//select[@id='version']/option[@value='TempVersion']#),
'TempVersion is missing from update');
# delete new version
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit versions:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select version of product 'TestProduct'");
$text = trim($sel->get_text("bugzilla-body"));
$sel->click_ok("//a[contains(\@href, 'editversions.cgi?action=del&product=TestProduct&version=TempVersion')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete Version of Product 'TestProduct'");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Version Deleted");
#
# milestone
#
# add a milestone to TestProduct
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit milestones:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select milestone of product 'TestProduct'");
$text = trim($sel->get_text("bugzilla-body"));
if ($text =~ /TempMilestone/) {
$sel->click_ok("//a[contains(\@href, 'editmilestones.cgi?action=del&product=TestProduct&milestone=TempMilestone')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete Milestone of Product 'TestProduct'");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Milestone Deleted");
}
$sel->click_ok("link=Add");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Add Milestone to Product 'TestProduct'");
$sel->type_ok("milestone", "TempMilestone");
$sel->type_ok("sortkey", "999");
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Milestone Created");
# create bug with milestone
file_bug_in_product($sel, "TestProduct");
$sel->select_ok("target_milestone", "label=TempMilestone");
$sel->type_ok("short_desc", "testing tempMilestone");
$sel->type_ok("comment", "testing");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$bug_id = $sel->get_value("//input[\@name='id' and \@type='hidden']");
$sel->is_text_present_ok('has been added to the database', "Bug $bug_id created");
# disable milestone for bug entry
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit milestones:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select milestone of product 'TestProduct'");
$sel->click_ok("link=TempMilestone");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Milestone 'TempMilestone' of product 'TestProduct'");
$sel->click_ok("isactive");
$sel->click_ok("update");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Milestone Updated");
$text = trim($sel->get_text("bugzilla-body"));
ok($text =~ /Disabled for bugs/, "Milestone deactivation confirmed");
# update milestone bug
go_to_bug($sel, $bug_id);
# make sure the milestone is still tempmilestone
$sel->selected_label_is("target_milestone", 'TempMilestone');
# update
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok("Changes submitted for bug $bug_id");
$sel->click_ok("link=bug $bug_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
# make sure the milestone is still tempmilestone
$sel->selected_label_is("target_milestone", 'TempMilestone');
# try creating new bug with milestone
file_bug_in_product($sel, "TestProduct");
ok(!$sel->is_element_present(
q#//select[@id='target_milestone']/option[@value='TempMilestone']#),
'TempMilestone is missing from create');
# try changing existing bug to milestone
go_to_bug($sel, $clean_bug_id);
ok(!$sel->is_element_present(
q#//select[@id='target_milestone']/option[@value='TempMilestone']#),
'TempMilestone is missing from update');
# delete milestone
go_to_admin($sel);
$sel->click_ok("link=Products");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select product");
$sel->click_ok("link=TestProduct");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit Product 'TestProduct'");
$sel->click_ok("link=Edit milestones:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select milestone of product 'TestProduct'");
$text = trim($sel->get_text("bugzilla-body"));
$sel->click_ok("//a[contains(\@href, 'editmilestones.cgi?action=del&product=TestProduct&milestone=TempMilestone')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete Milestone of Product 'TestProduct'");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Milestone Deleted");
logout($sel);
|