Bug 64428 - Remove custom fields and bugs after testing in some tests

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1140 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-12-07 17:13:09 +00:00
parent 9d8c07ce85
commit e6d1079158
4 changed files with 80 additions and 4 deletions

View File

@ -20,6 +20,7 @@ use base qw(Exporter);
log_in
logout
file_bug_in_product
delete_bugs
go_to_admin
edit_product
add_product
@ -315,6 +316,53 @@ sub set_parameters {
}
}
1;
sub delete_bugs
{
my ($sel, $config, $bugs) = @_;
# Enable allowbugdeletion
set_parameters($sel, { "Administrative Policies" => {"allowbugdeletion-on" => undef } });
edit_product($sel, 'TestProduct', 'Unclassified');
$sel->click_ok("link=Edit components:");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select component of product 'TestProduct'");
my $text = trim($sel->get_text("bugzilla-body"));
if ($text !~ /KillerComponent/)
{
# Create KillerComponent
$sel->click_ok("link=Add");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->type_ok("component", "KillerComponent");
$sel->type_ok("description", "Component killing bugs");
$sel->type_ok("initialowner", $config->{unprivileged_user_login});
$sel->type_ok("initialqacontact", $config->{unprivileged_user_login});
$sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
}
# Move bugs into KillerComponent
for (@$bugs)
{
$sel->type_ok("quicksearch_top", $_);
$sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $_/);
$sel->select_ok("product", "label=TestProduct");
$sel->select_ok("component", "label=KillerComponent");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug $_ processed");
}
# Delete KillerComponent and all bugs in it
edit_product($sel, 'TestProduct', 'Unclassified');
$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("//a[contains(\@href, 'editcomponents.cgi?action=del&product=TestProduct&component=KillerComponent')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete component 'KillerComponent' from 'TestProduct' product");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Deleted");
}
1;
__END__

View File

@ -139,4 +139,7 @@ $sel->title_is("Classification Deleted");
set_parameters($sel, { "Bug Fields" => {"useclassification-off" => undef} });
$sel->open_ok("/$config->{bugzilla_installation}/editclassifications.cgi");
$sel->title_is("Classification Not Enabled");
delete_bugs($sel, $config, [$bug1_id]);
logout($sel);

View File

@ -29,3 +29,5 @@ $sel->key_press("comment_textarea", "\\13");
$sel->control_key_up;
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug $bug1_id processed");
delete_bugs($sel, $config, [$bug1_id]);

View File

@ -7,6 +7,7 @@ use Test::More "no_plan";
use QA::Util;
my ($sel, $config) = get_selenium();
my ($bug1_id, $bug2_id);
log_in($sel, $config, 'admin');
# Create new bug to test custom fields
@ -17,7 +18,7 @@ $sel->type_ok("comment", "I only want the ID of this bug to generate a unique cu
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/Bug \d+ Submitted/, "Bug created");
my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
$bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
# Create custom fields
@ -93,7 +94,7 @@ $sel->type_ok("comment", "hops!");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/Bug \d+ Submitted/, "Bug created");
my $bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
$bug2_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
# Both fields are editable.
@ -242,9 +243,13 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug $bug1_id processed");
logout($sel);
# Disable the remaining free text field.
# Delete bugs $bug1_id and $bug2_id
log_in($sel, $config, 'admin');
delete_bugs($sel, $config, [$bug1_id, $bug2_id]);
# Disable the remaining free text field.
go_to_admin($sel);
$sel->click_ok("link=Custom Fields");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -257,4 +262,22 @@ $sel->value_is("obsolete", "on");
$sel->click_ok("edit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Custom Field Updated");
# Delete our custom fields
for (qw(Freetext List))
{
my ($n, $d) = ('cf_qa_'.lc($_).'_'.$bug1_id, $_.$bug1_id);
go_to_admin($sel);
$sel->click_ok("link=Custom Fields");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Custom Fields");
$sel->click_ok("//a[contains(\@href, 'editfields.cgi?action=del&name=$n')]");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete the Custom Field '$n' ($d)");
$sel->click_ok("link=Delete field '$d'");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Custom Field Deleted");
_ok(!$sel->is_element_present("//a[contains(\@href, 'editfields.cgi?action=del&name=$n')]"), 'The field is not displayed from cache');
}
logout($sel);