6 use RT::Test tests => 23;
8 my ($baseurl, $agent) = RT::Test->started_ok;
10 my $url = $agent->rt_base_url;
15 is ($agent->status, 200, "Loaded a page");
20 $agent->login('root' => 'password');
21 # the field isn't named, so we have to click link 0
22 is( $agent->status, 200, "Fetched the page ok");
23 $agent->content_contains("Logout", "Found a logout link");
27 $agent->goto_create_ticket(1);
28 is ($agent->status, 200, "Loaded Create.html");
29 $agent->form_name('TicketCreate');
30 my $string = Encode::decode_utf8("I18N Web Testing æøå");
31 $agent->field('Subject' => "Ticket with utf8 body");
32 $agent->field('Content' => $string);
33 ok($agent->submit, "Created new ticket with $string as Content");
34 $agent->content_contains($string, "Found the content");
35 ok($agent->{redirected_uri}, "Did redirection");
38 my $ticket = RT::Test->last_ticket;
39 my $content = $ticket->Transactions->First->Content;
41 $content, qr{$string},
42 'content is there, API check'
48 $agent->goto_create_ticket(1);
49 is ($agent->status, 200, "Loaded Create.html");
50 $agent->form_name('TicketCreate');
52 my $string = Encode::decode_utf8("I18N Web Testing æøå");
53 $agent->field('Subject' => $string);
54 $agent->field('Content' => "Ticket with utf8 subject");
55 ok($agent->submit, "Created new ticket with $string as Content");
56 $agent->content_contains($string, "Found the content");
57 ok($agent->{redirected_uri}, "Did redirection");
60 my $ticket = RT::Test->last_ticket;
62 $ticket->Subject, $string,
63 'subject is correct, API check'
68 # Update time worked in hours
70 $agent->follow_link( text_regex => qr/Basics/ );
71 $agent->submit_form( form_name => 'TicketModify',
72 fields => { TimeWorked => 5, 'TimeWorked-TimeUnits' => "hours" }
75 $agent->content_contains("to '300'", "5 hours is 300 minutes");
80 todo_skip("Need to handle mason trying to compile images",1);
81 $agent->get( $url."NoAuth/images/test.png" );
82 my $file = RT::Test::get_relocatable_file(
84 qw(.. .. share html NoAuth images test.png)
88 length($agent->content),
90 "got a file of the correct size ($file)",
95 # XXX: hey-ho, we have these tests in t/web/query-builder
96 # TODO: move everything about QB there
98 my $response = $agent->get($url."Search/Build.html");
99 ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
105 # set the first value
106 ok($agent->form_name('BuildQuery'));
107 $agent->field("AttachmentField", "Subject");
108 $agent->field("AttachmentOp", "LIKE");
109 $agent->field("ValueOfAttachment", "aaa");
110 $agent->submit("AddClause");
113 ok($agent->form_name('BuildQuery'));
114 $agent->field("AttachmentField", "Subject");
115 $agent->field("AttachmentOp", "LIKE");
116 $agent->field("ValueOfAttachment", "bbb");
117 $agent->submit("AddClause");
119 ok($agent->form_name('BuildQuery'));
122 my $query = $agent->current_form->find_input("Query")->value;
123 # strip whitespace from ends
127 # collapse other whitespace
130 is ($query, "Subject LIKE 'aaa' AND Subject LIKE 'bbb'");