Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / rt / t / web / ticket_modify_all.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => 22;
5
6 my $ticket = RT::Test->create_ticket(
7     Subject => 'test bulk update',
8     Queue   => 1,
9 );
10
11 my ( $url, $m ) = RT::Test->started_ok;
12 ok( $m->login, 'logged in' );
13
14 $m->get_ok( $url . "/Ticket/ModifyAll.html?id=" . $ticket->id );
15
16 $m->submit_form(
17     form_number => 3,
18     fields      => { 'UpdateContent' => 'this is update content' },
19     button      => 'SubmitTicket',
20 );
21
22 $m->content_contains("Message recorded", 'updated ticket');
23 $m->content_lacks("this is update content", 'textarea is clear');
24
25 $m->get_ok($url . '/Ticket/Display.html?id=' . $ticket->id );
26 $m->content_contains("this is update content", 'updated content in display page');
27
28 # NOTE http://issues.bestpractical.com/Ticket/Display.html?id=18284
29 RT::Test->stop_server;
30 RT->Config->Set(AutocompleteOwners => 1);
31 ($url, $m) = RT::Test->started_ok;
32 $m->login;
33
34 $m->get_ok($url . '/Ticket/ModifyAll.html?id=' . $ticket->id);
35
36 $m->form_name('TicketModifyAll');
37 $m->field(Owner => 'root');
38 $m->click('SubmitTicket');
39
40 $m->form_name('TicketModifyAll');
41 is($m->value('Owner'), 'root', 'owner was successfully changed to root');
42
43 $m->get_ok($url . "/Ticket/ModifyAll.html?id=" . $ticket->id);
44
45 $m->form_name('TicketModifyAll');
46 $m->field('Starts_Date' => "2013-01-01 00:00:00");
47 $m->click('SubmitTicket');
48 $m->text_contains("Starts: (Tue Jan 01 00:00:00 2013)", 'start date successfully updated');
49
50 $m->form_name('TicketModifyAll');
51 $m->field('Started_Date' => "2014-01-01 00:00:00");
52 $m->click('SubmitTicket');
53 $m->text_contains("Started: (Wed Jan 01 00:00:00 2014)", 'started date successfully updated');
54
55 $m->form_name('TicketModifyAll');
56 $m->field('Told_Date' => "2015-01-01 00:00:00");
57 $m->click('SubmitTicket');
58 $m->text_contains("Last Contact:  (Thu Jan 01 00:00:00 2015)", 'told date successfully updated');
59
60 $m->form_name('TicketModifyAll');
61 $m->field('Due_Date' => "2016-01-01 00:00:00");
62 $m->click('SubmitTicket');
63 $m->text_contains("Due: (Fri Jan 01 00:00:00 2016)", 'due date successfully updated');
64
65 $m->get( $url . '/Ticket/ModifyAll.html?id=' . $ticket->id );
66 $m->form_name('TicketModifyAll');
67 $m->field(WatcherTypeEmail => 'Requestor');
68 $m->field(WatcherAddressEmail => 'root@localhost');
69 $m->click('SubmitTicket');
70 $m->text_contains(
71     "Added principal as a Requestor for this ticket",
72     'watcher is added',
73 );
74 $m->form_name('TicketModifyAll');
75 $m->field(WatcherTypeEmail => 'Requestor');
76 $m->field(WatcherAddressEmail => 'root@localhost');
77 $m->click('SubmitTicket');
78 $m->text_contains(
79     "That principal is already a Requestor for this ticket",
80     'no duplicate watchers',
81 );
82
83 # XXX TODO test other parts, i.e. links