X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fweb%2Fcf_date.t;h=a38388972680d6018e14cb0cf134d0f9589ee34d;hb=88e9a56677d343392416c262f976f069157b06cb;hp=887aa422045e8cd6a408b5d7c3b185cd95e159a6;hpb=85e677b86fc37c54e6de2b06340351a28f5a5916;p=freeside.git diff --git a/rt/t/web/cf_date.t b/rt/t/web/cf_date.t index 887aa4220..a38388972 100644 --- a/rt/t/web/cf_date.t +++ b/rt/t/web/cf_date.t @@ -1,9 +1,8 @@ -#!/usr/bin/perl use strict; use warnings; -use RT::Test tests => 35; +use RT::Test tests => undef; my ( $baseurl, $m ) = RT::Test->started_ok; ok $m->login, 'logged in as root'; @@ -15,7 +14,7 @@ my $cf_name = 'test cf date'; my $cfid; diag "Create a CF"; { - $m->follow_link( id => 'tools-config-custom-fields-create'); + $m->follow_link( id => 'admin-custom-fields-create'); $m->submit_form( form_name => "ModifyCustomField", fields => { @@ -34,12 +33,12 @@ my $queue = RT::Test->load_or_create_queue( Name => 'General' ); ok $queue && $queue->id, 'loaded or created queue'; { - $m->follow_link( id => 'tools-config-queues-select'); + $m->follow_link( id => 'admin-queues-select'); $m->title_is( q/Admin queues/, 'admin-queues screen' ); $m->follow_link( text => 'General' ); $m->title_is( q/Configuration for queue General/, 'admin-queue: general' ); - $m->follow_link( text => 'Ticket Custom Fields' ); + $m->follow_link( id => 'page-custom-fields-tickets' ); $m->title_is( q/Custom Fields for queue General/, 'admin-queue: general cfid' ); @@ -184,4 +183,91 @@ diag 'check invalid inputs'; $m->content_contains('test cf date:', 'has no cf date field on the page' ); $m->content_lacks('foodate', 'invalid dates not set' ); + + my @warnings = $m->get_warnings; + chomp @warnings; + is_deeply( [@warnings], [(q{Couldn't parse date 'foodate' by Time::ParseDate})x2] ); +} + +diag 'retain values when adding attachments'; +{ + my ( $ticket, $id ); + + my $txn_cf = RT::CustomField->new( RT->SystemUser ); + my ( $ret, $msg ) = $txn_cf->Create( + Name => 'test txn cf date', + TypeComposite => 'Date-1', + LookupType => 'RT::Queue-RT::Ticket-RT::Transaction', + ); + ok( $ret, "created 'txn datetime': $msg" ); + $txn_cf->AddToObject(RT::Queue->new(RT->SystemUser)); + my $txn_cfid = $txn_cf->id; + + $m->submit_form( + form_name => "CreateTicketInQueue", + fields => { Queue => 'General' }, + ); + $m->content_contains('test cf date', 'has cf' ); + $m->content_contains('test txn cf date', 'has txn cf' ); + + $m->submit_form_ok( + { + form_name => "TicketCreate", + fields => { + Subject => 'test 2015-06-04', + Content => 'test', + "Object-RT::Ticket--CustomField-$cfid-Values" => '2015-06-04', + "Object-RT::Transaction--CustomField-$txn_cfid-Values" => '2015-08-15', + }, + button => 'AddMoreAttach', + }, + 'create test ticket' + ); + $m->form_name("TicketCreate"); + is( $m->value( "Object-RT::Ticket--CustomField-$cfid-Values" ), + "2015-06-04", "ticket cf date value still on form" ); + is( $m->value( "Object-RT::Transaction--CustomField-$txn_cfid-Values" ), + "2015-08-15", "txn cf date date value still on form" ); + + $m->submit_form(); + ok( ($id) = $m->content =~ /Ticket (\d+) created/, "created ticket $id" ); + + $m->follow_link_ok( {text => 'Reply'} ); + $m->title_like( qr/Update/ ); + $m->content_contains('test txn cf date', 'has txn cf'); + $m->submit_form_ok( + { + form_name => "TicketUpdate", + fields => { + Content => 'test', + "Object-RT::Transaction--CustomField-$txn_cfid-Values" => '2015-09-16', + }, + button => 'AddMoreAttach', + }, + 'Update test ticket' + ); + $m->form_name("TicketUpdate"); + is( $m->value( "Object-RT::Transaction--CustomField-$txn_cfid-Values" ), + "2015-09-16", "txn date value still on form" ); + + $m->follow_link_ok( {text => 'Jumbo'} ); + $m->title_like( qr/Jumbo/ ); + + $m->submit_form_ok( + { + form_name => "TicketModifyAll", + fields => { + "Object-RT::Transaction--CustomField-$txn_cfid-Values" => + '2015-12-16', + }, + button => 'AddMoreAttach', + }, + 'jumbo form' + ); + + $m->form_name("TicketModifyAll"); + is( $m->value( "Object-RT::Transaction--CustomField-$txn_cfid-Values" ), + "2015-12-16", "txn date value still on form" ); } + +done_testing;