1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
# --
# Copyright (C) 2001-2017 OTRS AG, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
use strict;
use warnings;
use utf8;
use vars (qw($Self));
# Update 'To' in CustomerTicketMessage on Add/Update Group (Bug#10988).
# get selenium object
my $Selenium = $Kernel::OM->Get('Kernel::System::UnitTest::Selenium');
$Selenium->RunTest(
sub {
my $Helper = $Kernel::OM->Get('Kernel::System::UnitTest::Helper');
# make sure that CustomerGroupSupport is disabled
$Helper->ConfigSettingChange(
Valid => 1,
Key => 'CustomerGroupSupport',
Value => 0
);
# create test customer user and login
my $TestCustomerUserLogin = $Helper->TestCustomerUserCreate(
) || die "Did not get test customer user";
$Selenium->Login(
Type => 'Customer',
User => $TestCustomerUserLogin,
Password => $TestCustomerUserLogin,
);
# add test queue in group users
my $QueueObject = $Kernel::OM->Get('Kernel::System::Queue');
my $QueueName = "Queue" . $Helper->GetRandomID();
my $QueueID = $QueueObject->QueueAdd(
Name => $QueueName,
ValidID => 1,
GroupID => 1,
SystemAddressID => 1,
SalutationID => 1,
SignatureID => 1,
UserID => 1,
Comment => 'Selenium test queue',
);
$Self->True(
$QueueID,
"Queue is created - $QueueName"
);
# click on 'Create your first ticket'
$Selenium->find_element( ".Button", 'css' )->VerifiedClick();
# verify that test queue is available for users group
$Self->True(
$Selenium->find_element( "#Dest option[value='$QueueID||$QueueName']", 'css' ),
"$QueueName is available to select"
);
# create test group
my $GroupName = "Group" . $Helper->GetRandomID();
my $GroupObject = $Kernel::OM->Get('Kernel::System::Group');
my $GroupID = $GroupObject->GroupAdd(
Name => $GroupName,
ValidID => 1,
UserID => 1,
);
$Self->True(
$GroupID,
"Group is created - $GroupName"
);
# add test queue to test group
my $QueueUpdateID = $QueueObject->QueueUpdate(
QueueID => $QueueID,
Name => $QueueName,
GroupID => $GroupID,
SystemAddressID => 1,
SalutationID => 1,
SignatureID => 1,
FollowUpID => 1,
UserID => 1,
ValidID => 1,
);
$Self->True(
$QueueUpdateID,
"Queue is updated - $QueueName"
);
# refresh page
$Selenium->VerifiedRefresh();
# check if test queue is available to select
$Self->True(
index( $Selenium->get_page_source(), $QueueName ) > -1,
"$QueueName is available to select with new group $GroupName",
);
# update group to invalid
my $GroupUpdate = $GroupObject->GroupUpdate(
ID => $GroupID,
Name => $GroupName,
ValidID => 2,
UserID => 1,
);
$Self->True(
$GroupUpdate,
"$GroupName is updated to invalid status",
);
# refresh page
$Selenium->VerifiedRefresh();
# check test queue with invalid test group
$Self->False(
index( $Selenium->get_page_source(), $QueueName ) > -1,
"$QueueName is not available to select with invalid group $GroupName",
);
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
# clean up test data
my $Success;
if ($QueueID) {
$Success = $DBObject->Do(
SQL => "DELETE FROM queue WHERE id = $QueueID",
);
$Self->True(
$Success,
"Queue is deleted - $QueueName",
);
}
if ($GroupID) {
$Success = $DBObject->Do(
SQL => "DELETE FROM groups WHERE id = $GroupID",
);
$Self->True(
$Success,
"Group is deleted - $GroupName",
);
}
# make sure the cache is correct
for my $Cache (
qw (Queue Group)
)
{
$Kernel::OM->Get('Kernel::System::Cache')->CleanUp(
Type => $Cache,
);
}
}
);
1;
|