/qa/t/test_shutdown.t

https://code.google.com/p/bugzilla4intranet/ · Raku · 68 lines · 64 code · 4 blank · 0 comment · 1 complexity · d8beb22adaa3d33a58305b19c77c8bb7 MD5 · raw file

  1. use strict;
  2. use warnings;
  3. use lib qw(lib);
  4. use Test::More "no_plan";
  5. use QA::Util;
  6. my ($sel, $config) = get_selenium();
  7. log_in($sel, $config, 'admin');
  8. set_parameters($sel, { "General" => {shutdownhtml => {type => "text",
  9. value => "I'm down (set by test_shutdown.t)" }
  10. } });
  11. # None of the following pages should be accessible when Bugzilla is down.
  12. my @pages = qw(admin attachment buglist chart colchange config createaccount
  13. describecomponents describekeywords duplicates
  14. editclassifications editcomponents editfields editflagtypes
  15. editgroups editkeywords editmilestones editproducts editsettings
  16. editusers editvalues editversions editwhines editworkflow
  17. enter_bug index long_list page post_bug process_bug query quips
  18. relogin report reports request sanitycheck search_plugin
  19. show_activity show_bug showattachment showdependencygraph
  20. showdependencytree sidebar summarize_time token userprefs votes
  21. xml xmlrpc);
  22. foreach my $page (@pages) {
  23. $sel->open_ok("/$config->{bugzilla_installation}/${page}.cgi");
  24. $sel->title_is("Bugzilla is Down");
  25. }
  26. # Those have parameters passed to the page, so we put them here separately.
  27. @pages = ("query.cgi?format=report-table", "query.cgi?format=report-graph",
  28. "votes.cgi?action=show_user", "votes.cgi?action=show_bug");
  29. foreach my $page (@pages) {
  30. $sel->open_ok("/$config->{bugzilla_installation}/$page");
  31. $sel->title_is("Bugzilla is Down");
  32. }
  33. # Clear 'shutdownhtml', to re-enable Bugzilla.
  34. # At this point, the admin has been logged out. We cannot use log_in(),
  35. # nor set_parameters(), due to shutdownhtml being active.
  36. $sel->open_ok("/$config->{bugzilla_installation}/editparams.cgi");
  37. $sel->title_is("Log in to Bugzilla");
  38. $sel->type_ok("Bugzilla_login", $config->{admin_user_login}, "Enter admin login name");
  39. $sel->type_ok("Bugzilla_password", $config->{admin_user_passwd}, "Enter admin password");
  40. $sel->click_ok("log_in");
  41. $sel->wait_for_page_to_load_ok(WAIT_TIME);
  42. $sel->title_is("Configuration: Required Settings");
  43. $sel->click_ok("link=General");
  44. $sel->wait_for_page_to_load_ok(WAIT_TIME);
  45. $sel->title_is("Configuration: General");
  46. $sel->type_ok("shutdownhtml", "");
  47. $sel->click_ok('//input[@type="submit" and @value="Save Changes"]', undef, "Save Changes");
  48. $sel->wait_for_page_to_load_ok(WAIT_TIME);
  49. $sel->title_is("Parameters Updated");
  50. # Accessing index.cgi should work again now.
  51. $sel->click_ok("link=Home");
  52. $sel->wait_for_page_to_load_ok(WAIT_TIME);
  53. $sel->title_is("Bugzilla Main Page");
  54. logout($sel);