diff options
Diffstat (limited to 't/app/controller/report_new.t')
-rw-r--r-- | t/app/controller/report_new.t | 37 |
1 files changed, 14 insertions, 23 deletions
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 |