Skip to content

Commit

Permalink
Issue #2992: Fixed unittests for admin modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhaerter authored and bschmalhofer committed Feb 22, 2024
1 parent c407e08 commit 268a7d5
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

# Navigate to AdminNotificationEvent screen.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent;IncludeInvalid=1");

# Check overview screen
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -172,6 +172,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
) || die;

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent;IncludeInvalid=1");

# Check test NotificationEvent values.
$Selenium->find_element( $NotifEventRandomID, 'link_text' )->VerifiedClick();

Expand Down Expand Up @@ -238,6 +240,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent;IncludeInvalid=1");

# Check edited NotifcationEvent values
$Selenium->find_element( $NotifEventRandomID, 'link_text' )->VerifiedClick();

Expand Down Expand Up @@ -297,7 +301,7 @@ $Selenium->RunTest(
}

# Go back to AdminNotificationEvent overview screen.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAppointmentNotificationEvent;IncludeInvalid=1");

# Check class of invalid NotificationEvent in the overview table
$Self->True(
Expand All @@ -315,7 +319,7 @@ $Selenium->RunTest(
);

# Create copy of test Notification.
$Selenium->find_element("//a[contains(\@href, \'Subaction=NotificationCopy;ID=$NotifEventID{ID}' )]")->VerifiedClick();
$Selenium->find_element("//a[contains(\@href, \'Subaction=NotificationCopy;IncludeInvalid=1;ID=$NotifEventID{ID}' )]")->VerifiedClick();
my $TranslatedNotificationCopy = $LanguageObject->Translate( '%s (copy)', $NotifEventRandomID );
$Self->True(
$Selenium->find_element("//a[contains(.,'$TranslatedNotificationCopy')]"),
Expand All @@ -339,7 +343,7 @@ JAVASCRIPT
);

# Delete test Notification with delete button.
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;ID=$NotifEventID{ID}' )]")->VerifiedClick();
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;IncludeInvalid=1;ID=$NotifEventID{ID}' )]")->VerifiedClick();

# Check if test NotificationEvent is deleted
$Self->False(
Expand Down
8 changes: 6 additions & 2 deletions scripts/test/Selenium/Agent/Admin/AdminAttachment.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $Selenium->RunTest(
my $ScriptAlias = $ConfigObject->Get('ScriptAlias');

# navigate to AdminAttachment screen
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment;IncludeInvalid=1");

# check overview AdminAttachment
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -103,6 +103,8 @@ $Selenium->RunTest(
$Selenium->find_element( "#FileUpload", 'css' )->send_keys($Location);
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment;IncludeInvalid=1");

# check if standard attachment show on AdminAttachment screen
$Self->True(
index( $Selenium->get_page_source(), $AttachmentName ) > -1,
Expand Down Expand Up @@ -142,6 +144,8 @@ $Selenium->RunTest(
$Selenium->find_element( "#Comment", 'css' )->send_keys('Selenium test attachment');
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment;IncludeInvalid=1");

# check overview page
$Self->Is(
$Selenium->execute_script("return \$('table tbody tr td:contains($AttachmentName)').length"),
Expand All @@ -163,7 +167,7 @@ $Selenium->RunTest(
);

# go back to AdminAttachment overview screen
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAttachment;IncludeInvalid=1");

# check class of invalid Attachment in the overview table
$Self->True(
Expand Down
8 changes: 6 additions & 2 deletions scripts/test/Selenium/Agent/Admin/AdminAutoResponse.t
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

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

# Check overview AdminAutoResponse.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -150,6 +150,8 @@ $Selenium->RunTest(
);
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAutoResponse;IncludeInvalid=1");

# Check if test auto response show on AdminAutoResponse screen.
is(
$Selenium->execute_script(
Expand Down Expand Up @@ -198,6 +200,8 @@ $Selenium->RunTest(
);
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminAutoResponse;IncludeInvalid=1");

# Check if edited auto response show on AdminAutoResponse.
is(
$Selenium->execute_script(
Expand All @@ -217,7 +221,7 @@ $Selenium->RunTest(
);

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

# Filter auto responses.
$Selenium->find_element( "#FilterAutoResponses", 'css' )->clear();
Expand Down
4 changes: 3 additions & 1 deletion scripts/test/Selenium/Agent/Admin/AdminCustomerCompany.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

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

# Check overview AdminCustomerCompany.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -216,6 +216,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminCustomerCompany;IncludeInvalid=1");

# Test search filter.
$Selenium->find_element( "#Search", 'css' )->clear();
$Selenium->find_element( "#Search", 'css' )->send_keys($RandomID);
Expand Down
4 changes: 3 additions & 1 deletion scripts/test/Selenium/Agent/Admin/AdminCustomerUser.t
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ $Selenium->RunTest(
my $ScriptAlias = $ConfigObject->Get('ScriptAlias');

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

# Check overview AdminCustomerCompany.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -309,6 +309,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminCustomerUser;IncludeInvalid=1");

# Test search filter.
$Selenium->find_element( "#Search", 'css' )->clear();
$Selenium->find_element( "#Search", 'css' )->send_keys($RandomID);
Expand Down
6 changes: 4 additions & 2 deletions scripts/test/Selenium/Agent/Admin/AdminDynamicField.t
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

# Navigate to AdminDynamiField screen.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminDynamicField");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminDynamicField;IncludeInvalid=1");

my $LanguageObject = Kernel::Language->new(
UserLanguage => $Language,
Expand Down Expand Up @@ -206,6 +206,8 @@ $Selenium->RunTest(
);
$Selenium->find_element( '#Submit', 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminDynamicField;IncludeInvalid=1");

$Selenium->WaitFor(
JavaScript =>
"return typeof(\$) === 'function' && \$('tr.Invalid td a:contains($RandomID)').length;"
Expand Down Expand Up @@ -244,7 +246,7 @@ $Selenium->RunTest(
);

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

# Delete dynamic field.
my $DynamicFieldID = $DynamicFieldObject->DynamicFieldGet(
Expand Down
7 changes: 4 additions & 3 deletions scripts/test/Selenium/Agent/Admin/AdminGenericAgent.t
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

# navigate to AdminGenericAgent screen
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericAgent");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericAgent;IncludeInvalid=1");

# Check if needed frontend module is registered in sysconfig.
if ( !$ConfigObject->Get('Frontend::Module')->{AdminGenericAgent} ) {
Expand Down Expand Up @@ -451,7 +451,7 @@ $Selenium->RunTest(
);

# navigate to AgentGenericAgent screen again
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericAgent");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericAgent;IncludeInvalid=1");

# run test job
$Selenium->find_element("//a[contains(\@href, \'Subaction=Run;Profile=$GenericAgentJob' )]")->VerifiedClick();
Expand Down Expand Up @@ -516,6 +516,7 @@ $Selenium->RunTest(
);

$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericAgent;IncludeInvalid=1");
$Selenium->WaitFor( ElementExists => "//a[contains(.,\'$GenericAgentJob\')]" );

# check class of invalid generic job in the overview table
Expand All @@ -527,7 +528,7 @@ $Selenium->RunTest(
);

# Delete test job confirmation dialog. See bug#14197.
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;Profile=$GenericAgentJob\' )]")->click();
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;IncludeInvalid=1;Profile=$GenericAgentJob\' )]")->click();
$Selenium->WaitFor( AlertPresent => 1 );
$Selenium->accept_alert();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $Selenium->RunTest(
);

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

# Check breadcrumb on Overview screen.
$Self->True(
Expand Down Expand Up @@ -161,6 +161,7 @@ $Selenium->RunTest(

# Save edited value.
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGenericInterfaceWebservice;IncludeInvalid=1");
$Selenium->WaitFor(
JavaScript =>
"return typeof(\$) === 'function' && \$('tr.Invalid td:contains(\"$Name\")').length"
Expand Down
8 changes: 5 additions & 3 deletions scripts/test/Selenium/Agent/Admin/AdminGroup.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $Selenium->RunTest(
# Make sure the cache is correct.
$Kernel::OM->Get('Kernel::System::Cache')->CleanUp( Type => 'Group' );

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup;IncludeInvalid=1");

# Check overview AdminGroup.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -173,7 +173,7 @@ $Selenium->RunTest(
);

# Go back to overview.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup;IncludeInvalid=1");

# Try to change the name of the admin group and see if validation kicks in.
$Selenium->find_element( 'admin', 'link_text' )->VerifiedClick();
Expand All @@ -197,7 +197,7 @@ $Selenium->RunTest(
JavaScript => 'return typeof($) === "function" && !$(".Dialog:visible").length'
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup;IncludeInvalid=1");

# Check link to AdminGroup from AdminUserGroup.
$Selenium->find_element( $GroupName, 'link_text' )->VerifiedClick();
Expand Down Expand Up @@ -252,6 +252,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminGroup;IncludeInvalid=1");

# Check class of invalid Group in the overview table.
$Self->True(
$Selenium->execute_script(
Expand Down
6 changes: 4 additions & 2 deletions scripts/test/Selenium/Agent/Admin/AdminMailAccount.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

# navigate to AdminMailAccount
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminMailAccount");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminMailAccount;IncludeInvalid=1");

# check AdminMailAccount screen
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -205,6 +205,8 @@ $Selenium->RunTest(
);
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminMailAccount;IncludeInvalid=1");

# check class of invalid EmailAccount in the overview table
$Self->True(
$Selenium->execute_script(
Expand Down Expand Up @@ -296,7 +298,7 @@ $Selenium->RunTest(
}

# navigate to AdminMailAccount
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminMailAccount");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminMailAccount;IncludeInvalid=1");

# test mail account delete button
$Selenium->find_element("//a[contains(\@data-query-string, \'Subaction=Delete;ID=$MailAccountID' )]")->click();
Expand Down
8 changes: 5 additions & 3 deletions scripts/test/Selenium/Agent/Admin/AdminNotificationEvent.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $Selenium->RunTest(
my $ScriptAlias = $ConfigObject->Get('ScriptAlias');

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

# Check overview screen.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -321,6 +321,8 @@ $Selenium->RunTest(
"$Notification - notification is found."
);

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminNotificationEvent;IncludeInvalid=1");

# Check edited NotifcationEvent values.
$Selenium->find_element( $NotifEventRandomID, 'link_text' )->VerifiedClick();

Expand Down Expand Up @@ -463,7 +465,7 @@ $Selenium->RunTest(
};

# Go back to AdminNotificationEvent overview screen.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminNotificationEvent");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminNotificationEvent;IncludeInvalid=1");

# Check class of invalid NotificationEvent in the overview table.
$Self->True(
Expand All @@ -479,7 +481,7 @@ $Selenium->RunTest(
);

# Delete test notification with delete button.
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;ID=$NotifEventID{ID}' )]")->click();
$Selenium->find_element("//a[contains(\@href, \'Subaction=Delete;IncludeInvalid=1;ID=$NotifEventID{ID}' )]")->click();
$Selenium->WaitFor( AlertPresent => 1 );
$Selenium->accept_alert();

Expand Down
4 changes: 3 additions & 1 deletion scripts/test/Selenium/Agent/Admin/AdminPriority.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

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

# Check overview AdminPriority.
$Self->True(
Expand Down Expand Up @@ -158,6 +158,8 @@ $Selenium->RunTest(
);
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick();

$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminPriority;IncludeInvalid=1");

$Selenium->WaitFor(
JavaScript => "return typeof(\$) === 'function' && \$('tr.Invalid td a:contains($RandomID)').length"
);
Expand Down
8 changes: 4 additions & 4 deletions scripts/test/Selenium/Agent/Admin/AdminQueue.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $Selenium->RunTest(
my $ScriptAlias = $Kernel::OM->Get('Kernel::Config')->Get('ScriptAlias');

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

# Check overview AdminQueue.
$Selenium->find_element( "table", 'css' );
Expand Down Expand Up @@ -102,7 +102,7 @@ $Selenium->RunTest(
);

# Navigate to AdminQueue screen again.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue;IncludeInvalid=1");

# Create test queue.
$Selenium->find_element( "a.Create", 'css' )->VerifiedClick();
Expand Down Expand Up @@ -139,7 +139,7 @@ $Selenium->RunTest(
$Selenium->find_element( "#Submit", 'css' )->VerifiedClick();

# Navigate to AdminQueue screen again.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue;IncludeInvalid=1");

# Check Queue - Responses page.
$Self->True(
Expand Down Expand Up @@ -236,7 +236,7 @@ $Selenium->RunTest(
);

# Navigate to AdminQueue screen again.
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue");
$Selenium->VerifiedGet("${ScriptAlias}index.pl?Action=AdminQueue;IncludeInvalid=1");

# Check overview page.
$Self->True(
Expand Down
Loading

0 comments on commit 268a7d5

Please sign in to comment.