diff options
Diffstat (limited to 'qa/t/test_qa_contact.t')
-rw-r--r-- | qa/t/test_qa_contact.t | 81 |
1 files changed, 57 insertions, 24 deletions
diff --git a/qa/t/test_qa_contact.t b/qa/t/test_qa_contact.t index 3795e2edc..65ff14e3b 100644 --- a/qa/t/test_qa_contact.t +++ b/qa/t/test_qa_contact.t @@ -18,28 +18,38 @@ my ($sel, $config) = get_selenium(); # First make sure the 'My QA query' saved search is gone. log_in($sel, $config, 'admin'); -if($sel->is_text_present("My QA query")) { - $sel->open_ok("/$config->{bugzilla_installation}/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20QA%20query", - undef, "Make sure the 'My QA query' saved search isn't present"); - # We bypass the UI to delete the saved search, and so Bugzilla should complain about the missing token. - $sel->title_is("Suspicious Action"); - $sel->is_text_present_ok("It looks like you didn't come from the right page"); - $sel->click_ok("confirm"); - $sel->wait_for_page_to_load_ok(WAIT_TIME); - $sel->title_is("Search is gone"); - my $text = trim($sel->get_text("message")); - ok($text =~ /OK, the My QA query search is gone/, "Removed the 'My QA query' saved search"); +if ($sel->is_text_present("My QA query")) { + $sel->open_ok( + "/$config->{bugzilla_installation}/buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=My%20QA%20query", + undef, "Make sure the 'My QA query' saved search isn't present" + ); + +# We bypass the UI to delete the saved search, and so Bugzilla should complain about the missing token. + $sel->title_is("Suspicious Action"); + $sel->is_text_present_ok("It looks like you didn't come from the right page"); + $sel->click_ok("confirm"); + $sel->wait_for_page_to_load_ok(WAIT_TIME); + $sel->title_is("Search is gone"); + my $text = trim($sel->get_text("message")); + ok( + $text =~ /OK, the My QA query search is gone/, + "Removed the 'My QA query' saved search" + ); } # Enable the QA contact field and file a new bug restricted to the 'Master' group # with a powerless user as the QA contact. He should only be able to access the # bug if the QA contact field is enabled, else he looses this privilege. -set_parameters($sel, { "Bug Fields" => {"useqacontact-on" => undef} }); +set_parameters($sel, {"Bug Fields" => {"useqacontact-on" => undef}}); file_bug_in_product($sel, 'TestProduct'); -$sel->type_ok("qa_contact", $config->{unprivileged_user_login}, "Set the powerless user as QA contact"); +$sel->type_ok( + "qa_contact", + $config->{unprivileged_user_login}, + "Set the powerless user as QA contact" +); $sel->type_ok("short_desc", "Test for QA contact"); -$sel->type_ok("comment", "This is a test to check QA contact privs."); +$sel->type_ok("comment", "This is a test to check QA contact privs."); $sel->check_ok('//input[@name="groups" and @value="Master"]'); $sel->click_ok("commit"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -55,7 +65,11 @@ $sel->add_selection_ok("product", "TestProduct"); $sel->remove_all_selections("bug_status"); $sel->select_ok("f1", "label=QA Contact"); $sel->select_ok("o1", "label=is equal to"); -$sel->type_ok("v1", $config->{unprivileged_user_login}, "Look for the powerless user as QA contact"); +$sel->type_ok( + "v1", + $config->{unprivileged_user_login}, + "Look for the powerless user as QA contact" +); $sel->click_ok("Search"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List"); @@ -66,7 +80,8 @@ $sel->click_ok("remember"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search created"); my $text = trim($sel->get_text("message")); -ok($text =~ /OK, you have a new search named My QA query/, "New saved search 'My QA query'"); +ok($text =~ /OK, you have a new search named My QA query/, + "New saved search 'My QA query'"); $sel->click_ok("link=My QA query"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: My QA query"); @@ -77,7 +92,7 @@ $sel->is_text_present_ok("Test for QA contact"); # ("work" doesn't mean you should still see all bugs, depending on your role # and privs!) -set_parameters($sel, { "Bug Fields" => {"useqacontact-off" => undef} }); +set_parameters($sel, {"Bug Fields" => {"useqacontact-off" => undef}}); $sel->click_ok("link=My QA query"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: My QA query"); @@ -86,6 +101,7 @@ $sel->is_element_present_ok("b$bug1_id", undef, "Bug $bug1_id is on the list"); $sel->click_ok("link=$bug1_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/^$bug1_id /); + # The 'QA Contact' label must not be displayed. ok(!$sel->is_element_present('//label[@for="qa_contact"]')); logout($sel); @@ -103,12 +119,21 @@ $sel->is_text_present_ok("You are not authorized to access bug"); # powerless user, as the QA contact field is disabled. # Don't use it log_in() as we want to follow this specific link. -$sel->click_ok("//a[contains(text(),'log\n in to an account')]", undef, "Log in"); +$sel->click_ok("//a[contains(text(),'log\n in to an account')]", + undef, "Log in"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Log in to Bugzilla"); $sel->is_text_present_ok("I need an email address and password to continue."); -$sel->type_ok("Bugzilla_login", $config->{unprivileged_user_login}, "Enter login name"); -$sel->type_ok("Bugzilla_password", $config->{unprivileged_user_passwd}, "Enter password"); +$sel->type_ok( + "Bugzilla_login", + $config->{unprivileged_user_login}, + "Enter login name" +); +$sel->type_ok( + "Bugzilla_password", + $config->{unprivileged_user_passwd}, + "Enter password" +); $sel->click_ok("log_in", undef, "Submit credentials"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Access Denied"); @@ -118,7 +143,7 @@ logout($sel); # Re-enable the QA contact field. log_in($sel, $config, 'admin'); -set_parameters($sel, { "Bug Fields" => {"useqacontact-on" => undef} }); +set_parameters($sel, {"Bug Fields" => {"useqacontact-on" => undef}}); logout($sel); # Log in as the powerless user. As the QA contact field is enabled again, @@ -132,7 +157,7 @@ $sel->title_is("User Preferences"); $sel->click_ok("link=General Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); -$sel->select_ok("state_addselfcc", "value=never"); +$sel->select_ok("state_addselfcc", "value=never"); $sel->select_ok("post_bug_submit_action", "value=same_bug"); $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -144,7 +169,11 @@ $sel->add_selection_ok("product", "TestProduct"); $sel->remove_all_selections_ok("bug_status"); $sel->select_ok("f1", "label=QA Contact"); $sel->select_ok("o1", "label=is equal to"); -$sel->type_ok("v1", $config->{unprivileged_user_login}, "Look for the powerless user as QA contact"); +$sel->type_ok( + "v1", + $config->{unprivileged_user_login}, + "Look for the powerless user as QA contact" +); $sel->click_ok("Search"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List"); @@ -155,7 +184,11 @@ $sel->click_ok("link=$bug1_id"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_like(qr/$bug1_id /); $sel->click_ok("bz_qa_contact_edit_action"); -$sel->value_is("qa_contact", $config->{unprivileged_user_login}, "The powerless user is the current QA contact"); +$sel->value_is( + "qa_contact", + $config->{unprivileged_user_login}, + "The powerless user is the current QA contact" +); $sel->check_ok("set_default_qa_contact"); $sel->click_ok("commit"); |