From a6525f3b287aa5efe5185768a0f77f5be27aa86c Mon Sep 17 00:00:00 2001 From: Dylan Leard Date: Fri, 8 May 2020 11:02:29 -0700 Subject: [PATCH 1/4] feat(certification): update submit certification request UI --- .../ApplicationWizardConfirmation.tsx | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/app/containers/Applications/ApplicationWizardConfirmation.tsx b/app/containers/Applications/ApplicationWizardConfirmation.tsx index c7670d4f4e..034c8bedf4 100644 --- a/app/containers/Applications/ApplicationWizardConfirmation.tsx +++ b/app/containers/Applications/ApplicationWizardConfirmation.tsx @@ -22,6 +22,9 @@ interface Target extends EventTarget { email: { value: string; }; + sendEmailChecked: { + checked: boolean; + }; } export const ApplicationWizardConfirmationComponent: React.FunctionComponent = ( @@ -45,6 +48,7 @@ export const ApplicationWizardConfirmationComponent: React.FunctionComponent
-
- - - - + Application Certification + + + Once you have reviewed the application and ensured all the data is + correct, the application has to be certified. + + + + + + + + + - - Send URL to certifier - - - - - - -
+ + + + ); @@ -141,20 +156,12 @@ export const ApplicationWizardConfirmationComponent: React.FunctionComponent -
- Thank you for reviewing the application information. You may now send - a generated Certification url to be signed prior to submission. -
- {url ? ( - <> - {copySuccess} {copyUrl} - - ) : ( - generateCertification - )} + {copySuccess} {copyUrl} + ) : ( + generateCertification ); } else if ( !revision.certificationUrl.certificationSignature && From 3fcac3d80aa82f4339f74be1e68a5fc6eb4c5d5c Mon Sep 17 00:00:00 2001 From: Dylan Leard Date: Fri, 8 May 2020 11:24:18 -0700 Subject: [PATCH 2/4] feat(certification)\!: add 'send_certification_email' boolean to certification_url table & update trigger to use it --- .../ApplicationWizardConfirmation.tsx | 5 +- app/server/schema.graphql | 52 ++++-- app/server/schema.json | 156 ++++++++++++------ schema/deploy/tables/certification_url.sql | 10 +- .../run_graphile_worker_job.sql | 63 +++---- schema/verify/tables/certification_url.sql | 2 +- 6 files changed, 186 insertions(+), 102 deletions(-) diff --git a/app/containers/Applications/ApplicationWizardConfirmation.tsx b/app/containers/Applications/ApplicationWizardConfirmation.tsx index 034c8bedf4..66590a52d3 100644 --- a/app/containers/Applications/ApplicationWizardConfirmation.tsx +++ b/app/containers/Applications/ApplicationWizardConfirmation.tsx @@ -48,7 +48,7 @@ export const ApplicationWizardConfirmationComponent: React.FunctionComponent Date: Fri, 8 May 2020 11:48:15 -0700 Subject: [PATCH 3/4] test(certification): add pgTap tests to check that the modified trigger behaves appropriately --- .../ApplicationWizardConfirmation.tsx | 2 +- .../unit/tables/certification_url_test.sql | 25 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/containers/Applications/ApplicationWizardConfirmation.tsx b/app/containers/Applications/ApplicationWizardConfirmation.tsx index 66590a52d3..5be716e527 100644 --- a/app/containers/Applications/ApplicationWizardConfirmation.tsx +++ b/app/containers/Applications/ApplicationWizardConfirmation.tsx @@ -85,7 +85,7 @@ export const ApplicationWizardConfirmationComponent: React.FunctionComponent Date: Fri, 8 May 2020 14:00:17 -0700 Subject: [PATCH 4/4] test(certification): Update jest/cypress tests & snapshots --- app/cypress/integration/email.spec.js | 6 +- .../reporter-access-all-pages.spec.js | 2 +- .../ApplicationWizardConfirmation.test.tsx | 12 +- ...pplicationWizardConfirmation.test.tsx.snap | 213 +++++++++++++++--- 4 files changed, 197 insertions(+), 36 deletions(-) diff --git a/app/cypress/integration/email.spec.js b/app/cypress/integration/email.spec.js index a332d4926e..398d9b4687 100644 --- a/app/cypress/integration/email.spec.js +++ b/app/cypress/integration/email.spec.js @@ -49,7 +49,8 @@ if (Cypress.env('NO_MAIL')) { ); cy.url().should('include', '/reporter/ciip-application'); cy.get('#certifierEmail').clear().type('certifier@certi.fy'); - cy.get('.btn').contains('Send to Certifier').click(); + cy.get('.form-check-input').click(); + cy.get('.btn').contains('Submit for Certification').click(); cy.wait(1000); cy.request('localhost:8025/api/v1/messages').then((response) => { // eslint-disable-next-line jest/valid-expect @@ -84,7 +85,8 @@ if (Cypress.env('NO_MAIL')) { ); cy.url().should('include', '/reporter/ciip-application'); cy.get('#certifierEmail').clear().type('certifier@certi.fy'); - cy.get('.btn').contains('Send to Certifier').click(); + cy.get('.form-check-input').click(); + cy.get('.btn').contains('Submit for Certification').click(); cy.wait(500); cy.request('DELETE', 'localhost:8025/api/v1/messages'); cy.get('input') diff --git a/app/cypress/integration/reporter-access-all-pages.spec.js b/app/cypress/integration/reporter-access-all-pages.spec.js index c17664733e..3bf87446ae 100644 --- a/app/cypress/integration/reporter-access-all-pages.spec.js +++ b/app/cypress/integration/reporter-access-all-pages.spec.js @@ -29,7 +29,7 @@ describe('When logged in as a reporter', () => { `/reporter/ciip-application?applicationId=${applicationId}&confirmationPage=true&version=1` ); cy.url().should('include', '/reporter/ciip-application'); - cy.get('.btn').contains('Send to Certifier').click(); + cy.get('.btn').contains('Submit for Certification').click(); cy.wait(500); // Wait for half second (otherwise cypress gets the input before the value has been set) cy.get('input').invoke('val').should('contain', 'localhost'); cy.get('input') diff --git a/app/tests/unit/containers/Applications/ApplicationWizardConfirmation.test.tsx b/app/tests/unit/containers/Applications/ApplicationWizardConfirmation.test.tsx index e9599639ec..71a06417da 100644 --- a/app/tests/unit/containers/Applications/ApplicationWizardConfirmation.test.tsx +++ b/app/tests/unit/containers/Applications/ApplicationWizardConfirmation.test.tsx @@ -58,10 +58,12 @@ describe('The Confirmation Component', () => { relay={null} /> ); - expect(wrapper.find('h5').at(1).text()).toBe( - 'Thank you for reviewing the application information. You may now send a generated Certification url to be signed prior to submission.' + expect(wrapper.find('CardHeader').at(0).text()).toBe( + 'Application Certification' + ); + expect(wrapper.find('Button').at(0).text()).toBe( + 'Submit for Certification' ); - expect(wrapper.find('Button').at(0).text()).toBe('Send to Certifier'); }); it('should show the Submit application dialog when certificationSignatureIsvalid is true', () => { @@ -127,7 +129,9 @@ describe('The Confirmation Component', () => { relay={null} /> ); - expect(wrapper.find('CardHeader').text()).toBe('Error'); + + expect(wrapper.find('CardHeader').at(0).text()).toBe('Error'); + expect(wrapper).toMatchSnapshot(); }); it('should show a certifier has not yet signed message when hashMatches is true but certificationSignature is null', () => { diff --git a/app/tests/unit/containers/Applications/__snapshots__/ApplicationWizardConfirmation.test.tsx.snap b/app/tests/unit/containers/Applications/__snapshots__/ApplicationWizardConfirmation.test.tsx.snap index 13b88644fa..6b51988f0c 100644 --- a/app/tests/unit/containers/Applications/__snapshots__/ApplicationWizardConfirmation.test.tsx.snap +++ b/app/tests/unit/containers/Applications/__snapshots__/ApplicationWizardConfirmation.test.tsx.snap @@ -47,47 +47,202 @@ exports[`The Confirmation Component match the snapshot 1`] = `
-
- Thank you for reviewing the application information. You may now send a generated Certification url to be signed prior to submission. -

-
- - + Application Certification + + + + Once you have reviewed the application and ensured all the data is correct, the application has to be certified. + + - - - + - Send URL to certifier - + + + + + - - + Submit for Certification + +
+ + + + + .errors{margin-left:20px;padding:20px;background:#ce5c5c;color:white;font-size:20px;} + + +`; + +exports[`The Confirmation Component should show a "data has changed" dialogue when hashMatches is false but a signature exists 1`] = ` + +

+ Summary of your application: +

+
+ Please review the information you have provided before continuing. +
+
+ +
+ + + Error + + + + The data has changed + + + The application data has been changed since the certifier added their signature. + + + Please generate and send a new certification URL. + + + + +
+ + + Application Certification + + + + Once you have reviewed the application and ensured all the data is correct, the application has to be certified. + +
+ + + + + + + + - - -
+ +
+ +