summaryrefslogtreecommitdiffstats
path: root/qa/t/test_votes.t
diff options
context:
space:
mode:
Diffstat (limited to 'qa/t/test_votes.t')
-rw-r--r--qa/t/test_votes.t99
1 files changed, 66 insertions, 33 deletions
diff --git a/qa/t/test_votes.t b/qa/t/test_votes.t
index ee257e85c..e97498853 100644
--- a/qa/t/test_votes.t
+++ b/qa/t/test_votes.t
@@ -16,25 +16,30 @@ use QA::Util;
my ($sel, $config) = get_selenium();
unless ($config->{test_extensions}) {
- ok(1, "this installation doesn't test extensions. Skipping test_votes.t completely.");
- exit;
+ ok(1,
+ "this installation doesn't test extensions. Skipping test_votes.t completely.");
+ exit;
}
log_in($sel, $config, 'admin');
-set_parameters($sel, { "Bug Fields" => {"useclassification-off" => undef},
- "Administrative Policies" => {"allowbugdeletion-on" => undef}
- });
+set_parameters(
+ $sel,
+ {
+ "Bug Fields" => {"useclassification-off" => undef},
+ "Administrative Policies" => {"allowbugdeletion-on" => undef}
+ }
+);
# Create a new product, so that we can safely play with vote settings.
add_product($sel);
-$sel->type_ok("product", "Eureka");
-$sel->type_ok("description", "A great new product");
-$sel->type_ok("votesperuser", 10);
+$sel->type_ok("product", "Eureka");
+$sel->type_ok("description", "A great new product");
+$sel->type_ok("votesperuser", 10);
$sel->type_ok("maxvotesperbug", 5);
$sel->type_ok("votestoconfirm", 3);
-$sel->select_ok("security_group_id", "label=core-security");
-$sel->select_ok("default_op_sys_id", "Unspecified");
+$sel->select_ok("security_group_id", "label=core-security");
+$sel->select_ok("default_op_sys_id", "Unspecified");
$sel->select_ok("default_platform_id", "Unspecified");
$sel->click_ok('//input[@type="submit" and @value="Add"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@@ -42,9 +47,13 @@ $sel->title_is("Product Created");
$sel->click_ok("link=add at least one component");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Add component to the Eureka product");
-$sel->type_ok("component", "Pegasus");
+$sel->type_ok("component", "Pegasus");
$sel->type_ok("description", "A constellation in the north hemisphere.");
-$sel->type_ok("initialowner", $config->{permanent_user}, "Setting the default owner");
+$sel->type_ok(
+ "initialowner",
+ $config->{permanent_user},
+ "Setting the default owner"
+);
$sel->uncheck_ok("watch_user_auto");
$sel->type_ok("watch_user", "pegasus\@eureka.bugs");
$sel->check_ok("watch_user_auto");
@@ -52,15 +61,17 @@ $sel->click_ok("create");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Component Created");
my $text = trim($sel->get_text("message"));
-ok($text =~ qr/The component Pegasus has been created/, "Component 'Pegasus' created");
+ok($text =~ qr/The component Pegasus has been created/,
+ "Component 'Pegasus' created");
# Create a new bug with the CONFIRMED status.
file_bug_in_product($sel, 'Eureka');
+
# CONFIRMED must be the default bug status for users with editbugs privs.
$sel->selected_label_is("bug_status", "CONFIRMED");
$sel->type_ok("short_desc", "Aries");
-$sel->type_ok("comment", "1st constellation");
+$sel->type_ok("comment", "1st constellation");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok('has been added to the database');
@@ -71,26 +82,32 @@ my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
$sel->click_ok("link=vote");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Change Votes");
+
# No comment :-/
my $full_text = trim($sel->get_body_text());
+
# OK, this is not the most robust regexp, but that's better than nothing.
-ok($full_text =~ /only 5 votes allowed per bug in this product/,
- "Notice about the number of votes allowed per bug displayed");
+ok(
+ $full_text =~ /only 5 votes allowed per bug in this product/,
+ "Notice about the number of votes allowed per bug displayed"
+);
$sel->type_ok("bug_$bug1_id", 4);
$sel->click_ok("change");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Change Votes");
$full_text = trim($sel->get_body_text());
+
# OK, we may get a false positive if another product has the exact same numbers,
# but I have no better idea to check this information.
-ok($full_text =~ /4 votes used out of 10 allowed/, "Display the number of votes used");
+ok($full_text =~ /4 votes used out of 10 allowed/,
+ "Display the number of votes used");
# File a new bug, now as UNCONFIRMED. We will confirm it by popular votes.
file_bug_in_product($sel, 'Eureka');
$sel->select_ok("bug_status", "UNCONFIRMED");
$sel->type_ok("short_desc", "Taurus");
-$sel->type_ok("comment", "2nd constellation");
+$sel->type_ok("comment", "2nd constellation");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok('has been added to the database');
@@ -113,7 +130,7 @@ $sel->is_text_present_ok("Bug $bug2_id confirmed by number of votes");
file_bug_in_product($sel, 'Eureka');
$sel->select_ok("bug_status", "UNCONFIRMED");
$sel->type_ok("short_desc", "Gemini");
-$sel->type_ok("comment", "3rd constellation");
+$sel->type_ok("comment", "3rd constellation");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok('has been added to the database');
@@ -131,14 +148,18 @@ $sel->type_ok("bug_$bug3_id", 2);
$sel->click_ok("change");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Change Votes");
+
# Illegal change: max is 5 votes per bug!
$sel->type_ok("bug_$bug2_id", 15);
$sel->click_ok("change");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Illegal Vote");
$text = trim($sel->get_text("error_msg"));
-ok($text =~ /You may only use at most 5 votes for a single bug in the Eureka product, but you are trying to use 15/,
- "Too many votes per bug");
+ok(
+ $text
+ =~ /You may only use at most 5 votes for a single bug in the Eureka product, but you are trying to use 15/,
+ "Too many votes per bug"
+);
# FIXME: We cannot use go_back_ok() here, because Firefox complains about
# POST data not being stored in its cache. As a workaround, we go to
@@ -156,8 +177,11 @@ $sel->click_ok("change");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Illegal Vote");
$text = trim($sel->get_text("error_msg"));
-ok($text =~ /You tried to use 12 votes in the Eureka product, which exceeds the maximum of 10 votes for this product/,
- "Too many votes for this product");
+ok(
+ $text
+ =~ /You tried to use 12 votes in the Eureka product, which exceeds the maximum of 10 votes for this product/,
+ "Too many votes for this product"
+);
# Decrease the confirmation threshold so that $bug3 becomes confirmed.
@@ -168,7 +192,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Updating Product 'Eureka'");
$full_text = trim($sel->get_body_text());
ok($full_text =~ /Updated number of votes needed to confirm a bug from 3 to 2/,
- "Confirming the new number of votes to confirm");
+ "Confirming the new number of votes to confirm");
$sel->is_text_present_ok("Bug $bug3_id confirmed by number of votes");
# Decrease the number of votes per bug so that $bug2 is updated.
@@ -181,9 +205,11 @@ $sel->click_ok('//input[@type="submit" and @value="Save Changes"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Updating Product 'Eureka'");
$full_text = trim($sel->get_body_text());
-ok($full_text =~ /Updated maximum votes per bug from 5 to 4/, "Confirming the new number of votes per bug");
-$sel->is_text_present_ok("removed votes for bug $bug2_id from " . $config->{admin_user_login}, undef,
- "Removed votes from the admin");
+ok($full_text =~ /Updated maximum votes per bug from 5 to 4/,
+ "Confirming the new number of votes per bug");
+$sel->is_text_present_ok(
+ "removed votes for bug $bug2_id from " . $config->{admin_user_login},
+ undef, "Removed votes from the admin");
# Go check that $bug2 has been correctly updated.
@@ -202,7 +228,10 @@ $sel->click_ok('//input[@type="submit" and @value="Save Changes"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Updating Product 'Eureka'");
$full_text = trim($sel->get_body_text());
-ok($full_text =~ /Updated votes per user from 10 to 5/, "Confirming the new number of votes per user");
+ok(
+ $full_text =~ /Updated votes per user from 10 to 5/,
+ "Confirming the new number of votes per user"
+);
$sel->is_text_present_ok("removed votes for bug");
# Go check that $bug3 has been correctly updated.
@@ -221,14 +250,16 @@ $sel->click_ok('//input[@type="submit" and @value="Save Changes"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Updating Product 'Eureka'");
$full_text = trim($sel->get_body_text());
-ok($full_text =~ /The product no longer allows the UNCONFIRMED status/, "Disable UNCONFIRMED");
+ok($full_text =~ /The product no longer allows the UNCONFIRMED status/,
+ "Disable UNCONFIRMED");
# File a new bug. UNCONFIRMED must not be listed as a valid bug status.
file_bug_in_product($sel, "Eureka");
-ok(!scalar(grep {$_ eq "UNCONFIRMED"} $sel->get_select_options("bug_status")), "UNCONFIRMED not listed");
+ok(!scalar(grep { $_ eq "UNCONFIRMED" } $sel->get_select_options("bug_status")),
+ "UNCONFIRMED not listed");
$sel->type_ok("short_desc", "Cancer");
-$sel->type_ok("comment", "4th constellation");
+$sel->type_ok("comment", "4th constellation");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->is_text_present_ok('has been added to the database');
@@ -244,8 +275,10 @@ $sel->click_ok('//a[@href="editproducts.cgi?action=del&product=Eureka"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Delete Product 'Eureka'");
$full_text = trim($sel->get_body_text());
-ok($full_text =~ /There are 4 bugs entered for this product/, "Display warning about existing bugs");
-ok($full_text =~ /Pegasus: A constellation in the north hemisphere/, "Display product description");
+ok($full_text =~ /There are 4 bugs entered for this product/,
+ "Display warning about existing bugs");
+ok($full_text =~ /Pegasus: A constellation in the north hemisphere/,
+ "Display product description");
$sel->click_ok("delete");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Product Deleted");