diff options
Diffstat (limited to 'rt/t/web')
-rw-r--r-- | rt/t/web/cf_access.t | 12 | ||||
-rw-r--r-- | rt/t/web/cf_onqueue.t | 11 | ||||
-rw-r--r-- | rt/t/web/cf_select_one.t | 4 | ||||
-rw-r--r-- | rt/t/web/custom_frontpage.t | 2 | ||||
-rw-r--r-- | rt/t/web/dashboards.t | 8 | ||||
-rw-r--r-- | rt/t/web/search_rss.t | 74 | ||||
-rw-r--r-- | rt/t/web/ticket-create-utf8.t | 94 |
7 files changed, 143 insertions, 62 deletions
diff --git a/rt/t/web/cf_access.t b/rt/t/web/cf_access.t index 1022c6da6..183597b4a 100644 --- a/rt/t/web/cf_access.t +++ b/rt/t/web/cf_access.t @@ -43,16 +43,14 @@ my ( $cf, $cfid, $tid ); $m->form_name('EditCustomFields'); # Sort by numeric IDs in names - my @names = map { $_->[1] } - sort { $a->[0] <=> $b->[0] } - map { /Object-1-CF-(\d+)/ ? [ $1 => $_ ] : () } - grep defined, map $_->name, $m->current_form->inputs; + my @names = sort grep defined, + $m->current_form->find_input('AddCustomField')->possible_values; $cf = pop(@names); $cf =~ /(\d+)$/ or die "Hey this is impossible dude"; $cfid = $1; - $m->field( $cf => 1 ); # Associate the new CF with this queue - $m->field( $_ => undef ) for @names; # ...and not any other. ;-) - $m->submit; + $m->tick( AddCustomField => $cf => 1 ); # Associate the new CF with this queue + $m->tick( AddCustomField => $_ => 0 ) for @names; # ...and not any other. ;-) + $m->click('UpdateCFs'); $m->content_like( qr/Object created/, 'TCF added to the queue' ); } diff --git a/rt/t/web/cf_onqueue.t b/rt/t/web/cf_onqueue.t index dcd585277..bed4dd188 100644 --- a/rt/t/web/cf_onqueue.t +++ b/rt/t/web/cf_onqueue.t @@ -34,12 +34,11 @@ diag "Apply the new CF globally" if $ENV{'TEST_VERBOSE'}; $m->follow_link( url => 'Queues.html' ); $m->title_is(q/Edit Custom Fields for all queues/, 'global custom field for all queues configuration screen'); $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on page' ); - $m->submit_form( - form_name => "EditCustomFields", - fields => { - 'Object--CF-1' => '1', - }, - ); + + $m->form_name('EditCustomFields'); + $m->tick( AddCustomField => 1 ); + $m->click('UpdateCFs'); + $m->content_like( qr/Object created/, 'CF QueueCFTest enabled globally' ); } diff --git a/rt/t/web/cf_select_one.t b/rt/t/web/cf_select_one.t index e009af7cf..39a808083 100644 --- a/rt/t/web/cf_select_one.t +++ b/rt/t/web/cf_select_one.t @@ -58,8 +58,8 @@ diag "apply the CF to General queue" if $ENV{'TEST_VERBOSE'}; $m->title_is(q/Edit Custom Fields for General/, 'admin-queue: general cfid'); $m->form_name('EditCustomFields'); - $m->field( "Object-". $queue->id ."-CF-$cfid" => 1 ); - $m->submit; + $m->tick( "AddCustomField" => $cfid ); + $m->click('UpdateCFs'); $m->content_like( qr/Object created/, 'TCF added to the queue' ); } diff --git a/rt/t/web/custom_frontpage.t b/rt/t/web/custom_frontpage.t index 45a390ab0..79ea56629 100644 --- a/rt/t/web/custom_frontpage.t +++ b/rt/t/web/custom_frontpage.t @@ -13,7 +13,7 @@ $user_obj->SetName('customer'); $user_obj->SetPrivileged(1); ($ret, $msg) = $user_obj->SetPassword('customer'); $user_obj->PrincipalObj->GrantRight(Right => 'LoadSavedSearch'); -$user_obj->PrincipalObj->GrantRight(Right => 'EditSavedSearch'); +$user_obj->PrincipalObj->GrantRight(Right => 'EditSavedSearches'); $user_obj->PrincipalObj->GrantRight(Right => 'CreateSavedSearch'); $user_obj->PrincipalObj->GrantRight(Right => 'ModifySelf'); diff --git a/rt/t/web/dashboards.t b/rt/t/web/dashboards.t index 9d98ce6e4..a816eb35c 100644 --- a/rt/t/web/dashboards.t +++ b/rt/t/web/dashboards.t @@ -133,14 +133,14 @@ $ticket->Create( ); $m->follow_link_ok({text => 'different dashboard'}); -$m->content_contains("20 highest priority tickets I own"); -$m->content_contains("20 newest unowned tickets"); +$m->content_contains("50 highest priority tickets I own"); +$m->content_contains("50 newest unowned tickets"); $m->content_lacks("Bookmarked Tickets"); $m->content_contains("dashboard test", "ticket subject"); $m->get_ok("/Dashboards/$id/This fragment left intentionally blank"); -$m->content_contains("20 highest priority tickets I own"); -$m->content_contains("20 newest unowned tickets"); +$m->content_contains("50 highest priority tickets I own"); +$m->content_contains("50 newest unowned tickets"); $m->content_lacks("Bookmarked Tickets"); $m->content_contains("dashboard test", "ticket subject"); diff --git a/rt/t/web/search_rss.t b/rt/t/web/search_rss.t new file mode 100644 index 000000000..454dc0369 --- /dev/null +++ b/rt/t/web/search_rss.t @@ -0,0 +1,74 @@ +#!/usr/bin/perl + +use strict; + +use RT::Test tests => 36; +RT::Test->started_ok; + +my $ticket = RT::Ticket->new($RT::SystemUser); +for ( 1 .. 5 ) { + $ticket->Create( + Subject => 'Ticket ' . $_, + Queue => 'General', + Owner => 'root', + Requestor => 'rss@localhost', + ); +} + +my $agent = RT::Test::Web->new; +ok $agent->login('root', 'password'), 'logged in as root'; + +$agent->get_ok('/Search/Build.html'); +$agent->form_name('BuildQuery'); +$agent->field('idOp', '>'); +$agent->field('ValueOfid', '0'); +$agent->submit('DoSearch'); +$agent->follow_link_ok({text=>'Show Results'}); + +for ( 1 .. 5 ) { + $agent->content_contains('Ticket ' . $_); +} +my $rdf_path = $agent->uri->path_query; +$rdf_path =~ s!Results\.html!Results.rdf!; + +$agent->follow_link_ok( { text => 'RSS' } ); +my $noauth_uri = $agent->uri; +is( $agent->content_type, 'application/rss+xml', 'content type' ); +for ( 1 .. 5 ) { + $agent->content_contains('Ticket ' . $_); +} +my $rss_content = $agent->content; +$agent->get_ok($rdf_path); +is($agent->content, $rss_content, 'old Results.rdf still works'); + +SKIP: { + eval { require XML::Simple; }; + skip 'no XML::Simple found', 6 if $@; + my $rss = XML::Simple::XMLin( $rss_content ); + is( scalar @{ $rss->{item} }, 5, 'item number' ); + for ( 1 .. 5 ) { + is( $rss->{item}[$_-1]{title}, 'Ticket ' . $_, 'title' . $_ ); + } +} + +# not login at all +my $agent_b = RT::Test::Web->new; +$agent_b->get_ok($noauth_uri); +is( $agent_b->content_type, 'application/rss+xml', 'content type' ); +is( $agent_b->content, $rss_content, 'content' ); +$agent_b->get_ok('/', 'back to homepage'); +$agent_b->content_lacks( 'Logout', 'still not login' ); + +# lets login as another user +my $user_b = RT::Test->load_or_create_user( + Name => 'user_b', Password => 'password', +); +ok $user_b && $user_b->id, 'loaded or created user'; +$agent_b->login('user_b', 'password'), 'logged in as user B'; +$agent_b->get_ok($noauth_uri); +is( $agent_b->content_type, 'application/rss+xml', 'content type' ); +is( $agent_b->content, $rss_content, 'content' ); +$agent_b->get_ok('/', 'back to homepage'); +$agent_b->content_contains( 'Logout', 'still loggedin' ); +$agent_b->content_contains( 'user_b', 'still loggedin as user_b' ); + diff --git a/rt/t/web/ticket-create-utf8.t b/rt/t/web/ticket-create-utf8.t index a4d7ae98d..f37eeec06 100644 --- a/rt/t/web/ticket-create-utf8.t +++ b/rt/t/web/ticket-create-utf8.t @@ -3,16 +3,21 @@ use strict; use warnings; -use RT::Test tests => 14; +use RT::Test tests => 41; $RT::Test::SKIP_REQUEST_WORK_AROUND = 1; use Encode; my $ru_test = "\x{442}\x{435}\x{441}\x{442}"; -my $ru_autoreply = "\x{410}\x{432}\x{442}\x{43e}\x{43e}\x{442}\x{432}\x{435}\x{442}"; my $ru_support = "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}"; +# latin-1 is very special in perl, we should test everything with latin-1 umlauts +# and not-ascii+not-latin1, for example cyrillic +my $l1_test = Encode::decode('latin-1', "t\xE9st"); +my $l1_support = Encode::decode('latin-1', "supp\xF6rt"); + + my $q = RT::Test->load_or_create_queue( Name => 'Regression' ); ok $q && $q->id, 'loaded or created queue'; @@ -25,59 +30,64 @@ my ($baseurl, $m) = RT::Test->started_ok; ok $m->login, 'logged in'; # create a ticket with a subject only -{ +foreach my $test_str ( $ru_test, $l1_test ) { ok $m->goto_create_ticket( $q ), "go to create ticket"; $m->form_number(3); - $m->field( Subject => $ru_test ); + $m->field( Subject => $test_str ); $m->submit; $m->content_like( - qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i, + qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i, 'header on the page' ); my $ticket = RT::Test->last_ticket; - is $ticket->Subject, $ru_test, "correct subject"; + is $ticket->Subject, $test_str, "correct subject"; } # create a ticket with a subject and content -{ - ok $m->goto_create_ticket( $q ), "go to create ticket"; - $m->form_number(3); - $m->field( Subject => $ru_test ); - $m->field( Content => $ru_support ); - $m->submit; - - $m->content_like( - qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i, - 'header on the page' - ); - $m->content_like( - qr{\Q$ru_support\E}i, - 'content on the page' - ); - - my $ticket = RT::Test->last_ticket; - is $ticket->Subject, $ru_test, "correct subject"; +foreach my $test_str ( $ru_test, $l1_test ) { + foreach my $support_str ( $ru_support, $l1_support ) { + ok $m->goto_create_ticket( $q ), "go to create ticket"; + $m->form_number(3); + $m->field( Subject => $test_str ); + $m->field( Content => $support_str ); + $m->submit; + + $m->content_like( + qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i, + 'header on the page' + ); + $m->content_like( + qr{\Q$support_str\E}i, + 'content on the page' + ); + + my $ticket = RT::Test->last_ticket; + is $ticket->Subject, $test_str, "correct subject"; + } } # create a ticket with a subject and content -{ - ok $m->goto_create_ticket( $q ), "go to create ticket"; - $m->form_number(3); - $m->field( Subject => $ru_test ); - $m->field( Content => $ru_support ); - $m->submit; - - $m->content_like( - qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i, - 'header on the page' - ); - $m->content_like( - qr{\Q$ru_support\E}i, - 'content on the page' - ); - - my $ticket = RT::Test->last_ticket; - is $ticket->Subject, $ru_test, "correct subject"; +foreach my $test_str ( $ru_test, $l1_test ) { + foreach my $support_str ( $ru_support, $l1_support ) { + ok $m->goto_create_ticket( $q ), "go to create ticket"; + $m->form_number(3); + $m->field( Subject => $test_str ); + $m->field( Content => $support_str ); + $m->submit; + + $m->content_like( + qr{<td\s+class="message-header-value"[^>]*>\s*\Q$test_str\E\s*</td>}i, + 'header on the page' + ); + $m->content_like( + qr{\Q$support_str\E}i, + 'content on the page' + ); + + my $ticket = RT::Test->last_ticket; + is $ticket->Subject, $test_str, "correct subject"; + } } + |