Skip to content

Commit

Permalink
Report PDF upload Cypress test (#1864)
Browse files Browse the repository at this point in the history
Closes #1580

In this PR:
Adding steps to the full-submission test to include the audit report PDF upload
Removing the disabling of the upload button, since incomplete forms are already handled and it messed with the Cypress test

Testing: Cypress tests should pass and PDF uploading should still work locally.

---------

Co-authored-by: Phil Dominguez <“[email protected]”>
  • Loading branch information
phildominguez-gsa and Phil Dominguez authored Aug 18, 2023
1 parent 492a7b5 commit 372aaed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
3 changes: 1 addition & 2 deletions backend/audit/templates/audit/upload-report.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ <h4 class="usa-process-list__heading">Upload your PDF</h4>
<span class="usa-error-message tablet:grid-col-12">{{ form.errors.upload_report }}</span>
</li>
</fieldset>
<button class="usa-button margin-bottom-8 margin-top-4" id="continue" disabled="disabled">Upload Single Audit Package</button>
<button class="usa-button margin-bottom-8 margin-top-4" id="continue">Upload Single Audit Package</button>
</form>
</ol>
</div>
</div>
{% include "audit-metadata.html" %}
<script src="{% static 'compiled/js/upload-report-pdf.js' %}"></script>
{% endblock content %}
10 changes: 7 additions & 3 deletions backend/cypress/e2e/full-submission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { testValidAccess } from '../support/check-access.js';
import { testValidEligibility } from '../support/check-eligibility.js';
import { testValidAuditeeInfo } from '../support/auditee-info.js';
import { testValidGeneralInfo } from '../support/general-info.js';
import { testAuditInformationForm } from '../support/audit-info-form.js';
import { testPdfAuditReport } from '../support/report-pdf.js';
import { testWorkbookFederalAwards,
testWorkbookFindingsUniformGuidance,
testWorkbookFindingsText,
testWorkbookCorrectiveActionPlan,
testWorkbookAdditionalUEIs } from '../support/workbook-uploads.js'
import { testAuditInformationForm } from '../support/audit-info-form.js'
testWorkbookAdditionalUEIs } from '../support/workbook-uploads.js';

describe('Full audit submission', () => {
before(() => {
Expand Down Expand Up @@ -48,7 +49,10 @@ describe('Full audit submission', () => {

// Upload all the workbooks. Don't intercept the uploads, which means a file will make it into the DB.
cy.get(".usa-link").contains("Federal Awards").click();
testWorkbookFederalAwards(false);
testWorkbookFederalAwards(false);

cy.get(".usa-link").contains("Audit report PDF").click();
testPdfAuditReport(false);

cy.get(".usa-link").contains("Federal Awards Audit Findings").click();
testWorkbookFindingsUniformGuidance(false);
Expand Down
Binary file added backend/cypress/fixtures/basic.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions backend/cypress/support/report-pdf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export function testPdfAuditReport() {
cy.get('#financial_statements').type(1);
cy.get('#financial_statements_opinion').type(1);
cy.get('#schedule_expenditures').type(1);
cy.get('#schedule_expenditures_opinion').type(1);
cy.get('#uniform_guidance_control').type(1);
cy.get('#uniform_guidance_compliance').type(1);
cy.get('#GAS_control').type(1);
cy.get('#GAS_compliance').type(1);
cy.get('#schedule_findings').type(1);
cy.get('#schedule_prior_findings').type(1);
cy.get('#CAP_page').type(1);

cy.get('#upload_report').selectFile('cypress/fixtures/basic.pdf');
cy.get('#continue').click(); // Performs upload and return to main page
}

0 comments on commit 372aaed

Please sign in to comment.