7 use RT::Test tests => 23;
9 my ($baseurl, $agent) = RT::Test->started_ok;
11 my $url = $agent->rt_base_url;
16 is ($agent->status, 200, "Loaded a page");
21 $agent->login('root' => 'password');
22 # the field isn't named, so we have to click link 0
23 is( $agent->status, 200, "Fetched the page ok");
24 $agent->content_contains("Logout", "Found a logout link");
28 $agent->goto_create_ticket(1);
29 is ($agent->status, 200, "Loaded Create.html");
30 $agent->form_name('TicketCreate');
31 my $string = Encode::decode_utf8("I18N Web Testing æøå");
32 $agent->field('Subject' => "Ticket with utf8 body");
33 $agent->field('Content' => $string);
34 ok($agent->submit, "Created new ticket with $string as Content");
35 $agent->content_contains($string, "Found the content");
36 ok($agent->{redirected_uri}, "Did redirection");
39 my $ticket = RT::Test->last_ticket;
40 my $content = $ticket->Transactions->First->Content;
42 $content, qr{$string},
43 'content is there, API check'
49 $agent->goto_create_ticket(1);
50 is ($agent->status, 200, "Loaded Create.html");
51 $agent->form_name('TicketCreate');
53 my $string = Encode::decode_utf8("I18N Web Testing æøå");
54 $agent->field('Subject' => $string);
55 $agent->field('Content' => "Ticket with utf8 subject");
56 ok($agent->submit, "Created new ticket with $string as Content");
57 $agent->content_contains($string, "Found the content");
58 ok($agent->{redirected_uri}, "Did redirection");
61 my $ticket = RT::Test->last_ticket;
63 $ticket->Subject, $string,
64 'subject is correct, API check'
69 # Update time worked in hours
71 $agent->follow_link( text_regex => qr/Basics/ );
72 $agent->submit_form( form_name => 'TicketModify',
73 fields => { TimeWorked => 5, 'TimeWorked-TimeUnits' => "hours" }
76 $agent->content_contains("to '300'", "5 hours is 300 minutes");
81 todo_skip("Need to handle mason trying to compile images",1);
82 $agent->get( $url."NoAuth/images/test.png" );
83 my $file = RT::Test::get_relocatable_file(
85 qw(.. .. share html NoAuth images test.png)
89 length($agent->content),
91 "got a file of the correct size ($file)",
96 # XXX: hey-ho, we have these tests in t/web/query-builder
97 # TODO: move everything about QB there
99 my $response = $agent->get($url."Search/Build.html");
100 ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
106 # set the first value
107 ok($agent->form_name('BuildQuery'));
108 $agent->field("AttachmentField", "Subject");
109 $agent->field("AttachmentOp", "LIKE");
110 $agent->field("ValueOfAttachment", "aaa");
111 $agent->submit("AddClause");
114 ok($agent->form_name('BuildQuery'));
115 $agent->field("AttachmentField", "Subject");
116 $agent->field("AttachmentOp", "LIKE");
117 $agent->field("ValueOfAttachment", "bbb");
118 $agent->submit("AddClause");
120 ok($agent->form_name('BuildQuery'));
123 my $query = $agent->current_form->find_input("Query")->value;
124 # strip whitespace from ends
128 # collapse other whitespace
131 is ($query, "Subject LIKE 'aaa' AND Subject LIKE 'bbb'");