diff options
Diffstat (limited to 'qa/t/test_shared_searches.t')
-rw-r--r-- | qa/t/test_shared_searches.t | 81 |
1 files changed, 62 insertions, 19 deletions
diff --git a/qa/t/test_shared_searches.t b/qa/t/test_shared_searches.t index a4b2ac9ce..20b774432 100644 --- a/qa/t/test_shared_searches.t +++ b/qa/t/test_shared_searches.t @@ -18,7 +18,13 @@ my ($sel, $config) = get_selenium(); # Set the querysharegroup param to be the canconfirm group. log_in($sel, $config, 'admin'); -set_parameters($sel, { "Group Security" => {"querysharegroup" => {type => "select", value => "canconfirm"}} }); +set_parameters( + $sel, + { + "Group Security" => + {"querysharegroup" => {type => "select", value => "canconfirm"}} + } +); # Create new saved search and call it 'Shared Selenium buglist'. @@ -31,7 +37,10 @@ $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 Shared Selenium buglist./, "New search named 'Shared Selenium buglist' has been created"); +ok( + $text =~ /OK, you have a new search named Shared Selenium buglist./, + "New search named 'Shared Selenium buglist' has been created" +); # Retrieve the newly created saved search's internal ID and make sure it's displayed # in the Search Bar by default. @@ -42,7 +51,8 @@ $sel->title_is("User Preferences"); $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); -my $ssname = $sel->get_attribute('//input[@type="checkbox" and @alt="Shared Selenium buglist"]@name'); +my $ssname = $sel->get_attribute( + '//input[@type="checkbox" and @alt="Shared Selenium buglist"]@name'); $ssname =~ /(?:link_in_footer_(\d+))/; my $saved_search1_id = $1; $sel->is_checked_ok("link_in_footer_$saved_search1_id"); @@ -50,7 +60,8 @@ $sel->is_checked_ok("link_in_footer_$saved_search1_id"); # As an admin, the "Add to Search Bar" checkbox must be displayed, but unchecked by default. $sel->select_ok("share_$saved_search1_id", "label=canconfirm"); -ok(!$sel->is_checked("force_$saved_search1_id"), "Shared search not displayed in other users' Search Bar by default"); +ok(!$sel->is_checked("force_$saved_search1_id"), + "Shared search not displayed in other users' Search Bar by default"); $sel->click_ok("force_$saved_search1_id"); $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -66,8 +77,10 @@ $sel->is_text_present_ok("Shared Selenium buglist"); $sel->click_ok("link=Shared Selenium buglist"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Bug List: Shared Selenium buglist"); + # You cannot delete other users' saved searches. -ok(!$sel->is_text_present("Forget Search 'Shared Selenium buglist'"), "'Forget...' link not available"); +ok(!$sel->is_text_present("Forget Search 'Shared Selenium buglist'"), + "'Forget...' link not available"); # The name of the sharer must appear in the "Saved Searches" section. @@ -86,12 +99,16 @@ $sel->click_ok("link_in_footer_$saved_search1_id"); $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); + # Go to a page where the query name is unlikely to appear in the main page. $sel->click_ok("link=Permissions"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("Shared Selenium buglist"), "Shared query no longer displayed in the Search Bar"); +ok( + !$sel->is_text_present("Shared Selenium buglist"), + "Shared query no longer displayed in the Search Bar" +); # Create your own saved search, and share it with the canconfirm group. @@ -104,7 +121,10 @@ $sel->click_ok("remember"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search created"); $text = trim($sel->get_text("message")); -ok($text =~ /OK, you have a new search named helpwanted./, "New search named helpwanted has been created"); +ok( + $text =~ /OK, you have a new search named helpwanted./, + "New search named helpwanted has been created" +); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -112,9 +132,11 @@ $sel->title_is("User Preferences"); $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); -$ssname = $sel->get_attribute('//input[@type="checkbox" and @alt="helpwanted"]@name'); +$ssname + = $sel->get_attribute('//input[@type="checkbox" and @alt="helpwanted"]@name'); $ssname =~ /(?:link_in_footer_(\d+))/; my $saved_search2_id = $1; + # Our own saved searches are displayed in the Search Bar by default. $sel->is_checked_ok("link_in_footer_$saved_search2_id"); $sel->select_ok("share_$saved_search2_id", "label=canconfirm"); @@ -129,7 +151,10 @@ logout($sel); log_in($sel, $config, 'admin'); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("helpwanted"), "No 'helpwanted' shared search displayed"); +ok( + !$sel->is_text_present("helpwanted"), + "No 'helpwanted' shared search displayed" +); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -140,11 +165,15 @@ $sel->click_ok("quicksearch_top"); $sel->is_text_present_ok("helpwanted"); $sel->is_text_present_ok($config->{canconfirm_user_login}); -ok(!$sel->is_checked("link_in_footer_$saved_search2_id"), "Shared query available but not displayed"); +ok( + !$sel->is_checked("link_in_footer_$saved_search2_id"), + "Shared query available but not displayed" +); $sel->click_ok("link_in_footer_$saved_search2_id"); $sel->click_ok("update"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); + # This query is now available from the Search Bar. $sel->click_ok("link=helpwanted"); $sel->wait_for_page_to_load_ok(WAIT_TIME); @@ -158,13 +187,19 @@ $sel->title_is("User Preferences"); $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); + # There is no better way to identify the link -$sel->click_ok('//a[contains(@href,"buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=Shared%20Selenium%20buglist")]', - undef, "Deleting the 'Shared Selenium buglist' search"); +$sel->click_ok( + '//a[contains(@href,"buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=Shared%20Selenium%20buglist")]', + undef, "Deleting the 'Shared Selenium buglist' search" +); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $text = trim($sel->get_text("message")); -ok($text =~ /OK, the Shared Selenium buglist search is gone./, "The 'Shared Selenium buglist' search is gone"); +ok( + $text =~ /OK, the Shared Selenium buglist search is gone./, + "The 'Shared Selenium buglist' search is gone" +); logout($sel); # Make sure that the 'helpwanted' query is not shared with the QA_Selenium_TEST @@ -172,7 +207,8 @@ logout($sel); log_in($sel, $config, 'QA_Selenium_TEST'); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("helpwanted"), "The 'helpwanted' query is not displayed in the Search Bar"); +ok(!$sel->is_text_present("helpwanted"), + "The 'helpwanted' query is not displayed in the Search Bar"); $sel->click_ok("link=Preferences"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); @@ -180,7 +216,8 @@ $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("helpwanted"), "The 'helpwanted' query is not shared with this user"); +ok(!$sel->is_text_present("helpwanted"), + "The 'helpwanted' query is not shared with this user"); logout($sel); # Now remove the 'helpwanted' saved search. @@ -193,11 +230,17 @@ $sel->click_ok("link=Saved Searches"); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("User Preferences"); $sel->click_ok("quicksearch_top"); -ok(!$sel->is_text_present("Shared Selenium buglist"), "The 'Shared Selenium buglist' is no longer available"); -$sel->click_ok('//a[contains(@href,"buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=helpwanted")]', - undef, "Deleting the 'helpwanted' search"); +ok( + !$sel->is_text_present("Shared Selenium buglist"), + "The 'Shared Selenium buglist' is no longer available" +); +$sel->click_ok( + '//a[contains(@href,"buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=helpwanted")]', + undef, "Deleting the 'helpwanted' search" +); $sel->wait_for_page_to_load_ok(WAIT_TIME); $sel->title_is("Search is gone"); $text = trim($sel->get_text("message")); -ok($text =~ /OK, the helpwanted search is gone./, "The 'helpwanted' search is gone"); +ok($text =~ /OK, the helpwanted search is gone./, + "The 'helpwanted' search is gone"); logout($sel); |