diff --git a/web-client/e2e/journey/petitionsClerkCreatesNewCase.js b/web-client/e2e/journey/petitionsClerkCreatesNewCase.js index 888075c83f6..f140d87979b 100644 --- a/web-client/e2e/journey/petitionsClerkCreatesNewCase.js +++ b/web-client/e2e/journey/petitionsClerkCreatesNewCase.js @@ -56,13 +56,8 @@ export default (test, fakeFile) => { expect(test.getState('alertError')).toEqual(null); expect(test.getState('validationErrors')).toEqual({}); - // await test.runSequence('submitPetitionFromPaperSequence'); - - // expect(test.getState('alertError')).toEqual(null); + await test.runSequence('submitPetitionFromPaperSequence'); - // expect(test.getState('alertSuccess')).toEqual({ - // message: 'You can access your case at any time from the case list below.', - // title: 'Your petition has been successfully submitted.', - // }); + expect(test.getState('currentPage')).toEqual('DocumentDetail'); }); }; diff --git a/web-client/src/presenter/actions/setPetitionIdAction.js b/web-client/src/presenter/actions/setPetitionIdAction.js new file mode 100644 index 00000000000..ef3785b2df9 --- /dev/null +++ b/web-client/src/presenter/actions/setPetitionIdAction.js @@ -0,0 +1,19 @@ +import _ from 'lodash'; + +/** + * sets the docketNumber and petition documentId which is used for routing to the newly created case. + * + * @param {Object} providers the providers object + * @param {Object} providers.props the cerebral props object containing the props.caseDetail + */ +export const setPetitionIdAction = ({ props }) => { + const docketNumber = props.caseDetail.docketNumber; + const documentId = _.find(props.caseDetail.documents, { + documentType: 'Petition', + }).documentId; + + return { + docketNumber, + documentId, + }; +}; diff --git a/web-client/src/presenter/sequences/submitPetitionFromPaperSequence.js b/web-client/src/presenter/sequences/submitPetitionFromPaperSequence.js index cfa1a6311a9..3546ffea187 100644 --- a/web-client/src/presenter/sequences/submitPetitionFromPaperSequence.js +++ b/web-client/src/presenter/sequences/submitPetitionFromPaperSequence.js @@ -4,16 +4,15 @@ import { set } from 'cerebral/factories'; import { clearAlertsAction } from '../actions/clearAlertsAction'; import { computeFormDateAction } from '../actions/computeFormDateAction'; import { createCaseFromPaperAction } from '../actions/createCaseFromPaperAction'; -import { getCreateCaseAlertSuccessAction } from '../actions/getCreateCaseAlertSuccessAction'; -import { navigateToDashboardAction } from '../actions/navigateToDashboardAction'; import { setAlertErrorAction } from '../actions/setAlertErrorAction'; -import { setAlertSuccessAction } from '../actions/setAlertSuccessAction'; import { setCaseAction } from '../actions/setCaseAction'; import { setFormSubmittingAction } from '../actions/setFormSubmittingAction'; +import { setPetitionIdAction } from '../actions/setPetitionIdAction'; import { setValidationAlertErrorsAction } from '../actions/setValidationAlertErrorsAction'; import { setValidationErrorsAction } from '../actions/setValidationErrorsAction'; import { unsetFormSubmittingAction } from '../actions/unsetFormSubmittingAction'; import { validatePetitionFromPaperAction } from '../actions/validatePetitionFromPaperAction'; +import { gotoDocumentDetailSequence } from '../sequences/gotoDocumentDetailSequence'; export const submitPetitionFromPaperSequence = [ clearAlertsAction, @@ -32,10 +31,9 @@ export const submitPetitionFromPaperSequence = [ setFormSubmittingAction, createCaseFromPaperAction, setCaseAction, - getCreateCaseAlertSuccessAction, - setAlertSuccessAction, + setPetitionIdAction, unsetFormSubmittingAction, - navigateToDashboardAction, + ...gotoDocumentDetailSequence, ], }, ];