6 use RT::Test tests => 18;
10 my $queue_name = "CFSortQueue-$$";
11 my $queue = RT::Test->load_or_create_queue( Name => $queue_name );
12 ok($queue && $queue->id, "$queue_name - test queue creation");
14 diag "create multiple CFs: B, A and C" if $ENV{TEST_VERBOSE};
17 my $cf = RT::CustomField->new( $RT::SystemUser );
18 my ($ret, $msg) = $cf->Create(
21 Type => 'FreeformSingle',
23 ok($ret, "Custom Field Order created");
27 my $cf = RT::CustomField->new( $RT::SystemUser );
28 my ($ret, $msg) = $cf->Create(
31 Type => 'FreeformSingle',
33 ok($ret, "Custom Field Order created");
37 my $cf = RT::CustomField->new( $RT::SystemUser );
38 my ($ret, $msg) = $cf->Create(
41 Type => 'FreeformSingle',
43 ok($ret, "Custom Field Order created");
47 my ($baseurl, $m) = RT::Test->started_ok;
48 ok $m->login( root => 'password' ), 'logged in';
50 diag "reorder CFs: C, A and B" if $ENV{TEST_VERBOSE};
52 $m->get( '/Admin/Queues/' );
53 $m->follow_link_ok( {text => $queue->id} );
54 $m->follow_link_ok( {text => 'Ticket Custom Fields'} );
56 my @tmp = ($m->content =~ /(CF [ABC])/g);
57 is_deeply(\@tmp, ['CF B', 'CF A', 'CF C']);
59 $m->follow_link_ok( {text => '[Up]', n => 3} );
60 $m->follow_link_ok( {text => '[Up]', n => 2} );
61 $m->follow_link_ok( {text => '[Up]', n => 3} );
63 @tmp = ($m->content =~ /(CF [ABC])/g);
64 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
67 diag "check ticket create, display and edit pages" if $ENV{TEST_VERBOSE};
70 form_name => "CreateTicketInQueue",
71 fields => { Queue => $queue->Name },
74 my @tmp = ($m->content =~ /(CF [ABC])/g);
75 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
78 form_name => "TicketCreate",
79 fields => { Subject => 'test' },
81 my ($tid) = ($m->content =~ /Ticket (\d+) created/i);
82 ok $tid, "created a ticket succesfully";
84 @tmp = ($m->content =~ /(CF [ABC])/g);
85 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
87 $m->follow_link_ok( {text => 'Custom Fields'} );
89 @tmp = ($m->content =~ /(CF [ABC])/g);
90 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);