diff options
Diffstat (limited to 'qa/t/test_flags2.t')
-rw-r--r-- | qa/t/test_flags2.t | 110 |
1 files changed, 68 insertions, 42 deletions
diff --git a/qa/t/test_flags2.t b/qa/t/test_flags2.t index 380246c9d..b2c2b58ca 100644 --- a/qa/t/test_flags2.t +++ b/qa/t/test_flags2.t @@ -32,7 +32,7 @@ $sel->title_is("Administer Flag Types"); $sel->click_ok("link=Create Flag Type for Bugs"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); -$sel->type_ok("name", "selenium"); +$sel->type_ok("name", "selenium"); $sel->type_ok("description", "Available in TestProduct and Another Product/c1"); $sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); @@ -43,7 +43,7 @@ $sel->selected_label_is("component", "__Any__"); $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); -$sel->select_ok("product", "label=Another Product"); +$sel->select_ok("product", "label=Another Product"); $sel->select_ok("component", "label=c1"); $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -55,11 +55,11 @@ $sel->title_is("Create Flag Type for Bugs"); # catch it, not this one (which will be unique for now, so no worry to find it). $sel->type_ok("sortkey", 100); -$sel->value_is("is_active", "on"); +$sel->value_is("is_active", "on"); $sel->value_is("is_requestable", "on"); $sel->click_ok("is_multiplicable"); $sel->value_is("is_multiplicable", "off"); -$sel->select_ok("grant_group", "label=editbugs"); +$sel->select_ok("grant_group", "label=editbugs"); $sel->select_ok("request_group", "label=canconfirm"); $sel->click_ok("save"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -81,7 +81,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->click_ok("link=Create Flag Type For Attachments"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); -$sel->type_ok("name", "selenium_review"); +$sel->type_ok("name", "selenium_review"); $sel->type_ok("description", "Review flag used by Selenium"); $sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); @@ -92,11 +92,11 @@ $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); $sel->type_ok("sortkey", 100); -$sel->value_is("is_active", "on"); +$sel->value_is("is_active", "on"); $sel->value_is("is_requestable", "on"); $sel->click_ok("is_multiplicable"); $sel->value_is("is_multiplicable", "off"); -$sel->selected_label_is("grant_group", "(no group)"); +$sel->selected_label_is("grant_group", "(no group)"); $sel->selected_label_is("request_group", "(no group)"); $sel->click_ok("save"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -118,17 +118,17 @@ $sel->go_back_ok(); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->click_ok("link=Create Flag Type For Attachments"); $sel->wait_for_page_to_load_ok(WAIT_TIME); -$sel->type_ok("name", "selenium_review"); +$sel->type_ok("name", "selenium_review"); $sel->type_ok("description", "Another review flag used by Selenium"); $sel->select_ok("product", "label=Another Product"); $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Attachments"); $sel->type_ok("sortkey", 50); -$sel->value_is("is_active", "on"); -$sel->value_is("is_requestable", "on"); +$sel->value_is("is_active", "on"); +$sel->value_is("is_requestable", "on"); $sel->value_is("is_multiplicable", "on"); -$sel->select_ok("grant_group", "label=editbugs"); +$sel->select_ok("grant_group", "label=editbugs"); $sel->select_ok("request_group", "label=canconfirm"); $sel->click_ok("save"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -147,14 +147,19 @@ my $aflagtype2_id = $1; file_bug_in_product($sel, 'TestProduct'); $sel->click_ok('//input[@value="Set bug flags"]'); $sel->select_ok("flag_type-$flagtype1_id", "label=+"); -$sel->type_ok("short_desc", "The selenium flag should be kept on product change"); +$sel->type_ok("short_desc", + "The selenium flag should be kept on product change"); $sel->type_ok("comment", "pom"); $sel->click_ok('//input[@value="Add an attachment"]'); $sel->attach_file('//input[@name="data"]', $config->{attachment_file}); $sel->type_ok('//input[@name="description"]', "small patch"); + # This somehow fails with the current script but works when testing manually # $sel->value_is('//input[@name="ispatch"]', "on"); -ok(!$sel->is_element_present("flag_type-$aflagtype1_id"), "Flag type $aflagtype1_id not available in TestProduct"); +ok( + !$sel->is_element_present("flag_type-$aflagtype1_id"), + "Flag type $aflagtype1_id not available in TestProduct" +); $sel->select_ok("flag_type-$aflagtype2_id", "label=-"); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -167,7 +172,8 @@ $sel->click_ok("link=Bug $bug1_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id /); $sel->is_text_present_ok("$config->{admin_user_nick}: selenium"); -my $flag1_id = $sel->get_attribute('//select[@title="Available in TestProduct and Another Product/c1"]@id'); +my $flag1_id = $sel->get_attribute( + '//select[@title="Available in TestProduct and Another Product/c1"]@id'); $flag1_id =~ s/flag-//; $sel->selected_label_is("flag-$flag1_id", "+"); $sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); @@ -176,7 +182,8 @@ $sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); # Both the bug and attachment flags should survive. $sel->select_ok("product", "label=Another Product"); -$sel->type_ok("comment", "Moving to Another Product / c1. The flag should be preserved."); +$sel->type_ok("comment", + "Moving to Another Product / c1. The flag should be preserved."); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Verify New Product Details..."); @@ -201,8 +208,12 @@ $sel->is_text_present_ok("Changes submitted for bug $bug1_id"); $sel->click_ok("link=bug $bug1_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id /); -ok(!$sel->is_element_present("flag-$flag1_id"), "The selenium bug flag didn't survive"); -ok(!$sel->is_element_present("flag_type-$flagtype1_id"), "The selenium flag type doesn't exist"); +ok( + !$sel->is_element_present("flag-$flag1_id"), + "The selenium bug flag didn't survive" +); +ok(!$sel->is_element_present("flag_type-$flagtype1_id"), + "The selenium flag type doesn't exist"); $sel->is_text_present_ok("$config->{admin_user_nick}: selenium_review-"); # File a bug in 'Another Product / c2' and assign it @@ -212,12 +223,14 @@ file_bug_in_product($sel, 'Another Product'); $sel->click_ok('//input[@value="Set bug flags"]'); $sel->select_ok("component", "label=c2"); $sel->type_ok("assigned_to", $config->{unprivileged_user_login}); -ok(!$sel->is_editable("flag_type-$flagtype1_id"), "The selenium bug flag type is displayed but not selectable"); +ok(!$sel->is_editable("flag_type-$flagtype1_id"), + "The selenium bug flag type is displayed but not selectable"); $sel->select_ok("component", "label=c1"); -$sel->is_editable_ok("flag_type-$flagtype1_id", "The selenium bug flag type is not selectable"); +$sel->is_editable_ok("flag_type-$flagtype1_id", + "The selenium bug flag type is not selectable"); $sel->select_ok("flag_type-$flagtype1_id", "label=?"); $sel->type_ok("short_desc", "Create a new selenium flag for c2"); -$sel->type_ok("comment", "."); +$sel->type_ok("comment", "."); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->is_text_present_ok('has been added to the database', 'Bug created'); @@ -229,7 +242,8 @@ $sel->click_ok("link=Bug $bug2_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug2_id /); $sel->is_text_present_ok("$config->{admin_user_nick}: selenium"); -my $flag2_id = $sel->get_attribute('//select[@title="Available in TestProduct and Another Product/c1"]@id'); +my $flag2_id = $sel->get_attribute( + '//select[@title="Available in TestProduct and Another Product/c1"]@id'); $flag2_id =~ s/flag-//; $sel->selected_label_is("flag-$flag2_id", '?'); @@ -243,22 +257,22 @@ $sel->title_is("Administer Flag Types"); $sel->click_ok("link=Create Flag Type for Bugs"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); -$sel->type_ok("name", "selenium"); +$sel->type_ok("name", "selenium"); $sel->type_ok("description", "Another flag with the selenium name"); $sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__"); $sel->click_ok("categoryAction-removeInclusion"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); -$sel->select_ok("product", "label=Another Product"); +$sel->select_ok("product", "label=Another Product"); $sel->select_ok("component", "label=c2"); $sel->click_ok("categoryAction-include"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Create Flag Type for Bugs"); $sel->type_ok("sortkey", 50); -$sel->value_is("is_active", "on"); -$sel->value_is("is_requestable", "on"); +$sel->value_is("is_active", "on"); +$sel->value_is("is_requestable", "on"); $sel->value_is("is_multiplicable", "on"); -$sel->selected_label_is("grant_group", "(no group)"); +$sel->selected_label_is("grant_group", "(no group)"); $sel->selected_label_is("request_group", "(no group)"); $sel->click_ok("save"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -284,7 +298,8 @@ $sel->click_ok("link=bug $bug2_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug2_id /); $sel->selected_label_is("flag-$flag2_id", '?'); -ok(!$sel->is_element_present("flag_type-$flagtype1_id"), "Flag type not available in c2"); +ok(!$sel->is_element_present("flag_type-$flagtype1_id"), + "Flag type not available in c2"); $sel->is_element_present_ok("flag_type-$flagtype2_id"); logout($sel); @@ -305,7 +320,8 @@ $sel->selected_label_is("flag-$flag2_id", "+"); # as the flag setter is not in the editbugs group. $sel->select_ok("product", "label=TestProduct"); -$sel->type_ok("comment", "selenium flag will be lost. I don't have editbugs privs."); +$sel->type_ok("comment", + "selenium flag will be lost. I don't have editbugs privs."); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Verify New Product Details..."); @@ -316,8 +332,12 @@ $sel->click_ok("link=bug $bug2_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug2_id /); ok(!$sel->is_element_present("flag-$flag2_id"), "Flag $flag2_id deleted"); -ok(!$sel->is_editable("flag_type-$flagtype1_id"), "Flag type 'selenium' not editable by powerless users"); -ok(!$sel->is_element_present("flag_type-$flagtype2_id"), "Flag type not available in c1"); +ok( + !$sel->is_editable("flag_type-$flagtype1_id"), + "Flag type 'selenium' not editable by powerless users" +); +ok(!$sel->is_element_present("flag_type-$flagtype2_id"), + "Flag type not available in c1"); logout($sel); # Time to delete created flag types. @@ -328,18 +348,24 @@ $sel->click_ok("link=Flags"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Administer Flag Types"); -foreach my $flagtype ([$flagtype1_id, "selenium"], [$flagtype2_id, "selenium"], - [$aflagtype1_id, "selenium_review"], [$aflagtype2_id, "selenium_review"]) +foreach my $flagtype ( + [$flagtype1_id, "selenium"], + [$flagtype2_id, "selenium"], + [$aflagtype1_id, "selenium_review"], + [$aflagtype2_id, "selenium_review"] + ) { - my $flag_id = $flagtype->[0]; - my $flag_name = $flagtype->[1]; - $sel->click_ok("//a[\@href='editflagtypes.cgi?action=confirmdelete&id=$flag_id']"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Confirm Deletion of Flag Type '$flag_name'"); - $sel->click_ok("link=Yes, delete"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Flag Type '$flag_name' Deleted"); - my $msg = trim($sel->get_text("message")); - ok($msg eq "The flag type $flag_name has been deleted.", "Flag type $flag_name deleted"); + my $flag_id = $flagtype->[0]; + my $flag_name = $flagtype->[1]; + $sel->click_ok( + "//a[\@href='editflagtypes.cgi?action=confirmdelete&id=$flag_id']"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Confirm Deletion of Flag Type '$flag_name'"); + $sel->click_ok("link=Yes, delete"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Flag Type '$flag_name' Deleted"); + my $msg = trim($sel->get_text("message")); + ok($msg eq "The flag type $flag_name has been deleted.", + "Flag type $flag_name deleted"); } logout($sel); |