"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/test/Selenium/Agent/Admin/AdminCustomerUserGroup.t" between
otrs-5.0.39.tar.bz2 and otrs-5.0.40.tar.bz2

About: OTRS (formerly "Open Ticket Request System" now "Open Technology – Real Service") is a web-based ticketing systems used for Customer Service, Help Desk, IT Service Management. 5.x release ("Community Edition").

AdminCustomerUserGroup.t  (otrs-5.0.39.tar.bz2):AdminCustomerUserGroup.t  (otrs-5.0.40.tar.bz2)
skipping to change at line 15 skipping to change at line 15
# the enclosed file COPYING for license information (GPL). If you # the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt. # did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# -- # --
use strict; use strict;
use warnings; use warnings;
use utf8; use utf8;
use vars (qw($Self)); use vars (qw($Self));
# get selenium object
my $Selenium = $Kernel::OM->Get('Kernel::System::UnitTest::Selenium'); my $Selenium = $Kernel::OM->Get('Kernel::System::UnitTest::Selenium');
$Selenium->RunTest( $Selenium->RunTest(
sub { sub {
# get helper object
my $Helper = $Kernel::OM->Get('Kernel::System::UnitTest::Helper'); my $Helper = $Kernel::OM->Get('Kernel::System::UnitTest::Helper');
# disable check email address # Disable check email address.
$Helper->ConfigSettingChange( $Helper->ConfigSettingChange(
Key => 'CheckEmailAddresses', Key => 'CheckEmailAddresses',
Value => 0 Value => 0
); );
# enable CustomerGroupSupport # Enable CustomerGroupSupport.
$Helper->ConfigSettingChange( $Helper->ConfigSettingChange(
Valid => 1, Valid => 1,
Key => 'CustomerGroupSupport', Key => 'CustomerGroupSupport',
Value => 1 Value => 1
); );
# create test user and login # Create test user and login.
my $TestUserLogin = $Helper->TestUserCreate( my $TestUserLogin = $Helper->TestUserCreate(
Groups => ['admin'], Groups => ['admin'],
) || die "Did not get test user"; ) || die "Did not get test user";
$Selenium->Login( $Selenium->Login(
Type => 'Agent', Type => 'Agent',
User => $TestUserLogin, User => $TestUserLogin,
Password => $TestUserLogin, Password => $TestUserLogin,
); );
# create new CustomerUser for the tests # Create new CustomerUser for the tests.
my $UserRandomID = "user" . $Helper->GetRandomID(); my $UserRandomID = "user" . $Helper->GetRandomID();
my $CustomerUserID = $Kernel::OM->Get('Kernel::System::CustomerUser')->C ustomerUserAdd( my $CustomerUserID = $Kernel::OM->Get('Kernel::System::CustomerUser')->C ustomerUserAdd(
UserFirstname => $UserRandomID, UserFirstname => $UserRandomID,
UserLastname => $UserRandomID, UserLastname => $UserRandomID,
UserCustomerID => $UserRandomID, UserCustomerID => $UserRandomID,
UserLogin => $UserRandomID, UserLogin => $UserRandomID,
UserEmail => $UserRandomID . '@localhost.com', UserEmail => $UserRandomID . '@localhost.com',
ValidID => 1, ValidID => 1,
UserID => 1, UserID => 1,
); );
$Self->True( $Self->True(
$CustomerUserID, $CustomerUserID,
"CustomerUserAdd - $CustomerUserID", "CustomerUserAdd - $CustomerUserID",
); );
# create new Group for the tests # Create new Group for the tests.
my $GroupRandomID = "group" . $Helper->GetRandomID(); my $GroupRandomID = "group" . $Helper->GetRandomID();
my $GroupID = $Kernel::OM->Get('Kernel::System::Group')->GroupAdd( my $GroupID = $Kernel::OM->Get('Kernel::System::Group')->GroupAdd(
Name => $GroupRandomID, Name => $GroupRandomID,
ValidID => 1, ValidID => 1,
UserID => 1, UserID => 1,
); );
$Self->True( $Self->True(
$GroupID, $GroupID,
"GroupAdd - $GroupID", "GroupAdd - $GroupID",
); );
# get config object
my $ConfigObject = $Kernel::OM->Get('Kernel::Config'); my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $ScriptAlias = $ConfigObject->Get('ScriptAlias');
# get script alias # Navigate to AdminCustomerUserGroup.
my $ScriptAlias = $ConfigObject->Get('ScriptAlias');
# navigate to AdminCustomerUserGroup
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminCustomerUserG roup"); $Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminCustomerUserG roup");
# check overview AdminCustomerUserGroup $Selenium->WaitFor(
JavaScript => 'return typeof($) === "function" && $("#Customers").le
ngth'
);
# Check overview AdminCustomerUserGroup.
$Selenium->find_element( "#Customers", 'css' ); $Selenium->find_element( "#Customers", 'css' );
$Selenium->find_element( "#Group", 'css' ); $Selenium->find_element( "#Group", 'css' );
$Selenium->find_element( "#CustomerUserSearch", 'css' ); $Selenium->find_element( "#CustomerUserSearch", 'css' );
$Selenium->find_element( "#FilterGroups", 'css' ); $Selenium->find_element( "#FilterGroups", 'css' );
$Selenium->find_element( "#AlwaysGroups", 'css' ); $Selenium->find_element( "#AlwaysGroups", 'css' );
#check for Customer default Groups # Check for Customer default Groups.
my @CustomerAlwaysGroups = @{ $ConfigObject->Get('CustomerGroupAlwaysGro ups') }; my @CustomerAlwaysGroups = @{ $ConfigObject->Get('CustomerGroupAlwaysGro ups') };
if (@CustomerAlwaysGroups) { if (@CustomerAlwaysGroups) {
for my $AlwaysGroupID (@CustomerAlwaysGroups) { for my $AlwaysGroupID (@CustomerAlwaysGroups) {
$Self->True( $Self->True(
index( $Selenium->get_page_source(), $AlwaysGroupID ) > -1, index( $Selenium->get_page_source(), $AlwaysGroupID ) > -1,
"$AlwaysGroupID default AlwaysGroup found on page", "$AlwaysGroupID default AlwaysGroup found on page",
); );
} }
} }
# check for created test CustomerUser and Group on screen # Test CustomerUser filter.
$Self->True(
index( $Selenium->get_page_source(), $UserRandomID ) > -1,
"$UserRandomID user found on page",
);
$Self->True(
index( $Selenium->get_page_source(), $GroupRandomID ) > -1,
"$GroupRandomID group found on page",
);
# test CustomerUser filter
$Selenium->find_element( "#CustomerUserSearch", 'css' )->clear(); $Selenium->find_element( "#CustomerUserSearch", 'css' )->clear();
$Selenium->find_element( "#CustomerUserSearch", 'css' )->send_keys($User RandomID); $Selenium->find_element( "#CustomerUserSearch", 'css' )->send_keys($User RandomID);
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick(); $Selenium->find_element("//button[\@type='submit']")->VerifiedClick();
# Check for created test CustomerUser and Group on screen.
$Self->True( $Self->True(
index( $Selenium->get_page_source(), $UserRandomID ) > -1, index( $Selenium->get_page_source(), $UserRandomID ) > -1,
"$UserRandomID user found on page", "$UserRandomID user found on page",
); );
$Self->True(
index( $Selenium->get_page_source(), $GroupRandomID ) > -1,
"$GroupRandomID group found on page",
);
# clear CustomerUser filter # clear CustomerUser filter
$Selenium->find_element( "#CustomerUserSearch", 'css' )->clear(); $Selenium->find_element( "#CustomerUserSearch", 'css' )->clear();
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick(); $Selenium->find_element("//button[\@type='submit']")->VerifiedClick();
# test Filter for Groups # Test Filter for Groups.
$Selenium->find_element( "#FilterGroups", 'css' )->send_keys($GroupRando mID); $Selenium->find_element( "#FilterGroups", 'css' )->send_keys($GroupRando mID);
sleep 1;
$Self->True( $Self->True(
$Selenium->find_element( "$GroupRandomID", 'link_text' )->is_display ed(), $Selenium->find_element( "$GroupRandomID", 'link_text' )->is_display ed(),
"$GroupRandomID group found on page", "$GroupRandomID group found on page",
); );
# change test CustomerUser relations for test Group # Change test CustomerUser relations for test Group.
$Selenium->find_element( $GroupRandomID, 'link_text' )->VerifiedClick(); $Selenium->find_element( $GroupRandomID, 'link_text' )->VerifiedClick();
$Selenium->find_element( "#CustomerUserSearch", 'css' )->clear();
$Selenium->find_element( "#CustomerUserSearch", 'css' )->send_keys($User
RandomID);
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick();
$Selenium->WaitFor( ElementExists => "//input[\@value='$UserRandomID'][\
@name='rw']" );
$Selenium->find_element("//input[\@value='$UserRandomID'][\@name='rw']") ->VerifiedClick(); $Selenium->find_element("//input[\@value='$UserRandomID'][\@name='rw']") ->VerifiedClick();
$Selenium->find_element("//button[\@value='Submit'][\@type='submit']")-> VerifiedClick(); $Selenium->find_element("//button[\@value='Submit'][\@type='submit']")-> VerifiedClick();
# check test Group relation for test CustomerUser # Check test Group relation for test CustomerUser.
my $CustomerUserLink = "$UserRandomID $UserRandomID <$UserRandomID\@loca lhost.com> ($UserRandomID)"; my $CustomerUserLink = "$UserRandomID $UserRandomID <$UserRandomID\@loca lhost.com> ($UserRandomID)";
$Selenium->find_element( $CustomerUserLink, 'link_text' )->VerifiedClick (); $Selenium->find_element( $CustomerUserLink, 'link_text' )->VerifiedClick ();
$Self->Is( $Self->Is(
$Selenium->find_element("//input[\@value='$GroupID'][\@name='rw']")- >is_selected(), $Selenium->find_element("//input[\@value='$GroupID'][\@name='rw']")- >is_selected(),
1, 1,
"Full read and write permission for $GroupRandomID is enabled", "Full read and write permission for $GroupRandomID is enabled",
); );
$Self->Is( $Self->Is(
$Selenium->find_element("//input[\@value='$GroupID'][\@name='ro']")- >is_selected(), $Selenium->find_element("//input[\@value='$GroupID'][\@name='ro']")- >is_selected(),
1, 1,
"Read only permission for $GroupRandomID is enabled", "Read only permission for $GroupRandomID is enabled",
); );
# remove test Group relation for test CustomerUser # Remove test Group relation for test CustomerUser.
$Selenium->find_element("//input[\@value='$GroupID'][\@name='rw']")->Ver ifiedClick(); $Selenium->find_element("//input[\@value='$GroupID'][\@name='rw']")->Ver ifiedClick();
$Selenium->find_element("//input[\@value='$GroupID'][\@name='ro']")->Ver ifiedClick(); $Selenium->find_element("//input[\@value='$GroupID'][\@name='ro']")->Ver ifiedClick();
$Selenium->find_element("//button[\@value='Submit'][\@type='submit']")-> VerifiedClick(); $Selenium->find_element("//button[\@value='Submit'][\@type='submit']")-> VerifiedClick();
# get DB object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB'); my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
# Since there are no tickets that rely on our test CustomerUserGroup we can remove # Since there are no tickets that rely on our test CustomerUserGroup we can remove
# it from DB, delete test CustomerUser and test Group # it from DB, delete test CustomerUser and test Group
if ($UserRandomID) { if ($UserRandomID) {
my $Success = $DBObject->Do( my $Success = $DBObject->Do(
SQL => "DELETE FROM customer_user WHERE customer_id = ?", SQL => "DELETE FROM customer_user WHERE customer_id = ?",
Bind => [ \$UserRandomID ], Bind => [ \$UserRandomID ],
); );
$Self->True( $Self->True(
skipping to change at line 188 skipping to change at line 186
if ($GroupRandomID) { if ($GroupRandomID) {
my $Success = $DBObject->Do( my $Success = $DBObject->Do(
SQL => "DELETE FROM groups WHERE id = $GroupID", SQL => "DELETE FROM groups WHERE id = $GroupID",
); );
$Self->True( $Self->True(
$Success, $Success,
"Deleted Group - $GroupRandomID", "Deleted Group - $GroupRandomID",
); );
} }
# make sure cache is correct # Make sure cache is correct
for my $Cache ( for my $Cache (
qw(Group User DBGroupUserGet) qw(Group User DBGroupUserGet)
) )
{ {
$Kernel::OM->Get('Kernel::System::Cache')->CleanUp( Type => $Cache ) ; $Kernel::OM->Get('Kernel::System::Cache')->CleanUp( Type => $Cache ) ;
} }
} }
); );
 End of changes. 23 change blocks. 
32 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)