5 use RT::Test tests => 23;
7 my ($baseurl, $agent) = RT::Test->started_ok;
9 my $url = $agent->rt_base_url;
14 is ($agent->status, 200, "Loaded a page");
19 $agent->login('root' => 'password');
20 # the field isn't named, so we have to click link 0
21 is( $agent->status, 200, "Fetched the page ok");
22 $agent->content_contains("Logout", "Found a logout link");
26 $agent->goto_create_ticket(1);
27 is ($agent->status, 200, "Loaded Create.html");
28 $agent->form_name('TicketCreate');
29 my $string = Encode::decode("UTF-8","I18N Web Testing æøå");
30 $agent->field('Subject' => "Ticket with utf8 body");
31 $agent->field('Content' => $string);
32 ok($agent->submit, "Created new ticket with $string as Content");
33 $agent->content_contains($string, "Found the content");
34 ok($agent->{redirected_uri}, "Did redirection");
37 my $ticket = RT::Test->last_ticket;
38 my $content = $ticket->Transactions->First->Content;
40 $content, qr{$string},
41 'content is there, API check'
47 $agent->goto_create_ticket(1);
48 is ($agent->status, 200, "Loaded Create.html");
49 $agent->form_name('TicketCreate');
51 my $string = Encode::decode( "UTF-8","I18N Web Testing æøå");
52 $agent->field('Subject' => $string);
53 $agent->field('Content' => "Ticket with utf8 subject");
54 ok($agent->submit, "Created new ticket with $string as Content");
55 $agent->content_contains($string, "Found the content");
56 ok($agent->{redirected_uri}, "Did redirection");
59 my $ticket = RT::Test->last_ticket;
61 $ticket->Subject, $string,
62 'subject is correct, API check'
67 # Update time worked in hours
69 $agent->follow_link( text_regex => qr/Basics/ );
70 $agent->submit_form( form_name => 'TicketModify',
71 fields => { TimeWorked => 5, 'TimeWorked-TimeUnits' => "hours" }
74 $agent->content_contains("to '300'", "5 hours is 300 minutes");
79 todo_skip("Need to handle mason trying to compile images",1);
80 $agent->get( $url."NoAuth/images/test.png" );
81 my $file = RT::Test::get_relocatable_file(
83 qw(.. .. share html NoAuth images test.png)
87 length($agent->content),
89 "got a file of the correct size ($file)",
94 # XXX: hey-ho, we have these tests in t/web/query-builder
95 # TODO: move everything about QB there
97 my $response = $agent->get($url."Search/Build.html");
98 ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
104 # set the first value
105 ok($agent->form_name('BuildQuery'));
106 $agent->field("AttachmentField", "Subject");
107 $agent->field("AttachmentOp", "LIKE");
108 $agent->field("ValueOfAttachment", "aaa");
109 $agent->submit("AddClause");
112 ok($agent->form_name('BuildQuery'));
113 $agent->field("AttachmentField", "Subject");
114 $agent->field("AttachmentOp", "LIKE");
115 $agent->field("ValueOfAttachment", "bbb");
116 $agent->submit("AddClause");
118 ok($agent->form_name('BuildQuery'));
121 my $query = $agent->current_form->find_input("Query")->value;
122 # strip whitespace from ends
126 # collapse other whitespace
129 is ($query, "Subject LIKE 'aaa' AND Subject LIKE 'bbb'");