6 use RT::Test tests => 20;
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";
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";
52 $m->get( '/Admin/Queues/' );
53 $m->follow_link_ok( {text => $queue->id} );
54 $m->follow_link_ok( {id => 'page-ticket-custom-fields'} );
55 my @tmp = ($m->content =~ /(CF [ABC])/g);
56 is_deeply(\@tmp, ['CF B', 'CF A', 'CF C']);
58 $m->follow_link_ok( {text => '[Up]', n => 3} );
59 $m->follow_link_ok( {text => '[Up]', n => 2} );
60 $m->follow_link_ok( {text => '[Up]', n => 3} );
62 @tmp = ($m->content =~ /(CF [ABC])/g);
63 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
66 diag "check ticket create, display and edit pages";
69 form_name => "CreateTicketInQueue",
70 fields => { Queue => $queue->Name },
73 my @tmp = ($m->content =~ /(CF [ABC])/g);
74 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
77 form_name => "TicketCreate",
78 fields => { Subject => 'test' },
80 my ($tid) = ($m->content =~ /Ticket (\d+) created/i);
81 ok $tid, "created a ticket succesfully";
83 @tmp = ($m->content =~ /(CF [ABC])/g);
84 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
85 $m->follow_link_ok( {id => 'page-basics'});
87 @tmp = ($m->content =~ /(CF [ABC])/g);
88 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);