summaryrefslogtreecommitdiffstats
path: root/xt/selenium/user_privs.t
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-02-26 18:57:55 +0100
committerDavid Lawrence <dkl@mozilla.com>2016-02-26 18:57:55 +0100
commit9b6ec1f545da1cc4088ddf9cc117747954e58e65 (patch)
tree6cc3eb342a740b795052e587756f6c33438b772a /xt/selenium/user_privs.t
parent6f70920f2d2bb038a371e3cb3debff44f7001fa8 (diff)
downloadbugzilla-9b6ec1f545da1cc4088ddf9cc117747954e58e65.tar.gz
bugzilla-9b6ec1f545da1cc4088ddf9cc117747954e58e65.tar.xz
Bug 1069799 - move the QA repository into the main repository
r=LpSolit
Diffstat (limited to 'xt/selenium/user_privs.t')
-rw-r--r--xt/selenium/user_privs.t60
1 files changed, 60 insertions, 0 deletions
diff --git a/xt/selenium/user_privs.t b/xt/selenium/user_privs.t
new file mode 100644
index 000000000..f48792839
--- /dev/null
+++ b/xt/selenium/user_privs.t
@@ -0,0 +1,60 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+
+use Test::More "no_plan";
+
+use QA::Util;
+
+my ($sel, $config) = get_selenium();
+
+# Create a new bug. As the reporter, some forms are editable to you.
+# But as you don't have editbugs privs, you cannot edit everything.
+
+log_in($sel, $config, 'unprivileged');
+file_bug_in_product($sel, 'TestProduct');
+ok(!$sel->is_editable("assigned_to"), "The assignee field is not editable");
+my $bug_summary = "Greetings from a powerless user";
+$sel->type_ok("short_desc", $bug_summary);
+$sel->type_ok("comment", "File a bug with an empty CC list");
+my $bug1_id = create_bug($sel, $bug_summary);
+logout($sel);
+
+# Some checks while being logged out.
+
+go_to_bug($sel, $bug1_id);
+ok(!$sel->is_element_present("commit"), "Button 'Commit' not available");
+my $text = trim($sel->get_text("//fieldset"));
+ok($text =~ /You need to log in before you can comment on or make changes to this bug./,
+ "Addl. comment box not displayed");
+
+# Don't call log_in() here. We explicitly want to use the "log in" link
+# in the addl. comment box.
+
+$sel->click_ok("link=log in");
+$sel->wait_for_page_to_load_ok(WAIT_TIME);
+$sel->title_is("Log in to Bugzilla");
+$sel->is_text_present_ok("Bugzilla needs a legitimate login 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->click_ok("log_in", undef, "Submit credentials");
+$sel->wait_for_page_to_load_ok(WAIT_TIME);
+$sel->title_like(qr/^$bug1_id/, "Display bug $bug1_id");
+
+# Neither the (edit) link nor the hidden form must exist, at all.
+# But the 'Commit' button does exist.
+
+ok(!$sel->is_element_present("bz_assignee_edit_action"), "No (edit) link displayed for the assignee");
+ok(!$sel->is_element_present("assigned_to"), "No hidden assignee field available");
+$sel->is_element_present_ok("commit");
+logout($sel);