Skip to content

Commit

Permalink
Issue #1486: adapt test script
Browse files Browse the repository at this point in the history
to changed setting of the max length of the dynamic field links.
Changed from 18 to 40.
  • Loading branch information
bschmalhofer committed Dec 8, 2021
1 parent 81a927d commit d5d8bcf
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions scripts/test/Selenium/Agent/DynamicFieldShowLink.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@

use strict;
use warnings;
use v5.24;
use utf8;

# Set up the test driver $Self when we are running as a standalone script.
use Kernel::System::UnitTest::RegisterDriver;
# core modules

use vars (qw($Self));
# CPAN modules
use Test2::V0;

# OTOBO modules
use Kernel::System::UnitTest::RegisterDriver; # Set up $Kernel::OM and the test driver $Self
use Kernel::System::UnitTest::Selenium;

our $Self;

my $Selenium = Kernel::System::UnitTest::Selenium->new( LogExecuteCommandActive => 1 );

$Selenium->RunTest(
Expand Down Expand Up @@ -74,7 +79,7 @@ $Selenium->RunTest(
}

# Create test dynamic field, the link to github issues is just an example
my $RandomNumber = $Helper->GetRandomNumber();
my $RandomNumber = $Helper->GetRandomNumber(); # 16 characters
my $DynamicFieldName = 'LinkPreview';
my $DynamicFieldLink = "https://github.com/RotherOSS/otobo/issues/[% Data.TicketID | uri %]";
my $DynamicFieldID = $DynamicFieldObject->DynamicFieldAdd(
Expand All @@ -96,7 +101,7 @@ $Selenium->RunTest(
);

# Set dynamic field value.
my $ValueText = 'Click on Link' . $RandomNumber;
my $ValueText = 'Click on Link012345678901' . $RandomNumber; # 41 characters, max size is 40
$Success = $Kernel::OM->Get('Kernel::System::DynamicFieldValue')->ValueSet(
FieldID => $DynamicFieldID,
ObjectType => 'Ticket',
Expand All @@ -108,10 +113,7 @@ $Selenium->RunTest(
],
UserID => 1,
);
$Self->True(
$Success,
"DynamicFieldID $DynamicFieldID is set to '$ValueText' successfully",
);
ok( $Success, "DynamicFieldID $DynamicFieldID is set to '$ValueText' successfully" );

# Set SysConfig to show dynamic field in CustomerTicketZoom screen.
$Helper->ConfigSettingChange(
Expand Down Expand Up @@ -146,7 +148,8 @@ $Selenium->RunTest(
);

# Check dynamic field text.
my $ValueTextShortened = substr $ValueText, 0, 13;
# The shortend link has the max size, the last 5 chars are replaced
my $ValueTextShortened = substr $ValueText, 0, ( 40 - 5 );
$ValueTextShortened .= '[...]';
$Self->Is(
$Selenium->execute_script(
Expand Down Expand Up @@ -226,4 +229,4 @@ $Selenium->RunTest(
}
);

$Self->DoneTesting();
done_testing();

0 comments on commit d5d8bcf

Please sign in to comment.