Skip to content

Commit

Permalink
Issue #1000: first batch of unTODOing #929
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed May 11, 2021
1 parent 1f63952 commit e0dd4e7
Show file tree
Hide file tree
Showing 7 changed files with 974 additions and 1,028 deletions.
732 changes: 359 additions & 373 deletions scripts/test/Selenium/Agent/AgentTicketProcess.t

Large diffs are not rendered by default.

125 changes: 59 additions & 66 deletions scripts/test/Selenium/Agent/AgentTicketProcessAttachment.t
Original file line number Diff line number Diff line change
Expand Up @@ -165,82 +165,75 @@ $Selenium->RunTest(
Value => $ListReverse{$ProcessName},
);

my $TicketID;
{
my $ToDo = todo('selection of process is not reliable, see #929');

try_ok {
$Selenium->WaitFor( ElementExists => [ '#Subject', 'css' ] );
$Selenium->WaitFor( ElementExists => [ '#Subject', 'css' ] );

# Hide DnDUpload and show input field.
$Selenium->execute_script(
"\$('.DnDUpload').css('display', 'none');"
);
$Selenium->execute_script(
"\$('#FileUpload').css('display', 'block');"
);
# Hide DnDUpload and show input field.
$Selenium->execute_script(
"\$('.DnDUpload').css('display', 'none');"
);
$Selenium->execute_script(
"\$('#FileUpload').css('display', 'block');"
);

# Scroll to attachment element view if necessary.
$Selenium->execute_script("\$('#FileUpload')[0].scrollIntoView(true);");
# Scroll to attachment element view if necessary.
$Selenium->execute_script("\$('#FileUpload')[0].scrollIntoView(true);");

# Add an attachment.
$Location = $ConfigObject->Get('Home') . "/scripts/test/sample/Main/Main-Test1.txt";
$Selenium->find_element( "#FileUpload", 'css' )->send_keys($Location);
# Add an attachment.
$Location = $ConfigObject->Get('Home') . "/scripts/test/sample/Main/Main-Test1.txt";
$Selenium->find_element( "#FileUpload", 'css' )->send_keys($Location);

# Wait until attachment is uploaded, i.e. until it appears in the attachment list table.
# Additional check for opacity makes sure that animation has been completed.
$Selenium->WaitFor(
JavaScript =>
'return typeof($) === "function" && $(".AttachmentListContainer tbody tr").filter(function() {
return $(this).css("opacity") == 1;
}).length;'
);
# Wait until attachment is uploaded, i.e. until it appears in the attachment list table.
# Additional check for opacity makes sure that animation has been completed.
$Selenium->WaitFor(
JavaScript =>
'return typeof($) === "function" && $(".AttachmentListContainer tbody tr").filter(function() {
return $(this).css("opacity") == 1;
}).length;'
);

# Check if uploaded.
$Self->Is(
$Selenium->execute_script(
"return \$('.AttachmentList tbody tr td.Filename:contains(Main-Test1.txt)').length;"
),
1,
"'Main-Test1.txt' - uploaded"
);
# Check if uploaded.
$Self->Is(
$Selenium->execute_script(
"return \$('.AttachmentList tbody tr td.Filename:contains(Main-Test1.txt)').length;"
),
1,
"'Main-Test1.txt' - uploaded"
);

$Selenium->find_element( "#Subject", 'css' )->send_keys('Test');
sleep 1;
$Selenium->execute_script(
q{
return CKEDITOR.instances.RichText.setData('This is a test text');
}
);
$Selenium->find_element( "#Subject", 'css' )->send_keys('Test');
sleep 1;
$Selenium->execute_script(
q{
return CKEDITOR.instances.RichText.setData('This is a test text');
}
);

# Submit.
try_ok {
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick();
$Selenium->WaitFor(
JavaScript =>
'return typeof($) === "function" && $(".TicketZoom").length;'
);
};
};

my $Url = $Selenium->get_current_url();

# Check if ticket is created (sent to AgentTicketZoom screen).
ok(
index( $Url, 'Action=AgentTicketZoom;TicketID=' ) > -1,
"Current URL is correct - AgentTicketZoom",
# Submit.
try_ok {
$Selenium->find_element("//button[\@type='submit']")->VerifiedClick();
$Selenium->WaitFor(
JavaScript =>
'return typeof($) === "function" && $(".TicketZoom").length;'
);
};

# Get test ticket ID.
my @TicketZoomUrl = split( 'Action=AgentTicketZoom;TicketID=', $Url );
$TicketID = $TicketZoomUrl[1];
my $Url = $Selenium->get_current_url();

# Verify article attachment is created.
$Selenium->find_element_by_css_ok(
'.ArticleAttachments li',
"Attachment is created in process ticket article"
);
}
# Check if ticket is created (sent to AgentTicketZoom screen).
ok(
index( $Url, 'Action=AgentTicketZoom;TicketID=' ) > -1,
"Current URL is correct - AgentTicketZoom",
);

# Get test ticket ID.
my @TicketZoomUrl = split( 'Action=AgentTicketZoom;TicketID=', $Url );
my $TicketID = $TicketZoomUrl[1];

# Verify article attachment is created.
$Selenium->find_element_by_css_ok(
'.ArticleAttachments li',
"Attachment is created in process ticket article"
);

my $TransitionObject = $Kernel::OM->Get('Kernel::System::ProcessManagement::DB::Transition');
my $ActivityObject = $Kernel::OM->Get('Kernel::System::ProcessManagement::DB::Activity');
Expand Down
Loading

0 comments on commit e0dd4e7

Please sign in to comment.