Skip to content

Commit

Permalink
Merge pull request #973 from RotherOSS/issue-#682-grinding_at_seleniu…
Browse files Browse the repository at this point in the history
…m_tests

Issue #682 grinding at selenium tests
  • Loading branch information
bschmalhofer authored Apr 27, 2021
2 parents a2d4fe9 + 40d941f commit 1f05c2a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
7 changes: 5 additions & 2 deletions Kernel/System/UnitTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ sub Run {
}
}

# Create the object that actually runs the test scripts.
# The 'jobs' is not set, this means that per default tests are not run in parallel,
# this is a requirement as test write temporary files in Kernel/Config/Files.
my $Harness = TAP::Harness->new(
{
timer => 1,
Expand Down Expand Up @@ -209,9 +212,9 @@ sub Run {
my $Aggregate = $Harness->runtests(@ActualTests);

if (@SkippedTests) {
print "Following blacklisted tests were skipped:\n";
say "Following blacklisted tests were skipped:";
for my $SkippedTest (@SkippedTests) {
print ' ' . $Self->_Color( 'yellow', $SkippedTest ) . "\n";
say ' ', $Self->_Color( 'yellow', $SkippedTest );
}
}

Expand Down
27 changes: 15 additions & 12 deletions Kernel/System/UnitTest/Helper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -531,28 +531,31 @@ sub ConfigSettingChange {
my $Key = $Param{Key};
my $Value = $Param{Value};

die "Need 'Key'" if !defined $Key;
die "Need 'Key'" unless defined $Key;

my $RandomNumber = $Self->GetRandomNumber();

my $KeyDump = $Key;
$KeyDump =~ s|'|\\'|smxg;
$KeyDump = "\$Self->{'$KeyDump'}";
$KeyDump =~ s|\#{3}|'}->{'|smxg;

# Also set at runtime in the ConfigObject. This will be destroyed at the end of the unit test.
$Kernel::OM->Get('Kernel::Config')->Set(
Key => $Key,
Value => $Valid ? $Value : undef,
);

# Generate Perl code that sets the config value
my $ValueDump;
if ($Valid) {
$ValueDump = $Kernel::OM->Get('Kernel::System::Main')->Dump($Value);
$ValueDump =~ s/\$VAR1/$KeyDump/;
}
else {
$ValueDump = "delete $KeyDump;";
{
my $KeyDump = $Key;
$KeyDump =~ s|'|\\'|smxg;
$KeyDump = "\$Self->{'$KeyDump'}";
$KeyDump =~ s|\#{3}|'}->{'|smxg;

if ($Valid) {
$ValueDump = $Kernel::OM->Get('Kernel::System::Main')->Dump($Value);
$ValueDump =~ s/\$VAR1/$KeyDump/;
}
else {
$ValueDump = "delete $KeyDump;";
}
}

my $PackageName = "ZZZZUnitTest$RandomNumber";
Expand Down
5 changes: 0 additions & 5 deletions scripts/test/Selenium/Agent/AgentTicketProcessSplit.t
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ $Selenium->RunTest(
$Selenium->find_element("//button[\@value='Upload process configuration'][\@type='submit']")->VerifiedClick();
$Selenium->find_element("//a[contains(\@href, \'Subaction=ProcessSync' )]")->VerifiedClick();

# We have to allow a 1 second delay for Apache2::Reload to pick up the changed Process cache.
sleep 1;

# Navigate to AgentTicketZoom screen.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AgentTicketZoom;TicketID=$TicketID;");

Expand Down Expand Up @@ -202,8 +199,6 @@ $Selenium->RunTest(
Value => 1
);

sleep(11);

$Selenium->VerifiedRefresh();

# Check if customer user input is on create process screen.
Expand Down
5 changes: 4 additions & 1 deletion scripts/test/Selenium/Customer/Login.t
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ $Selenium->RunTest(
}

# check if login is successful
$Selenium->find_element_by_xpath_ok(q{//div[@class='oooLogout']/a[@title='Logout']});
$Selenium->WaitFor(
ElementExists => q{//div[@class='oooLogout']/a[@title='Logout']}
);

my $ButtonLogout = $Selenium->find_element_by_xpath(q{//a[@id='oooAvatar']});
ok( $ButtonLogout, 'logout button found' );

Expand Down

0 comments on commit 1f05c2a

Please sign in to comment.