diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/alert_new.t | 8 | ||||
-rw-r--r-- | t/app/controller/contact.t | 4 | ||||
-rw-r--r-- | t/app/controller/questionnaire.t | 8 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 37 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 23 |
5 files changed, 38 insertions, 42 deletions
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index 115bb181a..10c4c8ab9 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -132,7 +132,7 @@ foreach my $test ( ok $token->data->{id} == $existing_id, 'subscribed to existing alert'; $mech->get_ok("/A/$url_token"); - $mech->content_contains('successfully confirmed'); + $mech->content_contains('alert created'); $alert = FixMyStreet::App->model('DB::Alert')->find( { id => $existing_id, } ); @@ -370,9 +370,9 @@ subtest "Test normal alert signups and that alerts are sent" => sub { my ( $url, $url_token ) = $email->body =~ m{http://\S+(/A/(\S+))}; my $token = FixMyStreet::App->model('DB::Token')->find( { token => $url_token, scope => 'alert' } ); $mech->get_ok( $url ); - $mech->content_contains('successfully confirmed'); + $mech->content_contains('alert created'); } else { - $mech->content_contains('successfully created'); + $mech->content_contains('alert created'); } } @@ -473,7 +473,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub { ($url) = $emails[0]->body =~ m{http://\S+(/A/\S+)}; $mech->get_ok( $url ); - $mech->content_contains('successfully deleted'); + $mech->content_contains('alert deleted'); $mech->delete_user($user1); $mech->delete_user($user2); diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 89a1db5b2..cf8a3161b 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -259,7 +259,7 @@ for my $test ( $mech->get_ok('/contact'); } $mech->submit_form_ok( { with_fields => $test->{fields} } ); - $mech->content_contains('Thanks for your feedback'); + $mech->content_contains('Thank you for your feedback'); $mech->email_count_is(1); my $email = $mech->get_email; @@ -385,7 +385,7 @@ for my $test ( $mech->clear_emails_ok; $mech->get_ok('/contact'); $mech->submit_form_ok( { with_fields => $test->{fields} } ); - $mech->content_contains('Thanks for your feedback'); + $mech->content_contains('Thank you for your feedback'); $mech->email_count_is(1); } }; diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 752dbb4cb..5938acc79 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -252,13 +252,13 @@ foreach my $test ( # Check the right HTML page has been returned $mech->content_like( qr/<title>[^<]*Questionnaire/m ); - $mech->content_contains( 'glad to hear it’s been fixed' ) + $mech->content_contains( 'Glad to hear' ) if $result =~ /fixed/; - $mech->content_lacks( 'glad to hear it’s been fixed' ) + $mech->content_lacks( 'Glad to hear' ) if $result !~ /fixed/; $mech->content_contains( 'get some more information about the status of your problem' ) if $result eq 'unknown'; - $mech->content_contains( "sorry to hear that" ) + $mech->content_contains( "sorry to hear" ) if $result eq 'confirmed' || $result eq 'closed'; # Check the database has the right information @@ -319,7 +319,7 @@ subtest 'Check updates are shown correctly on questionnaire page' => sub { $mech->content_contains( 'This is some update text' ); }; -for my $test ( +for my $test ( { state => 'confirmed', fixed => 0 diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 67e899102..49ff7b69e 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -750,8 +750,7 @@ subtest "test report creation for a user who is signing in as they report" => su my $report = $user->problems->first; ok $report, "Found the report"; - # check that we got redirected to /report/ - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; + $mech->content_contains('Thank you for reporting this issue'); # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{2651}; @@ -852,8 +851,7 @@ foreach my $test ( # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{$test->{council}}; - # check that we got redirected to /report/ - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; + $mech->content_contains('Thank you for reporting this issue'); # check that no emails have been sent $mech->email_count_is(0); @@ -1227,18 +1225,18 @@ subtest "test Hart" => sub { button => 'submit_register', }, { - desc => 'confirm redirect for cobrand council in two tier cobrand redirects to cobrand site', + desc => 'confirmation page for cobrand council in two tier cobrand links to cobrand site', category => 'Trees', council => 2333, national => 0, - redirect => 1, + confirm => 1, }, { - desc => 'confirm redirect for non cobrand council in two tier cobrand redirect to national site', + desc => 'confirmation page for non cobrand council in two tier cobrand links to national site', category => 'Street Lighting', council => 2227, national => 1, - redirect => 1, + confirm => 1, }, ) { subtest $test->{ desc } => sub { @@ -1247,7 +1245,7 @@ subtest "test Hart" => sub { $mech->clear_emails_ok; $mech->log_out_ok; - my $user = $mech->log_in_ok($test_email) if $test->{redirect}; + my $user = $mech->log_in_ok($test_email) if $test->{confirm}; FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'hart', 'fixmystreet' ], @@ -1258,13 +1256,13 @@ subtest "test Hart" => sub { $mech->content_contains( "Hart Council" ); $mech->submit_form_ok( { with_fields => { pc => 'GU51 4AE' } }, "submit location" ); $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" ); - my %optional_fields = $test->{redirect} ? () : + my %optional_fields = $test->{confirm} ? () : ( email => $test_email, phone => '07903 123 456' ); # we do this as otherwise test::www::mechanize::catalyst # goes to the value set in ->host above irregardless and # that is a 404. It works but it is not pleasant. - $mech->clear_host if $test->{redirect} && $test->{national}; + $mech->clear_host if $test->{confirm} && $test->{national}; $mech->submit_form_ok( { button => $test->{button}, @@ -1295,11 +1293,11 @@ subtest "test Hart" => sub { # Check the report has been assigned appropriately is $report->bodies_str, $body_ids{$test->{council}}; - if ( $test->{redirect} ) { - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; + if ( $test->{confirm} ) { + is $mech->uri->path, "/report/new"; my $base = 'www.fixmystreet.com'; $base = "hart.fixmystreet.com" unless $test->{national}; - is $mech->uri->host, $base, 'redirected to correct site'; + $mech->content_contains("$base/report/" . $report->id, "links to correct site"); } else { # receive token my $email = $mech->get_email; @@ -1454,12 +1452,8 @@ subtest "test SeeSomething" => sub { ok $report->confirmed, 'Report is confirmed automatically'; - if ( $test->{public} ) { - is $mech->uri->path, '/report/' . $report->id, 'redirects to report page'; - } else { - is $mech->uri->path, '/report/new', 'stays on report/new page'; - $mech->content_contains( 'Your report has been sent', 'use report created template' ); - } + is $mech->uri->path, '/report/new', 'stays on report/new page'; + $mech->content_contains( 'Your report has been sent', 'use report created template' ); $user->alerts->delete; $user->problems->delete; @@ -1537,9 +1531,6 @@ subtest "extra google analytics code displayed on logged in problem creation" => my $report = $user->problems->first; ok $report, "Found the report"; - # check that we got redirected to /report/ - is $mech->uri->path, "/report/" . $report->id, "redirected to report page"; - $mech->content_contains( "'id': 'report/" . $report->id . "'", 'extra google code present' ); # cleanup diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 64ed91ac0..58d9eff86 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -457,6 +457,8 @@ for my $test ( }, 'submit update' ); + $mech->content_contains("/report/$report_id"); + $mech->get_ok("/report/$report_id"); $mech->content_contains('Test 2'); $mech->content_contains('Update no email confirm'); @@ -690,6 +692,7 @@ for my $test ( }, 'submit update' ); + $mech->get_ok("/report/$report_id"); $report->discard_changes; my $update = $report->comments->first; @@ -816,6 +819,7 @@ subtest "check comment with no status change has not status in meta" => sub { }, 'submit update' ); + $mech->get_ok("/report/$report_id"); $report->discard_changes; @updates = $report->comments->search(undef, { order_by => 'created' })->all;; @@ -971,7 +975,7 @@ for my $test ( "submit good details" ); - is $mech->uri->path, "/report/" . $report_id, "redirected to report page"; + $mech->content_contains('Thank you for updating this issue'); $mech->email_count_is(0); my $update = $report->comments->first; @@ -1201,7 +1205,9 @@ for my $test ( 'submit update' ); - is $mech->uri->path, "/report/" . $report_id, "redirected to report page"; + $mech->content_contains('Thank you for updating this issue'); + $mech->content_contains("/report/" . $report_id); + $mech->get_ok("/report/" . $report_id); if ( !defined( $test->{endstate_banner} ) ) { is $mech->extract_problem_banner->{text}, undef, 'endstate banner'; @@ -1255,7 +1261,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 0, - path => '/report/update', content => "Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?", }, @@ -1282,7 +1287,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 0, - path => '/report/update', content => "Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?", }, @@ -1310,7 +1314,6 @@ foreach my $test ( alert => 1, # we signed up for alerts before, do not unsign us anonymous => 0, answered => 1, - path => '/report/' . $report->id, content => $report->title, }, ) @@ -1363,7 +1366,7 @@ foreach my $test ( $mech->submit_form_ok( { with_fields => $test->{fields}, }, 'submit update' ); - is $mech->uri->path, $test->{path}, "page after submission"; + is $mech->uri->path, '/report/update', "page after submission"; $mech->content_contains( $test->{content} ); @@ -1393,7 +1396,8 @@ foreach my $test ( $mech->submit_form_ok( { with_fields => { reported => 'Yes' } } ); - $mech->content_contains( 'Thank you — you can' ); + $mech->content_contains( $report->title ); + $mech->content_contains( 'Thank you for updating this issue' ); $questionnaire = FixMyStreet::App->model( 'DB::Questionnaire' )->find( { problem_id => $report_id } @@ -1452,7 +1456,7 @@ for my $test ( anonymous => 0, answered => 1, path => '/report/update', - content => "You have successfully confirmed your update", + content => "Thank you for updating this issue", }, ) { @@ -1542,7 +1546,8 @@ for my $test ( $mech->submit_form_ok( { with_fields => { reported => 'Yes' } } ); - $mech->content_contains( 'Thank you — you can' ); + $mech->content_contains( $report->title ); + $mech->content_contains( 'Thank you for updating this issue' ); $questionnaire = FixMyStreet::App->model( 'DB::Questionnaire' )->find( { problem_id => $report_id } |