From 1c07eca3d6e8cea5d70c043de02d30bd7cdc5630 Mon Sep 17 00:00:00 2001 From: pezholio Date: Tue, 7 Feb 2017 16:17:15 +0000 Subject: Redirect to report for inspectors --- t/app/controller/report_new.t | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 't/app/controller') diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 71090cd26..f3bee0513 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -1635,6 +1635,48 @@ subtest "extra google analytics code displayed on email confirmation problem cre }; }; +subtest "inspectors get redirected directly to the report page" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { fixmystreet => '.' } ], + BASE_URL => 'https://www.fixmystreet.com', + MAPIT_URL => 'http://mapit.mysociety.org/', + }, sub { + $mech->log_out_ok; + + my $user = $mech->create_user_ok('inspector@example.org', name => 'inspector', from_body => $bodies[0]); + $user->user_body_permissions->find_or_create({ + body => $bodies[0], + permission_type => 'planned_reports', + }); + + $mech->log_in_ok('inspector@example.org'); + $mech->get_ok('/'); + $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR' } }, + "submit location" ); + $mech->follow_link_ok( + { text_regex => qr/skip this step/i, }, + "follow 'skip this step' link" + ); + + $mech->submit_form_ok( + { + with_fields => { + title => "Inspector report", + detail => 'Inspector report details.', + photo1 => '', + name => 'Joe Bloggs', + may_show_name => '1', + phone => '07903 123 456', + category => 'Trees', + } + }, + "submit good details" + ); + + like $mech->uri->path, qr/\/report\/[0-9]+/, 'Redirects directly to report'; + } +}; + done_testing(); END { -- cgit v1.2.3