@@ -259,14 +259,14 @@ sub create_incident_and_investigation {
259259
260260 local $Test::Builder::Level = $Test::Builder::Level + 1;
261261
262- if ($ir_id ) {
263- $self -> display_ticket( $ir_id );
262+ if ($ir_id ) {
263+ $self -> display_ticket($ir_id );
264+
264265 # Select the "New" link from the Display page
265- $self -> follow_link_ok({ text => " New " }, " Followed 'New (Incident)' link" );
266+ $self -> follow_link_ok( { id => " create-incident " }, " Followed 'New (Incident)' link" );
266267 }
267- else
268- {
269- $self -> goto_create_rtir_ticket(' Incidents' .($constituency ?' - ' .$constituency : ' ' ));
268+ else {
269+ $self -> goto_create_rtir_ticket( ' Incidents' . ( $constituency ? ' - ' . $constituency : ' ' ) );
270270 }
271271
272272 # Fill out forms
@@ -277,9 +277,17 @@ sub create_incident_and_investigation {
277277 }
278278
279279 while (my ($f , $v ) = each %$cfs ) {
280- $self -> set_custom_field( ' Incidents' .($constituency ? ' - ' .$constituency :' ' ), $f , $v );
280+ if ( $f =~ s ! Investigation!! ) {
281+ my $field_name
282+ = $self -> custom_field_input( ' Investigations' . ( $constituency ? ' - ' . $constituency : ' ' ), $f )
283+ or next ;
284+ $self -> field( " Investigation$field_name " , $v );
285+ }
286+ else {
287+ $self -> set_custom_field( ' Incidents' .($constituency ? ' - ' .$constituency :' ' ), $f , $v );
288+ }
281289 }
282- $self -> click(" CreateWithInvestigation " );
290+ $self -> click(" InvestigationSubmitTicket " );
283291 my $msg = $ir_id
284292 ? " Attempting to create new incident and investigation linked to child $ir_id "
285293 : " Attempting to create new incident and investigation" ;
0 commit comments