Commit 88de111c authored by Jim Brandt's avatar Jim Brandt
Browse files

Add MandatoryOnTransition checking to the mobile create page

parent d29823b7
<%args>
$ARGSRef
$skip_create
$results => []
</%args>
<%init>
my $Queue = $ARGSRef->{Queue};
my $QueueObj = RT::Queue->new($session{'CurrentUser'});
$QueueObj->Load($Queue);
my $errors_ref = RT::Extension::MandatoryOnTransition->CheckMandatoryFields(
ARGSRef => $ARGSRef,
From => "*",
To => $ARGSRef->{'Status'},
Queue => $QueueObj,
);
if (@$errors_ref) {
RT->Logger->debug("Preventing create because of missing mandatory fields");
$$skip_create = 1;
push @$results, @$errors_ref;
}
</%init>
use strict;
use warnings;
use RT::Extension::MandatoryOnTransition::Test tests => 19;
use RT::Extension::MandatoryOnTransition::Test tests => 32;
use_ok('RT::Extension::MandatoryOnTransition');
......@@ -56,3 +56,35 @@ diag "Test mandatory fields on create";
$m->content_contains("Ticket 1 created in queue &#39;General&#39;");
}
diag "Test mandatory fields on create for mobile";
{
$m->get_ok($m->rt_base_url . '/m/');
$m->follow_link_ok( { text => 'New ticket' }, 'Click New ticket');
$m->title_is('Create a ticket');
$m->follow_link_ok( { text => 'General' }, 'Click General queue');
$m->title_is('Create a ticket');
$m->submit_form_ok( { form_name => 'TicketCreate',
fields => { Status => 'resolved' },
}, 'Submit with resolved status');
$m->content_contains('Time Worked is required when changing Status to resolved');
$m->content_contains('Test Field is required when changing Status to resolved');
$m->submit_form_ok( { form_name => 'TicketCreate',
fields => { Status => 'resolved',
'Object-RT::Ticket--CustomField-1-Values' => 'foo'},
}, 'Submit with resolved status');
$m->content_contains('Time Worked is required when changing Status to resolved');
$m->submit_form_ok( { form_name => 'TicketCreate',
fields => { Status => 'resolved',
'Object-RT::Ticket--CustomField-1-Values' => 'foo',
'TimeWorked' => '10', },
}, 'Submit with resolved status');
$m->title_like(qr/#(\d+):/, 'Looks like a ticket number in the title');
like($m->uri->as_string, qr/show/, "On show page after ticket create");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment