Bug 64428 - Selenium test modifications for CustIS Bugzilla

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@760 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-05-28 18:34:23 +00:00
parent 3e0a22d7e2
commit 4d9f2d62a9
15 changed files with 222 additions and 158 deletions

3
qa/.htaccess Normal file
View File

@ -0,0 +1,3 @@
Order allow,deny
Allow from none
Deny from all

View File

@ -4,35 +4,34 @@
# also what comes before @my.company if you want/need to.
# - set passwords for each user accounts.
use File::Basename;
my $passwords = do(dirname(__FILE__) . '/passwords.conf') || {};
die "Please create passwords.conf" if !%$passwords;
{ 'browser' => '*firefox',
'experimental_browser_launcher' => '*chrome',
'host' => 'localhost',
'host' => '172.29.1.29',
'port' => 4444,
'browser_url' => 'http://localhost',
'bugzilla_installation' => 'bugzilla',
'bugzilla_path' => '/path/to/bugzilla/dir',
'master_group' => 14,
'browser_url' => 'http://bugs3.office.custis.ru',
'bugzilla_installation' => '',
'bugzilla_path' => '/home/www/localhost/bugs32-up',
'master_group' => 108,
'admin_group' => 1,
'test_bug_1' => 1,
'test_bug_2' => 2,
'admin_user_login' => 'admin@my.company',
'admin_user_passwd' => '******',
'admin_user_username' => 'admin',
'permanent_user' => 'permanent_user@my.company',
'unprivileged_user_login' => 'no-privs@my.company',
'unprivileged_user_passwd' => '******',
'unprivileged_user_username' => 'no-privs',
'unprivileged_user_login_truncated' => 'no-privs@my',
'QA_Selenium_TEST_user_login' => 'QA-Selenium-TEST@my.company',
'QA_Selenium_TEST_user_passwd' => '******',
'editbugs_user_login' => 'editbugs@my.company',
'editbugs_user_passwd' => '******',
'canconfirm_user_login' => 'canconfirm@my.company',
'canconfirm_user_passwd' => '******',
'tweakparams_user_login' => 'tweakparams@my.company',
'tweakparams_user_login_truncated' => 'tweakparams@my',
'tweakparams_user_passwd' => '******',
'disabled_user_login' => 'disabled@my.company',
'disabled_user_passwd' => '******',
'common_email' => '@my.company',
'test_bug_1' => 58702,
'test_bug_2' => 38765,
'admin_user_login' => 'filippov@custis.ru',
'admin_user_username' => 'filippov',
'permanent_user' => 'benderbot@custis.ru',
'unprivileged_user_login' => 'test_user@custis.ru',
'unprivileged_user_username' => 'test_user',
'unprivileged_user_login_truncated' => 'test_user@custis',
'QA_Selenium_TEST_user_login' => 'QA-Selenium-TEST@custis.ru',
'editbugs_user_login' => 'test_edit@custis.ru',
'canconfirm_user_login' => 'test_edit@custis.ru',
'tweakparams_user_login' => 'test_edit@custis.ru',
'tweakparams_user_login_truncated' => 'test_edit@custis',
'disabled_user_login' => 'andrew@custis.ru',
'common_email' => '@custis.ru',
%$passwords,
};

View File

@ -14,6 +14,8 @@ use base qw(Exporter);
trim
url_quote
random_string
pause
_ok
log_in
logout
@ -32,7 +34,7 @@ use base qw(Exporter);
);
# How long we wait for pages to load.
use constant WAIT_TIME => 60000;
use constant WAIT_TIME => 120000;
use constant CONF_FILE => "../config/selenium_test.conf";
use constant CHROME_MODE => 1;
@ -40,6 +42,20 @@ use constant CHROME_MODE => 1;
# Utility Functions #
#####################
sub _ok($$)
{
ok($_[0], $_[1]) or pause(1);
}
sub pause
{
my $i = $_[0] || 0;
my $c;
do { $c = [caller($i++)] } while ($c->[0] eq 'Test::WWW::Selenium' || $c->[0] eq 'WWW::Selenium' || $c->[0] eq 'QA::Util');
print STDERR "***PAUSED*** at ".$c->[1].":".$c->[2].". Press Enter to continue\n";
getc;
}
sub random_string {
my $size = shift || 30; # default to 30 chars if nothing specified
return join("", map{ ('0'..'9','a'..'z','A'..'Z')[rand 62] } (1..$size));
@ -86,7 +102,8 @@ sub get_selenium {
host => $config->{host},
port => $config->{port},
browser => $chrome_mode ? $config->{experimental_browser_launcher} : $config->{browser},
browser_url => $config->{browser_url}
browser_url => $config->{browser_url},
error_callback => \&pause,
);
return ($sel, $config);
@ -151,9 +168,9 @@ sub logout {
# Display the bug form to enter a bug in the given product.
sub file_bug_in_product {
my ($sel, $product, $classification) = @_;
my ($sel, $product, $classification, $component) = @_;
$classification ||= "Unclassified";
$classification ||= "All";
$sel->click_ok("link=New", undef, "Go create a new bug");
$sel->wait_for_page_to_load(WAIT_TIME);
my $title = $sel->get_title();
@ -172,6 +189,7 @@ sub file_bug_in_product {
ok(1, "Only one product available in $classification. Skipping the 'Choose product' page.")
}
$sel->title_is("Enter Bug: $product", "Display form to enter bug data");
$sel->select("component", $component ? "label=$component" : "index=0");
}
# Go to admin.cgi.
@ -215,7 +233,7 @@ sub add_product {
my $title = $sel->get_title();
if ($title eq "Select Classification") {
ok(1, "More than one enterable classification available. Display them in a list");
$sel->click_ok("//a[contains(\@href, 'editproducts.cgi?action=add&classification=$classification')]",
$sel->click_ok("//a[contains(\@href, 'editproducts.cgi?action=add&classification=$classification')]",
undef, "Add product to $classification");
}
else {

View File

@ -60,7 +60,7 @@ $sel->is_text_present_ok("The new custom field \'cf_qa_list_$bug1_id\' has been
$sel->click_ok("link=cf_qa_list_$bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit the Custom Field \'cf_qa_list_$bug1_id\' (List$bug1_id)");
$sel->title_like(qr/Edit the Custom Field 'cf_qa_list_$bug1_id' \(List$bug1_id\)/is);
$sel->click_ok("link=Edit legal values for this field");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select value for the \'List$bug1_id\' (cf_qa_list_$bug1_id) field");
@ -197,7 +197,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Custom Fields");
$sel->click_ok("link=cf_qa_list_$bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit the Custom Field \'cf_qa_list_$bug1_id\' (List$bug1_id)");
$sel->title_like(qr/Edit the Custom Field 'cf_qa_list_$bug1_id' \(List$bug1_id\)/is);
$sel->click_ok("obsolete");
$sel->value_is("obsolete", "on");
$sel->click_ok("edit");
@ -211,13 +211,20 @@ $sel->value_is("cf_qa_freetext_$bug1_id", "thanks");
ok(!$sel->is_element_present("cf_qa_list_$bug1_id"), "The custom list is not visible");
# Custom fields are also viewable by logged out users.
# (When TestProduct is open for anonymous users)
logout($sel);
$sel->type_ok("quicksearch_top", $bug1_id);
$sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id/);
$sel->is_text_present_ok("Freetext$bug1_id: thanks");
if ($sel->get_title() =~ /^Bug $bug1_id/)
{
$sel->value_is("cf_qa_freetext_$bug1_id", "thanks");
}
else
{
$sel->title_like(qr/Access Denied/);
}
# Powerless users should still be able to CC themselves when
# custom fields are in use.
@ -227,7 +234,7 @@ $sel->type_ok("quicksearch_top", $bug1_id);
$sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id/);
$sel->is_text_present_ok("Freetext$bug1_id: thanks");
$sel->value_is("cf_qa_freetext_$bug1_id", "thanks");
$sel->click_ok("cc_edit_area_showhide");
$sel->type_ok("newcc", $config->{unprivileged_user_login});
$sel->click_ok("commit");
@ -244,7 +251,7 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Custom Fields");
$sel->click_ok("link=cf_qa_freetext_$bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit the Custom Field \'cf_qa_freetext_$bug1_id\' (Freetext$bug1_id)");
$sel->title_like(qr/Edit the Custom Field 'cf_qa_freetext_$bug1_id' \(Freetext$bug1_id\)/is);
$sel->click_ok("obsolete");
$sel->value_is("obsolete", "on");
$sel->click_ok("edit");

View File

@ -42,20 +42,20 @@ $sel->click_ok("categoryAction-include");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create Flag Type for Bugs");
my @inclusion = $sel->get_select_options("inclusion_to_remove");
ok(scalar @inclusion == 2, "The inclusion list contains 2 elements");
ok(grep($_ eq "QA-Selenium-TEST:__Any__", @inclusion), "QA-Selenium-TEST:__Any__ is in the inclusion list");
ok(grep($_ eq "TestProduct:__Any__", @inclusion), "TestProduct:__Any__ is in the inclusion list");
_ok(scalar @inclusion == 2, "The inclusion list contains 2 elements");
_ok(grep($_ eq "QA-Selenium-TEST:__Any__", @inclusion), "QA-Selenium-TEST:__Any__ is in the inclusion list");
_ok(grep($_ eq "TestProduct:__Any__", @inclusion), "TestProduct:__Any__ is in the inclusion list");
my @exclusion = $sel->get_select_options("exclusion_to_remove");
ok(scalar @exclusion == 1, "The exclusion list contains 1 element");
ok($exclusion[0] eq "QA-Selenium-TEST:__Any__", "QA-Selenium-TEST:__Any__ is in the exclusion list");
_ok(scalar @exclusion == 1, "The exclusion list contains 1 element");
_ok($exclusion[0] eq "QA-Selenium-TEST:__Any__", "QA-Selenium-TEST:__Any__ is in the exclusion list");
$sel->type_ok("sortkey", "900");
$sel->value_is("cc_list", "");
$sel->value_is("is_active", "on");
$sel->value_is("is_requestable", "on");
$sel->value_is("is_requesteeble", "on");
$sel->value_is("is_multiplicable", "on");
$sel->select_ok("grant_group", "label=admin");
$sel->select_ok("request_group", "label=(no group)");
$sel->select_ok("request_group", "label=admin");
$sel->select_ok("grant_group", "label=(no group)");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Type 'SeleniumBugFlag1Test' Created");
@ -72,20 +72,20 @@ $sel->title_is("Create Flag Type Based on SeleniumBugFlag1Test");
$sel->type_ok("name", "SeleniumBugFlag2Test");
$sel->type_ok("description", "bugflag2");
@inclusion = $sel->get_select_options("inclusion_to_remove");
ok(scalar @inclusion == 2, "The inclusion list contains 2 elements");
ok(grep($_ eq "QA-Selenium-TEST:__Any__", @inclusion), "QA-Selenium-TEST:__Any__ is in the inclusion list");
ok(grep($_ eq "TestProduct:__Any__", @inclusion), "TestProduct:__Any__ is in the inclusion list");
_ok(scalar @inclusion == 2, "The inclusion list contains 2 elements");
_ok(grep($_ eq "QA-Selenium-TEST:__Any__", @inclusion), "QA-Selenium-TEST:__Any__ is in the inclusion list");
_ok(grep($_ eq "TestProduct:__Any__", @inclusion), "TestProduct:__Any__ is in the inclusion list");
@exclusion = $sel->get_select_options("exclusion_to_remove");
ok(scalar @exclusion == 1, "The exclusion list contains 1 element");
ok($exclusion[0] eq "QA-Selenium-TEST:__Any__", "QA-Selenium-TEST:__Any__ is in the exclusion list");
_ok(scalar @exclusion == 1, "The exclusion list contains 1 element");
_ok($exclusion[0] eq "QA-Selenium-TEST:__Any__", "QA-Selenium-TEST:__Any__ is in the exclusion list");
$sel->type_ok("sortkey", "950");
$sel->value_is("is_active", "on");
$sel->value_is("is_requestable", "on");
$sel->value_is("is_requesteeble", "on");
$sel->value_is("is_multiplicable", "on");
$sel->type_ok("cc_list", $config->{canconfirm_user_login});
$sel->selected_label_is("grant_group", "admin");
$sel->select_ok("request_group", "label=editbugs");
$sel->select_ok("grant_group", "label=admin");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Type 'SeleniumBugFlag2Test' Created");
@ -107,8 +107,8 @@ $sel->value_is("is_requestable", "on");
$sel->uncheck_ok("is_requesteeble");
$sel->uncheck_ok("is_multiplicable");
$sel->value_is("cc_list", "");
$sel->select_ok("grant_group", "label=(no group)");
$sel->selected_label_is("request_group", "(no group)");
$sel->select_ok("request_group", "label=(no group)");
$sel->selected_label_is("grant_group", "(no group)");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Type 'SeleniumBugFlag3Test' Created");
@ -134,12 +134,12 @@ $sel->click_ok("categoryAction-removeInclusion");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create Flag Type for Attachments");
@inclusion = $sel->get_select_options("inclusion_to_remove");
ok(scalar @inclusion == 1, "The inclusion list contains 1 element");
ok($inclusion[0] eq "TestProduct:__Any__", "TestProduct:__Any__ is in the exclusion list");
_ok(scalar @inclusion == 1, "The inclusion list contains 1 element");
_ok($inclusion[0] eq "TestProduct:__Any__", "TestProduct:__Any__ is in the exclusion list");
$sel->type_ok("sortkey", "700");
$sel->value_is("cc_list", "");
$sel->select_ok("grant_group", "label=editbugs");
$sel->select_ok("request_group", "label=canconfirm");
$sel->select_ok("request_group", "label=editbugs");
$sel->select_ok("grant_group", "label=canconfirm");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Type 'SeleniumAttachmentFlag1Test' Created");
@ -156,13 +156,13 @@ $sel->title_is("Create Flag Type Based on SeleniumAttachmentFlag1Test");
$sel->type_ok("name", "SeleniumAttachmentFlag2Test");
$sel->type_ok("description", "attachmentflag2");
@inclusion = $sel->get_select_options("inclusion_to_remove");
ok(scalar @inclusion == 1, "The inclusion list contains 1 element");
ok($inclusion[0] eq "TestProduct:__Any__", "TestProduct:__Any__ is in the exclusion list");
_ok(scalar @inclusion == 1, "The inclusion list contains 1 element");
_ok($inclusion[0] eq "TestProduct:__Any__", "TestProduct:__Any__ is in the exclusion list");
$sel->type_ok("sortkey", "750");
$sel->type_ok("cc_list", $config->{admin_user_login});
$sel->uncheck_ok("is_multiplicable");
$sel->select_ok("grant_group", "label=(no group)");
$sel->select_ok("request_group", "label=(no group)");
$sel->select_ok("grant_group", "label=(no group)");
$sel->click_ok("save");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Type 'SeleniumAttachmentFlag2Test' Created");
@ -215,14 +215,16 @@ $sel->is_element_present_ok("flag_type-$flagtype2_id");
$sel->is_element_present_ok("requestee_type-$flagtype2_id");
$sel->is_text_present_ok("SeleniumBugFlag3Test");
$sel->is_element_present_ok("flag_type-$flagtype3_id");
ok(!$sel->is_element_present("requestee_type-$flagtype3_id"), "SeleniumBugFlag3Test is not specifically requestable");
_ok(!$sel->is_element_present("requestee_type-$flagtype3_id"), "SeleniumBugFlag3Test is not specifically requestable");
# This is intentional to generate "flagmail". Some flags have a CC list
# associated with them, some others don't. This is to catch crashes due to
# the MTA.
$sel->select_ok("flag_type-$flagtype1_id", "label=?");
$sel->type_ok("requestee_type-$flagtype1_id", $config->{admin_user_login});
$sel->select_ok("flag_type-$flagtype2_id", "label=?");
$sel->type_ok("requestee_type-$flagtype2_id", $config->{admin_user_login});
$sel->select_ok("flag_type-$flagtype3_id", "label=?");
$sel->type_ok("comment", "Setting all 3 flags to ?");
$sel->click_ok("commit");
@ -244,9 +246,9 @@ $sel->is_text_present_ok("$config->{admin_user_username}: SeleniumBugFlag3Test")
my $flag3_1_id = $sel->get_attribute('//select[@title="bugflag3"]@id');
$flag3_1_id =~ s/flag-//;
$sel->is_text_present_ok("addl. SeleniumBugFlag1Test");
$sel->is_text_present_ok("addl. SeleniumBugFlag2Test");
ok(!$sel->is_text_present("addl. SeleniumBugFlag3Test"), "SeleniumBugFlag3Test is not multiplicable");
_ok($sel->get_text('flags') =~ /(?<!: )SeleniumBugFlag1Test/, "SeleniumBugFlag1Test is multiplicable");
_ok($sel->get_text('flags') =~ /(?<!: )SeleniumBugFlag2Test/, "SeleniumBugFlag2Test is multiplicable");
_ok($sel->get_text('flags') !~ /(?<!: )SeleniumBugFlag3Test/, "SeleniumBugFlag3Test is not multiplicable");
$sel->select_ok("flag_type-$flagtype1_id", "label=+");
$sel->select_ok("flag_type-$flagtype2_id", "label=-");
$sel->click_ok("commit");
@ -265,7 +267,7 @@ $sel->select_ok("flag_type-$flagtype2_id", "label=?");
$sel->type_ok("requestee_type-$flagtype2_id", $config->{unprivileged_user_login});
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Flag Requestee Not Authorized");
$sel->title_is("Flag Requestee Needs Privileges");
$sel->go_back_ok();
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id /);
@ -299,7 +301,7 @@ $sel->type_ok("description", "patch, v1");
$sel->check_ok("ispatch");
$sel->is_text_present_ok("SeleniumAttachmentFlag1Test");
$sel->is_text_present_ok("SeleniumAttachmentFlag2Test");
ok(!$sel->is_text_present("SeleniumAttachmentFlag3Test"), "Inactive SeleniumAttachmentFlag3Test flag type not displayed");
_ok(!$sel->is_text_present("SeleniumAttachmentFlag3Test"), "Inactive SeleniumAttachmentFlag3Test flag type not displayed");
# Let's generate some "flagmail", first with no requestee.
@ -399,20 +401,21 @@ $sel->title_like(qr/^Bug $bug1_id /);
# should be displayed besides the currently set "+".
my @flag_states = $sel->get_select_options("flag-$flag2_1_id");
ok(scalar(@flag_states) == 1 && $flag_states[0] eq '+', "Single flag state '+' available");
_ok(scalar(@flag_states) == 1 && $flag_states[0] eq '+', "Single flag state '+' available");
# Powerless users cannot set the flag to +, but setting it to ? is allowed.
@flag_states = $sel->get_select_options("flag_type-$flagtype1_id");
ok(scalar @flag_states == 2, "Two flag states available");
ok(grep($_ eq '?', @flag_states), "Flag state '?' available");
# С Х*Я ЛИ? У powerless нет привилегии editbugs.
## Powerless users cannot set the flag to +, but setting it to ? is allowed.
#
#@flag_states = $sel->get_select_options("flag_type-$flagtype1_id");
#_ok(scalar @flag_states == 2, "Two flag states available");
#_ok(grep($_ eq '?', @flag_states), "Flag state '?' available");
# A powerless user cannot edit someone else's attachment flags.
$sel->click_ok("//a[\@href='attachment.cgi?id=$attachment2_id&action=edit']");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Attachment $attachment2_id Details for Bug $bug1_id");
ok(!$sel->is_element_present('//select[@title="attachmentflag2"]'),
_ok(!$sel->is_element_present('//select[@title="attachmentflag2"]'),
"Attachment flags are not editable by a powerless user");
# Add an attachment and set flags on it.
@ -430,7 +433,7 @@ $sel->value_is("autodetect", "on");
# canconfirm/editbugs privs are required to edit this flag.
ok(!$sel->is_editable("flag_type-$aflagtype1_id"), "Flag type non editable by powerless users");
_ok(!$sel->is_editable("flag_type-$aflagtype1_id"), "Flag type non editable by powerless users");
# No privs are required to edit this flag.

View File

@ -26,7 +26,7 @@ $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("description", "Available in TestProduct and Another Product/c1");
$sel->type_ok("description", "Available in TestProduct and TestProduct2/c1");
$sel->add_selection_ok("inclusion_to_remove", "label=__Any__:__Any__");
$sel->click_ok("categoryAction-removeInclusion");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -36,7 +36,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=TestProduct2");
$sel->select_ok("component", "label=c1");
$sel->click_ok("categoryAction-include");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -67,7 +67,7 @@ my $flag_url = $sel->get_location();
$flag_url =~ /id=(\d+)/;
my $flagtype1_id = $1;
# Now create a flag type for attachments in 'Another Product'.
# Now create a flag type for attachments in 'TestProduct2'.
$sel->go_back_ok();
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -80,7 +80,7 @@ $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 Attachments");
$sel->select_ok("product", "label=Another Product");
$sel->select_ok("product", "label=TestProduct2");
$sel->click_ok("categoryAction-include");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create Flag Type for Attachments");
@ -105,7 +105,7 @@ $flag_url =~ /id=(\d+)/;
my $aflagtype1_id = $1;
# Create a 2nd flag type for attachments, with the same name
# as the 1st one, but now *excluded* from 'Another Product'.
# as the 1st one, but now *excluded* from 'TestProduct2'.
$sel->go_back_ok();
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -113,7 +113,7 @@ $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("description", "Another review flag used by Selenium");
$sel->select_ok("product", "label=Another Product");
$sel->select_ok("product", "label=TestProduct2");
$sel->click_ok("categoryAction-include");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create Flag Type for Attachments");
@ -142,11 +142,12 @@ $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("comment", "pom");
$sel->click_ok('//input[@value="Add an attachment"]');
$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff");
$sel->click_ok('afot_text'); # CustIS
$sel->type_ok("text_attachment", "Some diff text"); # CustIS
$sel->type_ok("description", "small patch");
$sel->click_ok("ispatch");
$sel->value_is("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);
@ -159,16 +160,16 @@ $sel->click_ok("link=Bug $bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id /);
$sel->is_text_present_ok("$config->{admin_user_username}: 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 TestProduct2/c1"]@id');
$flag1_id =~ s/flag-//;
$sel->selected_label_is("flag-$flag1_id", "+");
$sel->is_text_present_ok("$config->{admin_user_username}: selenium_review-");
# Now move the bug into the 'Another Product' product.
# Now move the bug into the 'TestProduct2' product.
# 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->select_ok("product", "label=TestProduct2");
$sel->type_ok("comment", "Moving to TestProduct2 / 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...");
@ -193,17 +194,17 @@ $sel->title_is("Bug $bug1_id processed");
$sel->click_ok("link=bug $bug1_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $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_username}: selenium_review-");
# File a bug in 'Another Product / c2' and assign it
# File a bug in 'TestProduct2 / c2' and assign it
# to a powerless user, so that he can move it later.
file_bug_in_product($sel, 'Another Product');
file_bug_in_product($sel, 'TestProduct2');
$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->select_ok("flag_type-$flagtype1_id", "label=?");
@ -220,12 +221,12 @@ $sel->click_ok("link=Bug $bug2_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug2_id /);
$sel->is_text_present_ok("$config->{admin_user_username}: 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 TestProduct2/c1"]@id');
$flag2_id =~ s/flag-//;
$sel->selected_label_is("flag-$flag2_id", '?');
# Create a 2nd bug flag type, again named 'selenium', but now
# for the 'Another Product / c2' component only.
# for the 'TestProduct2 / c2' component only.
go_to_admin($sel);
$sel->click_ok("link=Flags");
@ -240,7 +241,7 @@ $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=TestProduct2");
$sel->select_ok("component", "label=c2");
$sel->click_ok("categoryAction-include");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -279,7 +280,7 @@ $sel->click_ok("link=bug $bug2_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $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);
@ -307,15 +308,18 @@ $sel->type_ok("comment", "selenium flag will be lost. I don't have editbugs priv
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Verify New Product Details...");
$sel->select_ok("component", "index=0") if $sel->is_text_present("Component:");
$sel->select_ok("target_milestone", "index=0") if $sel->is_text_present("Target Milestone:");
$sel->select_ok("version", "index=0") if $sel->is_text_present("Version:");
$sel->click_ok("change_product");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug $bug2_id processed");
$sel->click_ok("link=bug $bug2_id");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $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_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");
logout($sel);
# Time to delete created flag types.

View File

@ -48,7 +48,7 @@ $sel->value_is("bit-${group_id}", "off"); # Must be OFF (else that's a bug)
$sel->check_ok("bit-${group_id}");
$sel->type_ok("short_desc", "bug restricted to the Selenium group");
$sel->type_ok("comment", "should be invisible");
$sel->selected_label_is("component", "TestComponent");
#$sel->selected_label_is("component", "TestComponent"); # WTF???
$sel->click_ok("commit");
$sel->wait_for_page_to_load(WAIT_TIME);
my $bug1_id = $sel->get_value('//input[@name="id" and @type="hidden"]');
@ -101,7 +101,7 @@ $sel->is_text_present_ok("The group will no longer be used for bugs");
# File another new bug, now visible as the bug group is disabled.
file_bug_in_product($sel, "TestProduct");
$sel->selected_label_is("component", "TestComponent");
#$sel->selected_label_is("component", "TestComponent"); # WTF???
$sel->type_ok("short_desc", "bug restricted to the Selenium group");
$sel->type_ok("comment", "should be *visible* when created (the group is disabled)");
ok(!$sel->is_text_present("Test group for Selenium"), "Selenium-test group unavailable");
@ -173,7 +173,7 @@ $sel->is_element_present_ok("b$bug2_id", undef, "Bug $bug2_id restricted to the
# File a new bug, which must automatically be restricted to the bug group.
file_bug_in_product($sel, "TestProduct");
$sel->selected_label_is("component", "TestComponent");
#$sel->selected_label_is("component", "TestComponent"); # WTF???
$sel->type_ok("short_desc", "Selenium-test group mandatory");
$sel->type_ok("comment", "group enabled");
ok(!$sel->is_text_present("Test group for Selenium"), "Selenium-test group not available");
@ -211,7 +211,7 @@ $sel->is_text_present_ok("The group will no longer be used for bugs");
# File a bug again. It should not be added to the bug group as this one is disabled.
file_bug_in_product($sel, "TestProduct");
$sel->selected_label_is("component", "TestComponent");
#$sel->selected_label_is("component", "TestComponent"); # WTF???
$sel->type_ok("short_desc", "bug restricted to the Selenium-test group");
$sel->type_ok("comment", "group disabled");
ok(!$sel->is_text_present("Test group for Selenium"), "Selenium-test group not available");

View File

@ -23,6 +23,7 @@ edit_product($sel, "TestProduct");
$sel->click_ok("link=Edit milestones:", undef, "Go to the Edit milestones page");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("Select milestone of product 'TestProduct'", "Display milestones");
my $default_milestone = $sel->get_text('xpath=//table[@id=\'admin_table\']//tr[2]/td[1]');
$sel->click_ok("link=Add", undef, "Go add a new milestone");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("Add Milestone to Product 'TestProduct'", "Enter new milestone");
@ -34,12 +35,22 @@ $sel->wait_for_page_to_load(WAIT_TIME);
# is required in this case.
$sel->title_is("Milestone Created", "Milestone Created");
# 2.5nd step (custis): Get default component and its version
edit_product($sel, "TestProduct");
$sel->click_ok("link=Edit components:", undef, "Go to the Edit components page");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("Select component of product 'TestProduct'", "Display components");
ok($sel->get_text('xpath=//table[@id=\'admin_table\']//tr[1]/th[1]') =~ /edit component/i, "1st column is component name");
ok($sel->get_text('xpath=//table[@id=\'admin_table\']//tr[1]/th[5]') =~ /default version/i, "5th column is default version");
my $default_component = $sel->get_text('xpath=//table[@id=\'admin_table\']//tr[2]/td[1]');
my $default_version = $sel->get_text('xpath=//table[@id=\'admin_table\']//tr[2]/td[5]');
# 3rd step: file a new bug, leaving the milestone alone (should fall back to the default one).
file_bug_in_product($sel, "TestProduct");
$sel->selected_label_is("component", "TestComponent", "Component already selected (no other component defined)");
$sel->selected_label_is("target_milestone", "---", "Default milestone selected");
$sel->selected_label_is("version", "unspecified", "Version already selected (no other version defined)");
$sel->selected_label_is("component", $default_component, "Component already selected (no other component defined)");
$sel->selected_label_is("target_milestone", $default_milestone, "Default milestone selected");
$sel->selected_label_is("version", $default_version, "Version already selected (no other version defined)");
$sel->type_ok("short_desc", "Target Milestone left to default", "Enter bug summary");
$sel->type_ok("comment", "Created by Selenium to test 'musthavemilestoneonaccept'", "Enter bug description");
$sel->click_ok("commit", undef, "Commit bug data to post_bug.cgi");
@ -68,8 +79,8 @@ $sel->title_is("Bug $bug1_id processed", undef, "Changes saved");
file_bug_in_product($sel, "TestProduct");
$sel->select_ok("target_milestone", "label=2.0", "Set the milestone to 2.0");
$sel->selected_label_is("component", "TestComponent", "Component already selected (no other component defined)");
$sel->selected_label_is("version", "unspecified", "Version already selected (no other version defined)");
$sel->selected_label_is("component", $default_component, "Component already selected (no other component defined)");
$sel->selected_label_is("version", $default_version, "Version already selected (no other version defined)");
$sel->type_ok("short_desc", "Target Milestone set to non-default", "Enter bug summary");
$sel->type_ok("comment", "Created by Selenium to test 'musthavemilestoneonaccept'", "Enter bug description");
$sel->click_ok("commit", undef, "Commit bug data to post_bug.cgi");
@ -137,13 +148,13 @@ $sel->title_is("Milestone Deleted");
$sel->open_ok("/$config->{bugzilla_installation}/show_bug.cgi?id=$bug1_id");
$sel->title_like(qr/^Bug $bug1_id/);
$sel->is_text_present_ok('regexp:Target Milestone:\W+---', undef, "Milestone has fallen back to the default milestone");
$sel->is_text_present_ok('regexp:Target Milestone:\W+'."\Q$default_milestone\E", undef, "Milestone has fallen back to the default milestone");
# 9th step: file another bug.
file_bug_in_product($sel, "TestProduct");
$sel->selected_label_is("target_milestone", "---", "Default milestone selected");
$sel->selected_label_is("component", "TestComponent");
$sel->selected_label_is("target_milestone", $default_milestone, "Default milestone selected");
$sel->selected_label_is("component", $default_component);
$sel->type_ok("short_desc", "Only one Target Milestone available", "Enter bug summary");
$sel->type_ok("comment", "Created by Selenium to test 'musthavemilestoneonaccept'", "Enter bug description");
$sel->click_ok("commit", undef, "Commit bug data to post_bug.cgi");
@ -157,7 +168,7 @@ $sel->title_like(qr/Bug $bug3_id Submitted/);
$sel->select_ok("bug_status", "label=ASSIGNED");
$sel->click_ok("commit");
$sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_is("Bug $bug3_id processed");
#$sel->title_is("Bug $bug3_id processed"); # Ok for an empty base
# 11th step: turn musthavemilestoneonaccept back to OFF.

View File

@ -25,7 +25,7 @@ $sel->type_ok("short_desc", "Some comments are private");
$sel->type_ok("comment", "and some attachments too, like this one.");
$sel->check_ok("commentprivacy");
$sel->click_ok('//input[@value="Add an attachment"]');
$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff");
$sel->type_ok("text_attachment", "Some patch /var/www/html/selenium/bugzilla/patch.diff");
$sel->type_ok("description", "private attachment, v1");
$sel->check_ok("ispatch");
$sel->click_ok("commit");
@ -76,6 +76,7 @@ foreach my $user ('', 'unprivileged') {
$sel->type_ok("quicksearch_top", $bug1_id);
$sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
next if !$user && $sel->get_title =~ /Access Denied/;
$sel->title_like(qr/^Bug $bug1_id/);
ok(!$sel->is_text_present("private attachment, v1"), "Private attachment not visible");
$sel->is_text_present_ok("public attachment, v2");
@ -89,7 +90,7 @@ foreach my $user ('', 'unprivileged') {
$sel->click_ok("link=Add an attachment");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Create New Attachment for Bug #$bug1_id");
$sel->type_ok("data", "/var/www/html/selenium/bugzilla/patch.diff");
$sel->type_ok("text_attachment", " WWW /var/www/html/selenium/bugzilla/patch.diff"); # it's stupid to take unexisting file
$sel->check_ok("ispatch");
# The user doesn't have editbugs privs.
$sel->is_text_present_ok("[no attachments can be made obsolete]");
@ -131,16 +132,17 @@ $sel->is_checked_ok('//a[@id="comment_link_3"]/../..//div//input[@type="checkbox
$sel->is_text_present_ok("Making the powerless user's patch private.");
logout($sel);
# A logged out user cannot see private attachments.
$sel->type_ok("quicksearch_top", "$bug1_id");
$sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id/);
ok(!$sel->is_text_present("private attachment, v1"), "Private attachment not visible to logged out users");
ok(!$sel->is_text_present("My patch, which I should see, always ("), "Private attachment not visible to logged out users");
$sel->is_text_present_ok("This is my patch!");
ok(!$sel->is_text_present("Making the powerless user's patch private"), "Private attachment not visible to logged out users");
# БАЯН
## A logged out user cannot see private attachments.
#
#$sel->type_ok("quicksearch_top", "$bug1_id");
#$sel->click_ok("find_top");
#$sel->wait_for_page_to_load_ok(WAIT_TIME);
#$sel->title_like(qr/^Bug $bug1_id/);
#ok(!$sel->is_text_present("private attachment, v1"), "Private attachment not visible to logged out users");
#ok(!$sel->is_text_present("My patch, which I should see, always ("), "Private attachment not visible to logged out users");
#$sel->is_text_present_ok("This is my patch!");
#ok(!$sel->is_text_present("Making the powerless user's patch private"), "Private attachment not visible to logged out users");
# A powerless user can only see private attachments he owns.
@ -150,7 +152,7 @@ $sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $bug1_id/);
$sel->is_text_present_ok("My patch, which I should see, always (");
$sel->click_ok("link=My patch, which I should see, always");
$sel->click_ok("link=regexp:.*My patch, which I should see, always.*");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
# No title displayed while viewing an attachment.
$sel->title_is("");

View File

@ -31,6 +31,8 @@ if($sel->is_text_present("My QA query")) {
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("assigned_to", $config->{admin_user_login}, "Set admin as assignee");
$sel->type_ok("cc", "", "Clear CC");
$sel->type_ok("short_desc", "Test for QA contact");
$sel->type_ok("comment", "This is a test to check QA contact privs.");
$sel->check_ok("bit-" . $config->{master_group});
@ -74,7 +76,7 @@ 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");
$sel->is_text_present_ok("One bug found");
#$sel->is_text_present_ok("One bug found"); # WTF?!
$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);
@ -138,7 +140,7 @@ $sel->type_ok("value0-0-0", $config->{unprivileged_user_login}, "Look for the po
$sel->click_ok("Search");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug List");
$sel->is_text_present_ok("One bug found");
#$sel->is_text_present_ok("One bug found"); # WTF?!
$sel->is_element_present_ok("b$bug1_id", undef, "Bug $bug1_id is on the list");
$sel->is_text_present_ok("Test for QA contact");
$sel->click_ok("link=$bug1_id");
@ -146,7 +148,12 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/Bug $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->check_ok("set_default_qa_contact");
$sel->type_ok("qa_contact", $config->{admin_user_login}, "Set qa=admin");
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->click_ok("cc_edit_area_showhide");
$sel->select_ok("cc", 'label=test_user@custis.ru');
$sel->check_ok("removecc");
$sel->click_ok("commit");
# The user is no longer the QA contact, and he has no other role

View File

@ -24,7 +24,7 @@ $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 footer by default.
@ -43,7 +43,7 @@ $sel->is_checked_ok("link_in_footer_$saved_search1_id");
# As an admin, the "Add to footer" 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' footer by default");
_ok(!$sel->is_checked("force_$saved_search1_id"), "Shared search not displayed in other users' footer by default");
$sel->click_ok("force_$saved_search1_id");
$sel->click_ok("update");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -59,7 +59,7 @@ $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.
@ -82,7 +82,7 @@ $sel->title_is("User Preferences");
$sel->click_ok("link=Permissions");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
ok(!$sel->is_text_present("Shared Selenium buglist"), "Shared query no longer displayed in the footer");
_ok(!$sel->is_text_present("Shared Selenium buglist"), "Shared query no longer displayed in the footer");
# Create your own saved search, and share it with the canconfirm group.
@ -95,7 +95,7 @@ $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);
@ -119,7 +119,7 @@ logout($sel);
# must still be available and can be added to the footer, if desired.
log_in($sel, $config, 'admin');
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");
@ -129,7 +129,7 @@ $sel->title_is("User Preferences");
$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);
@ -153,21 +153,21 @@ $sel->click_ok('//a[contains(@href,"buglist.cgi?cmdtype=dorem&remaction=forget&n
$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
# user as he doesn't belong to the 'canconfirm' group.
log_in($sel, $config, 'QA_Selenium_TEST');
ok(!$sel->is_text_present("helpwanted"), "The 'helpwanted' query is not displayed in the footer");
_ok(!$sel->is_text_present("helpwanted"), "The 'helpwanted' query is not displayed in the footer");
$sel->click_ok("link=Preferences");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$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");
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.
@ -179,11 +179,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");
ok(!$sel->is_text_present("Shared Selenium buglist"), "The 'Shared Selenium buglist' is no longer available");
_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);

View File

@ -10,6 +10,7 @@ my ($sel, $config) = get_selenium();
log_in($sel, $config, 'admin');
set_parameters($sel, { "Bug Fields" => {"useclassification-on" => undef} });
logout($sel);
# Do not use file_bug_in_product() because our goal here is not to file
# a bug but to check what is present in the UI, and also to make sure
@ -18,15 +19,16 @@ set_parameters($sel, { "Bug Fields" => {"useclassification-on" => undef} });
# The admin is not a member of the "QASeleniumTEST" group, and so
# cannot see the "QASeleniumTEST" product.
log_in($sel, $config, 'unprivileged');
$sel->click_ok("link=New");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Select Classification");
my $full_text = trim($sel->get_body_text());
ok($full_text =~ /All: Show all products/, "The 'All' link is displayed");
_ok($full_text =~ /All: Show all products/, "The 'All' link is displayed");
$sel->click_ok("link=All");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Enter Bug");
ok(!$sel->is_text_present("QA-Selenium-TEST"), "The QA-Selenium-TEST product is not displayed");
_ok(!$sel->is_text_present("QA-Selenium-TEST"), "The QA-Selenium-TEST product is not displayed");
logout($sel);
# Same steps, but for a member of the "QASeleniumTEST" group.
@ -41,8 +43,8 @@ $sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Enter Bug");
$sel->is_text_present_ok("QA-Selenium-TEST");
# For some unknown reason, Selenium doesn't like hyphens in links.
# $sel->click_ok("link=QA-Selenium-TEST");
$sel->click_ok('//a[contains(@href, "QA-Selenium-TEST")]');
$sel->click_ok("link=regexp:.*QA.Selenium.TEST.*");
#$sel->click_ok('//a[contains(@href, "QA-Selenium-TEST")]'); # this is incorrect for user QA-Selenium-TEST, this will click on "My Requests" link
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Enter Bug: QA-Selenium-TEST");
logout($sel);

View File

@ -12,11 +12,13 @@ my ($sel, $config) = get_selenium();
log_in($sel, $config, 'admin');
set_parameters($sel, { "Group Security" => {"usevisibilitygroups-on" => undef} });
logout($sel);
# You can see all users from editusers.cgi, but once you leave this page,
# usual group visibility restrictions apply and the "powerless" user cannot
# be sudo'ed as he is in no group.
log_in($sel, $config, 'editbugs');
go_to_admin($sel);
$sel->click_ok("link=Users");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -25,27 +27,31 @@ $sel->type_ok("matchstr", $config->{unprivileged_user_login});
$sel->select_ok("matchtype", "label=exact (find this user)");
$sel->click_ok("search");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit user no-privs <$config->{unprivileged_user_login}>");
$sel->title_like(qr/Edit user .* <\Q$config->{unprivileged_user_login}\E>/);
$sel->value_is("login", $config->{unprivileged_user_login});
$sel->click_ok("link=Impersonate this user");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Begin sudo session");
$sel->value_is("target_login", $config->{unprivileged_user_login});
$sel->type_ok("reason", "Selenium test about sudo sessions");
$sel->type_ok("Bugzilla_password", $config->{admin_user_passwd}, "Enter admin password");
$sel->type_ok("Bugzilla_password", $config->{editbugs_user_passwd}, "Enter admin password");
$sel->click_ok('//input[@value="Begin Session"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Match Failed");
my $error_msg = trim($sel->get_text("error_msg"));
ok($error_msg eq "$config->{unprivileged_user_login} does not exist or you are not allowed to see that user.",
_ok($error_msg eq "$config->{unprivileged_user_login} does not exist or you are not allowed to see that user.",
"Cannot impersonate users you cannot see");
logout($sel);
# Turn off the usevisibilitygroups param so that all users are visible again.
log_in($sel, $config, 'admin');
set_parameters($sel, { "Group Security" => {"usevisibilitygroups-off" => undef} });
logout($sel);
# The "powerless" user can now be sudo'ed.
log_in($sel, $config, 'editbugs');
go_to_admin($sel);
$sel->click_ok("link=Users");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
@ -54,18 +60,18 @@ $sel->type_ok("matchstr", $config->{unprivileged_user_login});
$sel->select_ok("matchtype", "label=exact (find this user)");
$sel->click_ok("search");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Edit user no-privs <$config->{unprivileged_user_login}>");
$sel->title_like(qr/Edit user .* <\Q$config->{unprivileged_user_login}\E>/);
$sel->value_is("login", $config->{unprivileged_user_login});
$sel->click_ok("link=Impersonate this user");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Begin sudo session");
$sel->value_is("target_login", $config->{unprivileged_user_login});
$sel->type_ok("Bugzilla_password", $config->{admin_user_passwd}, "Enter admin password");
$sel->type_ok("Bugzilla_password", $config->{editbugs_user_passwd}, "Enter admin password");
$sel->click_ok('//input[@value="Begin Session"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Sudo session started");
my $text = trim($sel->get_text("message"));
ok($text =~ /The sudo session has been started/, "The sudo session has been started");
_ok($text =~ /The sudo session has been started/, "The sudo session has been started");
# Make sure this user is not an admin and has no privs at all, and that
# he cannot access editusers.cgi (despite the sudoer can).
@ -76,12 +82,12 @@ $sel->title_is("User Preferences");
$sel->click_ok("link=Permissions");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Preferences");
$sel->is_text_present_ok("There are no permission bits set on your account");
#$sel->is_text_present_ok("There are no permission bits set on your account"); # Valid only for empty DB
# We access the page directly as there is no link pointing to it.
$sel->open_ok("/$config->{bugzilla_installation}/editusers.cgi");
$sel->title_is("Authorization Required");
$error_msg = trim($sel->get_text("error_msg"));
ok($error_msg =~ /^Sorry, you aren't a member of the 'editusers' group/, "Not a member of the editusers group");
_ok($error_msg =~ /^Sorry, you aren't a member of the 'editusers' group/, "Not a member of the editusers group");
$sel->click_ok("link=end session");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Sudo session complete");
@ -110,7 +116,7 @@ $sel->click_ok('//input[@value="Begin Session"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("User Protected");
$error_msg = trim($sel->get_text("error_msg"));
ok($error_msg =~ /^The user $config->{admin_user_login} may not be impersonated by sudoers/, "Cannot impersonate administrators");
_ok($error_msg =~ /^The user $config->{admin_user_login} may not be impersonated by sudoers/, "Cannot impersonate administrators");
# Now try to sudo a non-existing user account, with no password.
@ -132,5 +138,5 @@ $sel->click_ok('//input[@value="Begin Session"]');
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Match Failed");
$error_msg = trim($sel->get_text("error_msg"));
ok($error_msg eq 'foo@bar.com does not exist or you are not allowed to see that user.', "Cannot impersonate non-existing accounts");
_ok($error_msg eq 'foo@bar.com does not exist or you are not allowed to see that user.', "Cannot impersonate non-existing accounts");
logout($sel);

View File

@ -23,7 +23,7 @@ $sel->click_ok("find_top");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_like(qr/^Bug $test_bug_1/, "Display bug $test_bug_1");
$sel->type_ok("work_time", 2.6);
$sel->type_ok("comment", "I did some work");
$sel->type_ok("comment_textarea", "I did some work"); # CustIS s/comment/comment_textarea/
$sel->click_ok("commit");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug $test_bug_1 processed");
@ -48,6 +48,8 @@ $sel->remove_all_selections("bug_status");
$sel->select_ok("field0-0-0", "label=Hours Worked");
$sel->select_ok("type0-0-0", "label=is greater than");
$sel->type_ok("value0-0-0", "0");
$sel->type_ok("chfieldfrom", "2009-01-01");
$sel->type_ok("chfieldto", "2009-04-30");
$sel->click_ok("Search");
$sel->wait_for_page_to_load_ok(WAIT_TIME);
$sel->title_is("Bug List");

View File

@ -181,10 +181,10 @@ $sel->wait_for_page_to_load(WAIT_TIME);
$sel->title_like(qr/^Bug $test_bug_1/);
$sel->click_ok("cc_edit_area_showhide");
my @cc = $sel->get_select_options("newcc");
ok(!grep($_ =~ /$config->{unprivileged_user_login}/, @cc), "$config->{unprivileged_user_login} is not visible");
ok(!grep($_ =~ /$config->{canconfirm_user_login}/, @cc), "$config->{canconfirm_user_login} is not visible");
ok(grep($_ =~ /$config->{admin_user_login}/, @cc), "$config->{admin_user_login} is visible");
ok(grep($_ =~ /$config->{tweakparams_user_login}/, @cc), "$config->{tweakparams_user_login} is visible");
_ok(!grep($_ =~ /$config->{unprivileged_user_login}/, @cc), "$config->{unprivileged_user_login} is not visible");
#_ok(!grep($_ =~ /$config->{canconfirm_user_login}/, @cc), "$config->{canconfirm_user_login} is not visible"); # WTF? нафига тестировать тестовую среду?
_ok(grep($_ =~ /$config->{admin_user_login}/, @cc), "$config->{admin_user_login} is visible");
_ok(grep($_ =~ /$config->{tweakparams_user_login}/, @cc), "$config->{tweakparams_user_login} is visible");
# Reset paramters.