5 use RT::Test tests => 20;
9 my $queue_name = "CFSortQueue-$$";
10 my $queue = RT::Test->load_or_create_queue( Name => $queue_name );
11 ok($queue && $queue->id, "$queue_name - test queue creation");
13 diag "create multiple CFs: B, A and C";
16 my $cf = RT::CustomField->new( RT->SystemUser );
17 my ($ret, $msg) = $cf->Create(
20 Type => 'FreeformSingle',
22 ok($ret, "Custom Field Order created");
26 my $cf = RT::CustomField->new( RT->SystemUser );
27 my ($ret, $msg) = $cf->Create(
30 Type => 'FreeformSingle',
32 ok($ret, "Custom Field Order created");
36 my $cf = RT::CustomField->new( RT->SystemUser );
37 my ($ret, $msg) = $cf->Create(
40 Type => 'FreeformSingle',
42 ok($ret, "Custom Field Order created");
46 my ($baseurl, $m) = RT::Test->started_ok;
47 ok $m->login( root => 'password' ), 'logged in';
49 diag "reorder CFs: C, A and B";
51 $m->get( '/Admin/Queues/' );
52 $m->follow_link_ok( {text => $queue->id} );
53 $m->follow_link_ok( {id => 'page-custom-fields-tickets'} );
54 my @tmp = ($m->content =~ /(CF [ABC])/g);
55 is_deeply(\@tmp, ['CF B', 'CF A', 'CF C']);
57 $m->follow_link_ok( {text => '[Up]', n => 3} );
58 $m->follow_link_ok( {text => '[Up]', n => 2} );
59 $m->follow_link_ok( {text => '[Up]', n => 3} );
61 @tmp = ($m->content =~ /(CF [ABC])/g);
62 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
65 diag "check ticket create, display and edit pages";
68 form_name => "CreateTicketInQueue",
69 fields => { Queue => $queue->Name },
72 my @tmp = ($m->content =~ /(CF [ABC])/g);
73 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
76 form_name => "TicketCreate",
77 fields => { Subject => 'test' },
79 my ($tid) = ($m->content =~ /Ticket (\d+) created/i);
80 ok $tid, "created a ticket succesfully";
82 @tmp = ($m->content =~ /(CF [ABC])/g);
83 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);
84 $m->follow_link_ok( {id => 'page-basics'});
86 @tmp = ($m->content =~ /(CF [ABC])/g);
87 is_deeply(\@tmp, ['CF C', 'CF A', 'CF B']);