6
use Test::More tests => 18;
11
my $queue_name = "CFSortQueue-$$";
12
my $queue = RT::Test->load_or_create_queue( Name => $queue_name );
13
ok($queue && $queue->id, "$queue_name - test queue creation");
15
diag "create multiple CFs: B, A and C" if $ENV{TEST_VERBOSE};
18
my $cf = RT::CustomField->new( $RT::SystemUser );
19
my ($ret, $msg) = $cf->Create(
22
Type => 'FreeformSingle',
24
ok($ret, "Custom Field Order created");
28
my $cf = RT::CustomField->new( $RT::SystemUser );
29
my ($ret, $msg) = $cf->Create(
32
Type => 'FreeformSingle',
34
ok($ret, "Custom Field Order created");
38
my $cf = RT::CustomField->new( $RT::SystemUser );
39
my ($ret, $msg) = $cf->Create(
42
Type => 'FreeformSingle',
44
ok($ret, "Custom Field Order created");
48
my ($baseurl, $m) = RT::Test->started_ok;
49
ok $m->login( root => 'password' ), 'logged in';
51
diag "reorder CFs: C, A and B" if $ENV{TEST_VERBOSE};
53
$m->get( '/Admin/Queues/' );
54
$m->follow_link_ok( {text => $queue->id} );
55
$m->follow_link_ok( {text => 'Ticket Custom Fields'} );
57
my @tmp = ($m->content =~ /(CF [ABC])/g);
58
is_deeply(\@tmp, ['CF B', 'CF A', 'CF C']);
60
$m->follow_link_ok( {text => 'Move up', n => 2} );
61
$m->follow_link_ok( {text => 'Move up', n => 1} );
62
$m->follow_link_ok( {text => 'Move up', n => 2} );
64
@tmp = ($m->content =~ /(CF [ABC])/g);
65
is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
68
diag "check ticket create, display and edit pages" if $ENV{TEST_VERBOSE};
71
form_name => "CreateTicketInQueue",
72
fields => { Queue => $queue->Name },
75
my @tmp = ($m->content =~ /(CF [ABC])/g);
76
is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
79
form_name => "TicketCreate",
80
fields => { Subject => 'test' },
82
my ($tid) = ($m->content =~ /Ticket (\d+) created/i);
83
ok $tid, "created a ticket succesfully";
85
@tmp = ($m->content =~ /(CF [ABC])/g);
86
is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
88
$m->follow_link_ok( {text => 'Custom Fields'} );
90
@tmp = ($m->content =~ /(CF [ABC])/g);
91
is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);