diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml index d8f96ae0dc..7a79f83ad1 100644 --- a/.github/workflows/deploy-development.yml +++ b/.github/workflows/deploy-development.yml @@ -66,3 +66,11 @@ jobs: with: url: "https://fac-dev.app.cloud.gov/" + generate-e2e-test-data: + needs: + - deploy-dev + name: + uses: ./.github/workflows/end-to-end-test-data-generator.yml + secrets: inherit + with: + environment: "dev" diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 495602ba03..3f426703ec 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -57,3 +57,12 @@ jobs: with: url: "https://fac-staging.app.cloud.gov" environment: "staging" + + generate-e2e-test-data: + needs: + - deploy-staging + name: + uses: ./.github/workflows/end-to-end-test-data-generator.yml + secrets: inherit + with: + environment: "staging" diff --git a/.github/workflows/end-to-end-test-data-generator.yml b/.github/workflows/end-to-end-test-data-generator.yml new file mode 100644 index 0000000000..79cd8d6617 --- /dev/null +++ b/.github/workflows/end-to-end-test-data-generator.yml @@ -0,0 +1,56 @@ +--- +name: "Task: run Django command to generate and disseminate test data for non-production environments." +on: + workflow_dispatch: + inputs: + environment: + required: true + type: choice + description: The environment the workflow should run on. + options: + - dev + - staging + dbkeys: + required: false + type: string + description: Comma-separated list of report-IDs. + years: + required: false + type: string + description: Comma-separated list of report years. The list of years needs to be the same lenght as the list of dbkeys. + workflow_call: + inputs: + environment: + required: true + type: string + description: The environment the workflow should run on. + # dev, staging + dbkeys: + required: false + type: string + description: Comma-separated list of report-IDs. + years: + required: false + type: string + description: Comma-separated list of report years. The list of years needs to be the same lenght as the list of dbkeys. + +jobs: + end-to-end-test-data: + name: Generate and disseminate end-to-end test data in ${{ inputs.environment }} database + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + env: + space: ${{ inputs.environment }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run Django command to generate and disseminate end-to-end test data in ${{ inputs.environment }} + uses: cloud-gov/cg-cli-tools@main + with: + cf_username: ${{ secrets.CF_USERNAME }} + cf_password: ${{ secrets.CF_PASSWORD }} + cf_org: gsa-tts-oros-fac + cf_space: ${{ env.space }} + command: cf run-task gsa-fac -k 2G -m 2G --name generate_e2e_data --command "python manage.py end_to_end_test_data_generator --dbkeys ${{ inputs.dbkeys }} --years ${{ inputs.years }}" diff --git a/backend/config/settings.py b/backend/config/settings.py index a521515365..0c4c26456a 100644 --- a/backend/config/settings.py +++ b/backend/config/settings.py @@ -171,7 +171,13 @@ ), } -POSTGREST = {"URL": env.str("POSTGREST_URL", "http://api:3000")} +POSTGREST = { + "URL": env.str("POSTGREST_URL", "http://api:3000"), + "LOCAL": env.str("POSTGREST_URL", "http://api:3000"), + "DEVELOPMENT": "https://api-dev.fac.gov", + "STAGING": "https://api-staging.fac.gov", + "PRODUCTION": "https://api.fac.gov", +} # Password validation diff --git a/backend/cypress/e2e/additional-eins.cy.js b/backend/cypress/e2e/additional-eins.cy.js index 2794a398a2..38e63ed8fe 100644 --- a/backend/cypress/e2e/additional-eins.cy.js +++ b/backend/cypress/e2e/additional-eins.cy.js @@ -1,65 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookAdditionalEINs, - testWorkbookFederalAwards, + testWorkbookAdditionalEINs, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Additional EINs page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Additional EINs uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Additional EINs uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Additional EINs").click(); testWorkbookAdditionalEINs(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Additional EINs'); }); - -}); \ No newline at end of file +}); diff --git a/backend/cypress/e2e/additional-ueis.cy.js b/backend/cypress/e2e/additional-ueis.cy.js index 9af561c301..da8e22e93d 100644 --- a/backend/cypress/e2e/additional-ueis.cy.js +++ b/backend/cypress/e2e/additional-ueis.cy.js @@ -1,65 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookAdditionalUEIs, - testWorkbookFederalAwards, + testWorkbookAdditionalUEIs, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Additional UEIs page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Additional UEIs uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Additional UEIs uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Additional UEIs").click(); testWorkbookAdditionalUEIs(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Additional UEIs'); }); - -}); \ No newline at end of file +}); diff --git a/backend/cypress/e2e/audit-findings-text.cy.js b/backend/cypress/e2e/audit-findings-text.cy.js index 37ac483b79..27637644f1 100644 --- a/backend/cypress/e2e/audit-findings-text.cy.js +++ b/backend/cypress/e2e/audit-findings-text.cy.js @@ -1,65 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookFederalAwards, testWorkbookFindingsText, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Audit Findings Text page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Audit Findings Text uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Audit Findings Text uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Federal Awards Audit Findings Text").click(); testWorkbookFindingsText(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Federal Awards Audit Findings Text'); }); - }); diff --git a/backend/cypress/e2e/audit-findings.cy.js b/backend/cypress/e2e/audit-findings.cy.js index f4a3445f21..b48874d9cc 100644 --- a/backend/cypress/e2e/audit-findings.cy.js +++ b/backend/cypress/e2e/audit-findings.cy.js @@ -1,69 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookFederalAwards, testWorkbookFindingsUniformGuidance, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Audit Findings page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Audit Findings uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get('.usa-link').contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Audit Findings uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Federal Awards Audit Findings").click(); testWorkbookFindingsUniformGuidance(false); - - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Federal Awards Audit Findings'); }); - }); - - - diff --git a/backend/cypress/e2e/audit-report-pdf.cy.js b/backend/cypress/e2e/audit-report-pdf.cy.js index 4e00a002a7..caca017506 100644 --- a/backend/cypress/e2e/audit-report-pdf.cy.js +++ b/backend/cypress/e2e/audit-report-pdf.cy.js @@ -1,66 +1,20 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; +import { testFederalAwards } from '../support/federal-awards.js'; +import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testPdfAuditReport } from '../support/report-pdf.js'; - -import { - testWorkbookFederalAwards, -} from '../support/workbook-uploads.js'; - -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); +import { testPdfAuditReport } from '../support/report-pdf.js'; describe('Audit report PDF page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Audit report PDF uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Audit report PDF uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Audit report PDF").click(); testPdfAuditReport(false); + testFileUploadMsg('Edit the Audit report PDF'); }); - - it('Displays message if file has already been uploaded', () => { - cy.visit(`/audit/`); - cy.url().should('match', /\/audit\//); - cy.get(':nth-child(4) > .usa-table > tbody > tr').last().find('td:nth-child(1)>.usa-link').click(); - cy.get('.usa-link').contains('Edit the Audit report PDF').click(); - cy.get('#already-submitted') - .invoke('text') - .then((text) => { - const expectedText = 'A file has already been uploaded for this section. A successful reupload will overwrite your previous submission.'; - expect(text.trim()).to.equal(expectedText); - }); - }); - - }); \ No newline at end of file +}); diff --git a/backend/cypress/e2e/check-access.cy.js b/backend/cypress/e2e/check-access.cy.js index 388f1ce5b1..5fc0c60dce 100644 --- a/backend/cypress/e2e/check-access.cy.js +++ b/backend/cypress/e2e/check-access.cy.js @@ -3,7 +3,6 @@ import { testValidAuditeeInfo } from '../support/auditee-info.js'; import { addValidInfo, testValidAccess } from '../support/check-access.js'; describe('Create New Audit', () => { - beforeEach(() => { // contents of session are only called once cy.session('loginSession', () => { @@ -136,7 +135,7 @@ describe('Create New Audit', () => { }); describe('Auditor certifying official', () => { - + describe('Full name', () => { it('should display an error message when left blank', () => { cy.get('#certifying_auditor_contact_fullname').click().blur(); @@ -238,7 +237,7 @@ describe('Create New Audit', () => { }); describe('Auditee contacts', () => { - + describe('Full name', () => { it('should display an error message when left blank', () => { cy.get('#auditee_contacts_fullname').click().blur(); @@ -346,7 +345,7 @@ describe('Create New Audit', () => { }); describe('Auditor contacts', () => { - + describe('Full name', () => { it('should display an error message when left blank', () => { cy.get('#auditor_contacts_fullname').click().blur(); @@ -372,7 +371,7 @@ describe('Create New Audit', () => { cy.get('button').contains('Create').should('not.be.disabled'); }); }); - + describe('Email Address', () => { it('should display an error message when left blank', () => { cy.get('#auditor_contacts_email').click().blur(); diff --git a/backend/cypress/e2e/check-eligibility.cy.js b/backend/cypress/e2e/check-eligibility.cy.js index f5949403d2..957692ec4f 100644 --- a/backend/cypress/e2e/check-eligibility.cy.js +++ b/backend/cypress/e2e/check-eligibility.cy.js @@ -1,4 +1,4 @@ -import { selectValidEntries, testValidEligibilty } from '../support/check-eligibility.js'; +import { selectValidEntries } from '../support/check-eligibility.js'; describe('Create New Audit', () => { beforeEach(() => { diff --git a/backend/cypress/e2e/corrective-action-plan.cy.js b/backend/cypress/e2e/corrective-action-plan.cy.js index 06a8086ec1..a4ae944966 100644 --- a/backend/cypress/e2e/corrective-action-plan.cy.js +++ b/backend/cypress/e2e/corrective-action-plan.cy.js @@ -1,66 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookFederalAwards, testWorkbookCorrectiveActionPlan, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Corrective Action Plan page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Corrective Action Plan uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Corrective Action Plan uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Corrective Action Plan").click(); testWorkbookCorrectiveActionPlan(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Corrective Action Plan'); }); - }); - diff --git a/backend/cypress/e2e/createNewAudit.cy.js b/backend/cypress/e2e/createNewAudit.cy.js index 8525be65be..d15a496b96 100644 --- a/backend/cypress/e2e/createNewAudit.cy.js +++ b/backend/cypress/e2e/createNewAudit.cy.js @@ -1,43 +1,42 @@ import { testValidGeneralInfo } from '../support/general-info.js'; describe('Create new audit', () => { - //const reportTestId = '2023MAY0001000001'; + before(() => { + cy.visit('http://localhost:8000/report_submission/eligibility/'); + }); - before(() => { - cy.visit('http://localhost:8000/report_submission/eligibility/'); - }); - //got the page elements from Cypress Desktop - it('Fills out the Submission criteria check and clicks items', () => { - cy.get(':nth-child(3) > :nth-child(2) > .usa-radio__label').click(); - cy.get(':nth-child(4) > :nth-child(2) > .usa-radio__label').click(); - cy.get(':nth-child(5) > :nth-child(2) > .usa-radio__label').click(); - cy.get('#continue').click(); - cy.url().should('contain', '/report_submission/auditeeinfo/'); - }); + // Got the page elements from Cypress Desktop + it('Fills out the Submission criteria check and clicks items', () => { + cy.get(':nth-child(3) > :nth-child(2) > .usa-radio__label').click(); + cy.get(':nth-child(4) > :nth-child(2) > .usa-radio__label').click(); + cy.get(':nth-child(5) > :nth-child(2) > .usa-radio__label').click(); + cy.get('#continue').click(); + cy.url().should('contain', '/report_submission/auditeeinfo/'); + }); - it('Fills out the Auditee Information', () => { - cy.get('#auditee_uei').type('CMBSGK6P7BE1'); - cy.get('#auditee_uei-btn').click(); - cy.get('auditee_fiscal_period_start').type('05/08/2023'); - cy.get('auditee_fiscal_period_end').type('05/08/2024'); - cy.get('#continue').click(); - cy.url().should('contain', '/report_submission/accessandsubmission/'); -}); + it('Fills out the Auditee Information', () => { + cy.get('#auditee_uei').type('CMBSGK6P7BE1'); + cy.get('#auditee_uei-btn').click(); + cy.get('auditee_fiscal_period_start').type('05/08/2023'); + cy.get('auditee_fiscal_period_end').type('05/08/2024'); + cy.get('#continue').click(); + cy.url().should('contain', '/report_submission/accessandsubmission/'); + }); - it('Fills out the Audit submission access', () => { - cy.get('#certifying_auditee_contact_fullname').type('Real Full Name'); - cy.get('#certifying_auditee_contact_email').type('va@test'); - cy.get('#certifying_auditor_contact_email').type('qualified.human.accountant@auditor.com'); - cy.get('#certifying_auditor_contact_fullname').type('A. Humanbeing'); - cy.get('#auditee_contacts_fullname').type('Doe A. Deer'); - cy.get('#auditee_contacts_email').type('a@a.com'); - cy.get('#auditor_contacts_fullname').type('Percy Person'); - cy.get('#auditor_contacts_email').type('c@c.com'); - cy.get('#create').click(); - cy.url().should('contain', '/report_submission/general-information/2023MAY0001000001'); - }); + it('Fills out the Audit submission access', () => { + cy.get('#certifying_auditee_contact_fullname').type('Real Full Name'); + cy.get('#certifying_auditee_contact_email').type('va@test'); + cy.get('#certifying_auditor_contact_email').type('qualified.human.accountant@auditor.com'); + cy.get('#certifying_auditor_contact_fullname').type('A. Humanbeing'); + cy.get('#auditee_contacts_fullname').type('Doe A. Deer'); + cy.get('#auditee_contacts_email').type('a@a.com'); + cy.get('#auditor_contacts_fullname').type('Percy Person'); + cy.get('#auditor_contacts_email').type('c@c.com'); + cy.get('#create').click(); + cy.url().should('contain', '/report_submission/general-information/2023MAY0001000001'); + }); - it('Fills out the General Information Form', () => { - testValidGeneralInfo(); - }); + it('Fills out the General Information Form', () => { + testValidGeneralInfo(); + }); }); diff --git a/backend/cypress/e2e/display-submissions.cy.js b/backend/cypress/e2e/display-submissions.cy.js index e7cafc156c..d855d86d0d 100644 --- a/backend/cypress/e2e/display-submissions.cy.js +++ b/backend/cypress/e2e/display-submissions.cy.js @@ -2,6 +2,7 @@ describe('Display my audit submissions', () => { before(() => { cy.visit('/submissions'); }); + describe('On correct page.', () => { it('does not display the submissions table', () => { cy.get('h1').should('have.text', 'My audit submissions'); @@ -19,7 +20,6 @@ describe('Display my audit submissions', () => { ).as('hasNoData'); cy.visit('/submissions/'); cy.wait('@hasNoData').then((interception) => { - // console.log(interception); cy.get('.usa-table-container') .should('have.attr', 'class') .and('contain', 'display-none'); diff --git a/backend/cypress/e2e/federal-awards.cy.js b/backend/cypress/e2e/federal-awards.cy.js index daaef88359..ea59622a4d 100644 --- a/backend/cypress/e2e/federal-awards.cy.js +++ b/backend/cypress/e2e/federal-awards.cy.js @@ -1,62 +1,17 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - -import { - testWorkbookFederalAwards, -} from '../support/workbook-uploads.js'; - -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); +import { testLoginGovLogin } from '../support/login-gov.js'; describe('Federal awards page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Federal Awards uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); - - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); + testLoginGovLogin(); }); - it('Displays message if file has already been uploaded', () => { + it('Federal Awards uploads successfully', () => { + testFederalAwards(); testFileUploadMsg('Edit the Federal Awards'); }); - }); - diff --git a/backend/cypress/e2e/notes-to-sefa.cy.js b/backend/cypress/e2e/notes-to-sefa.cy.js index 86eee54d3b..b5cc9d0f25 100644 --- a/backend/cypress/e2e/notes-to-sefa.cy.js +++ b/backend/cypress/e2e/notes-to-sefa.cy.js @@ -1,65 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { - testWorkbookFederalAwards, testWorkbookNotesToSEFA } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Notes to SEFA page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Notes to SEFA uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Notes to SEFA uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Notes to SEFA").click(); testWorkbookNotesToSEFA(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Notes to SEFA'); }); - }); diff --git a/backend/cypress/e2e/ready-for-cert.cy.js b/backend/cypress/e2e/ready-for-cert.cy.js index c80e43e8b3..1e15307de0 100644 --- a/backend/cypress/e2e/ready-for-cert.cy.js +++ b/backend/cypress/e2e/ready-for-cert.cy.js @@ -1,25 +1,23 @@ - describe('Ready for SF-SAC Certification', () => { - //replace with your own report ID - const reportTestId = '2023MAY0001000001' - - before(() => { - cy.visit(`/audit/submission-progress/${reportTestId}`); - }); - - it('Page loads successfully', () => { - cy.url().should('include', `/audit/submission-progress/${reportTestId}`); - }); + // Replace with your own report ID + const reportTestId = '2023MAY0001000001' + + before(() => { + cy.visit(`/audit/submission-progress/${reportTestId}`); + }); - it('clicks Ready for SF-SAC Certification button', () => { - cy.visit(`/audit/submission-progress/${reportTestId}`); - cy.get('[href="/audit/ready-for-certification/2023MAY0001000001"] > .usa-button').click(); - cy.url().should('include', `/audit/ready-for-certification/${reportTestId}`); - }); + it('Page loads successfully', () => { + cy.url().should('include', `/audit/submission-progress/${reportTestId}`); + }); - it('clicks Submit for Certification', () => { - cy.visit(`/audit/ready-for-certification/${reportTestId}`); - cy.get('#continue').click(); - }) + it('clicks Ready for SF-SAC Certification button', () => { + cy.visit(`/audit/submission-progress/${reportTestId}`); + cy.get('[href="/audit/ready-for-certification/2023MAY0001000001"] > .usa-button').click(); + cy.url().should('include', `/audit/ready-for-certification/${reportTestId}`); + }); -}); \ No newline at end of file + it('clicks Submit for Certification', () => { + cy.visit(`/audit/ready-for-certification/${reportTestId}`); + cy.get('#continue').click(); + }) +}); diff --git a/backend/cypress/e2e/secondary-auditors.cy.js b/backend/cypress/e2e/secondary-auditors.cy.js index 6bb7ec3719..7b5bf554ec 100644 --- a/backend/cypress/e2e/secondary-auditors.cy.js +++ b/backend/cypress/e2e/secondary-auditors.cy.js @@ -1,65 +1,22 @@ import 'cypress-file-upload'; -import { testCrossValidation } from '../support/cross-validation.js'; -import { testLoginGovLogin } from '../support/login-gov.js'; -//import { testLogoutGov } from '../support/logout-gov.js'; -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 { testReportIdFound, testReportIdNotFound } from '../support/dissemination-table.js'; +import { testFederalAwards } from '../support/federal-awards.js'; import { testFileUploadMsg } from '../support/file-uploaded-msg.js'; - +import { testLoginGovLogin } from '../support/login-gov.js'; import { testWorkbookSecondaryAuditors, - testWorkbookFederalAwards, } from '../support/workbook-uploads.js'; -const LOGIN_TEST_EMAIL_AUDITEE = Cypress.env('LOGIN_TEST_EMAIL_AUDITEE'); -const LOGIN_TEST_PASSWORD_AUDITEE = Cypress.env('LOGIN_TEST_PASSWORD_AUDITEE'); -const LOGIN_TEST_OTP_SECRET_AUDITEE = Cypress.env('LOGIN_TEST_OTP_SECRET_AUDITEE'); - describe('Secondary Auditors page', () => { before(() => { - cy.session('login-session', () => { - cy.visit('/'); - cy.login(); - }); - }); - - it('Secondary auditors uploads successfully', () => { cy.visit('/'); - cy.url().should('include', '/'); + testLoginGovLogin(); + }); - cy.get('label[for=check-start-new-submission]').click(); - - cy.get('.usa-button').contains('Accept and start').click(); - - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - testValidEligibility(); - - testValidAuditeeInfo(); - - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - testValidGeneralInfo(); - - cy.get(".usa-link").contains("Federal Awards").click(); - testWorkbookFederalAwards(false); - + it('Secondary auditors uploads successfully', () => { + testFederalAwards(); cy.get(".usa-link").contains("Secondary Auditors").click(); testWorkbookSecondaryAuditors(false); - }); - - it('Displays message if file has already been uploaded', () => { testFileUploadMsg('Edit the Secondary Auditors'); }); - -}); \ No newline at end of file +}); diff --git a/backend/cypress/e2e/workbook-uploads.cy.js b/backend/cypress/e2e/workbook-uploads.cy.js index 88b91f38de..7aba6229cd 100644 --- a/backend/cypress/e2e/workbook-uploads.cy.js +++ b/backend/cypress/e2e/workbook-uploads.cy.js @@ -1,6 +1,4 @@ import 'cypress-file-upload'; -//require("@4tw/cypress-drag-drop"); - import { testWorkbookFederalAwards, testWorkbookFindingsUniformGuidance, diff --git a/backend/cypress/support/audit-info-form.js b/backend/cypress/support/audit-info-form.js index 623b9c85e6..2e9a377a02 100644 --- a/backend/cypress/support/audit-info-form.js +++ b/backend/cypress/support/audit-info-form.js @@ -2,36 +2,36 @@ Re-useable code for silling out the audit information form. */ export function testAuditInformationForm() { - // Select everything for the GAAP multiple choice checkboxes. - // Will pop the three conditional non-GAAP questions. - cy.get('[id^=gaap_results--]').each((item) => { - cy.get(item).click({force: true}); - }); + // Select everything for the GAAP multiple choice checkboxes. + // Will pop the three conditional non-GAAP questions. + cy.get('[id^=gaap_results--]').each((item) => { + cy.get(item).click({force: true}); + }); - // Select everything for question i - cy.get('[id^=sp_framework_basis--]').each((item) => { - cy.get(item).click({force: true}); - }); + // Select everything for question i + cy.get('[id^=sp_framework_basis--]').each((item) => { + cy.get(item).click({force: true}); + }); - // Question ii is a true/false, and is covered below + // Question ii is a true/false, and is covered below - // Select everything for question iii - cy.get('[id^=sp_framework_opinions--]').each((item) => { - cy.get(item).click({force: true}); - }); + // Select everything for question iii + cy.get('[id^=sp_framework_opinions--]').each((item) => { + cy.get(item).click({force: true}); + }); - // Answer 'Yes' to all Yes/No questions. - cy.get('[id$=--true]').each((item) => { - cy.get(item).click({force: true}); - }); + // Answer 'Yes' to all Yes/No questions. + cy.get('[id$=--true]').each((item) => { + cy.get(item).click({force: true}); + }); - // Enter 750000 into the dollar theshold number field. - cy.get('#dollar_threshold').type('750000').blur(); + // Enter 750000 into the dollar theshold number field. + cy.get('#dollar_threshold').type('750000').blur(); - // Select 0 and 1 for the multiple select agencies field. - cy.get('#agencies').select(['00', '01']).blur(); + // Select 0 and 1 for the multiple select agencies field. + cy.get('#agencies').select(['00', '01']).blur(); - cy.get('.usa-button').contains('Save and continue').click({force: true}); + cy.get('.usa-button').contains('Save and continue').click({force: true}); - cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}/); -} \ No newline at end of file + cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}/); +} diff --git a/backend/cypress/support/auditee-certification.js b/backend/cypress/support/auditee-certification.js index 41c733959d..bf3d830339 100644 --- a/backend/cypress/support/auditee-certification.js +++ b/backend/cypress/support/auditee-certification.js @@ -1,18 +1,18 @@ export function testAuditeeCertification() { - // 1. Click all the checkboxes to agree, submit and go to page 2 - cy.get('label[for=has_no_PII]').click(); - cy.get('label[for=has_no_BII]').click(); - cy.get('label[for=meets_2CFR_specifications]').click(); - cy.get('label[for=is_2CFR_compliant]').click(); - cy.get('label[for=is_complete_and_accurate]').click(); - cy.get('label[for=has_engaged_auditor]').click(); - cy.get('label[for=is_issued_and_signed]').click(); - cy.get('label[for=is_FAC_releasable]').click(); - cy.get('.usa-button').contains('Agree to auditee certification').click(); - - // 2. Sign and date, submit and go back to checklist - cy.get('#auditee_name').type('John Doe'); - cy.get('#auditee_title').type('Auditee'); - cy.get('#auditee_certification_date_signed').type("01/01/2022"); - cy.get('.usa-button').contains('Agree to auditee certification').click(); - } \ No newline at end of file + // 1. Click all the checkboxes to agree, submit and go to page 2 + cy.get('label[for=has_no_PII]').click(); + cy.get('label[for=has_no_BII]').click(); + cy.get('label[for=meets_2CFR_specifications]').click(); + cy.get('label[for=is_2CFR_compliant]').click(); + cy.get('label[for=is_complete_and_accurate]').click(); + cy.get('label[for=has_engaged_auditor]').click(); + cy.get('label[for=is_issued_and_signed]').click(); + cy.get('label[for=is_FAC_releasable]').click(); + cy.get('.usa-button').contains('Agree to auditee certification').click(); + + // 2. Sign and date, submit and go back to checklist + cy.get('#auditee_name').type('John Doe'); + cy.get('#auditee_title').type('Auditee'); + cy.get('#auditee_certification_date_signed').type("01/01/2022"); + cy.get('.usa-button').contains('Agree to auditee certification').click(); +} diff --git a/backend/cypress/support/federal-awards.js b/backend/cypress/support/federal-awards.js new file mode 100644 index 0000000000..bd14ad2e49 --- /dev/null +++ b/backend/cypress/support/federal-awards.js @@ -0,0 +1,12 @@ +import { testInitializeAudit } from './initialize-audit.js'; +import { + testWorkbookFederalAwards, +} from './workbook-uploads.js'; + +export function testFederalAwards(isTribal=false) { + testInitializeAudit(isTribal); + + // 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); +} diff --git a/backend/cypress/support/file-uploaded-msg.js b/backend/cypress/support/file-uploaded-msg.js index 3235abc977..d4eb9b74a9 100644 --- a/backend/cypress/support/file-uploaded-msg.js +++ b/backend/cypress/support/file-uploaded-msg.js @@ -1,13 +1,10 @@ - +// Displays message if file has already been uploaded export function testFileUploadMsg(fileSectionName) { - cy.visit(`/audit/`); - cy.url().should('match', /\/audit\//); - cy.get(':nth-child(4) > .usa-table > tbody > tr').last().find('td:nth-child(1)>.usa-link').click(); - cy.get('.usa-link').contains(fileSectionName).click(); - cy.get('#already-submitted') - .invoke('text') - .then((text) => { - const expectedText = 'A file has already been uploaded for this section. A successful reupload will overwrite your previous submission.'; - expect(text.trim()).to.equal(expectedText); - }); - } \ No newline at end of file + cy.get('.usa-link').contains(fileSectionName).click(); + cy.get('#already-submitted') + .invoke('text') + .then((text) => { + const expectedText = 'A file has already been uploaded for this section. A successful reupload will overwrite your previous submission.'; + expect(text.trim()).to.equal(expectedText); + }); +} diff --git a/backend/cypress/support/full-submission.js b/backend/cypress/support/full-submission.js index 8fb0fe9874..b7fb1e4df1 100644 --- a/backend/cypress/support/full-submission.js +++ b/backend/cypress/support/full-submission.js @@ -1,17 +1,13 @@ import { testCrossValidation } from './cross-validation.js'; import { testLoginGovLogin } from './login-gov.js'; import { testLogoutGov } from './logout-gov.js'; -import { testValidAccess } from './check-access.js'; -import { testValidEligibility } from './check-eligibility.js'; -import { testValidAuditeeInfo } from './auditee-info.js'; -import { testValidGeneralInfo } from './general-info.js'; import { testAuditInformationForm } from './audit-info-form.js'; import { testPdfAuditReport } from './report-pdf.js'; import { testAuditorCertification } from './auditor-certification.js'; import { testAuditeeCertification } from './auditee-certification.js'; import { testReportIdFound, testReportIdNotFound } from './dissemination-table.js'; import { testTribalAuditPublic, testTribalAuditPrivate } from './tribal-audit-form.js'; - +import { testInitializeAudit } from './initialize-audit.js'; import { testWorkbookFederalAwards, testWorkbookNotesToSEFA, @@ -34,32 +30,7 @@ export function testFullSubmission(isTribal, isPublic) { // Logs in with Login.gov' testLoginGovLogin(); - // Moves on to the eligibility screen - // check the terms and conditions link and click "Accept and start..." - // - // this click actually goes to the "terms and conditions" link which - // brings up a modal - cy.get('label[for=check-start-new-submission]').click(); - cy.get('.usa-button').contains('Accept and start').click(); - cy.url().should('match', /\/report_submission\/eligibility\/$/); - - // Completes the eligibility screen - testValidEligibility(isTribal); - - // Now the auditee info screen - testValidAuditeeInfo(); - - // Now the accessandsubmission screen - testValidAccess(); - - // Report should not yet be in the dissemination table - cy.url().then(url => { - const reportId = url.split('/').pop(); - testReportIdNotFound(reportId); - }); - - // Fill out the general info form - testValidGeneralInfo(); + testInitializeAudit(isTribal); // 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(); diff --git a/backend/cypress/support/general-info.js b/backend/cypress/support/general-info.js index 1f9eebbf31..f14b2bd6e8 100644 --- a/backend/cypress/support/general-info.js +++ b/backend/cypress/support/general-info.js @@ -1,7 +1,7 @@ // reusable code for filling out a valid general info form export function testValidGeneralInfo() { - // Fiscal period, pre-filled using info from the previous screen. + // Fiscal period, pre-filled using info from the previous screen. //cy.get('#auditee_fiscal_period_start').type('05/08/2023'); //cy.get('#auditee_fiscal_period_end').type('05/08/2024'); @@ -18,11 +18,11 @@ export function testValidGeneralInfo() { cy.get('#auditee_city').type('Richmond'); cy.get('#auditee_state').type('VA{enter}'); cy.get('#auditee_zip').type('23219'); - - // Auditee UEI is pre-filled and uneditable. + + // Auditee UEI is pre-filled and uneditable. // cy.get('#auditee_uei').type('CMBSGK6P7BE1'); cy.get('label[for=multiple-ueis-yes]').click(); - + // Auditee contact information cy.get('#auditee_contact_name').type('John Doe'); cy.get('#auditee_contact_title').type('Keymaster'); @@ -45,7 +45,7 @@ export function testValidGeneralInfo() { cy.get('#auditor_contact_title').type('Auditor'); cy.get('#auditor_phone').type('5555555555'); cy.get('#auditor_email').type('qualified.human.accountant@auditor'); - + cy.get('label[for=secondary_auditors-yes]').click(); cy.get('#continue').click(); diff --git a/backend/cypress/support/initialize-audit.js b/backend/cypress/support/initialize-audit.js new file mode 100644 index 0000000000..2c825c2837 --- /dev/null +++ b/backend/cypress/support/initialize-audit.js @@ -0,0 +1,30 @@ +import { testValidAccess } from './check-access.js'; +import { testValidEligibility } from './check-eligibility.js'; +import { testValidAuditeeInfo } from './auditee-info.js'; +import { testValidGeneralInfo } from './general-info.js'; +import { testReportIdNotFound } from './dissemination-table.js'; + +export function testInitializeAudit(isTribal=false) { + // Check the terms and conditions link and click "Accept and start..." + cy.get('label[for=check-start-new-submission]').click(); + cy.get('.usa-button').contains('Accept and start').click(); + cy.url().should('match', /\/report_submission\/eligibility\/$/); + + // Completes the eligibility screen + testValidEligibility(isTribal); + + // Now the auditee info screen + testValidAuditeeInfo(); + + // Now the accessandsubmission screen + testValidAccess(); + + // Report should not yet be in the dissemination table + cy.url().then(url => { + const reportId = url.split('/').pop(); + testReportIdNotFound(reportId); + }); + + // Fill out the general info form + testValidGeneralInfo(); +} diff --git a/backend/cypress/support/tribal-audit-form.js b/backend/cypress/support/tribal-audit-form.js index d3f6137fbb..59a33bc78a 100644 --- a/backend/cypress/support/tribal-audit-form.js +++ b/backend/cypress/support/tribal-audit-form.js @@ -1,16 +1,15 @@ - export function testTribalAuditPublic(){ - cy.get(`#is_tribal_information_authorized_to_be_public-yes`).click({force:true}); - cy.get('#tribal_authorization_certifying_official_name').type('John Wick'); - cy.get('#tribal_authorization_certifying_official_title').type('Offical'); - cy.get('#continue').click(); - cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}$/); + cy.get(`#is_tribal_information_authorized_to_be_public-yes`).click({force:true}); + cy.get('#tribal_authorization_certifying_official_name').type('John Wick'); + cy.get('#tribal_authorization_certifying_official_title').type('Offical'); + cy.get('#continue').click(); + cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}$/); } export function testTribalAuditPrivate(){ - cy.get(`#is_tribal_information_authorized_to_be_public-no`).click({force:true}); - cy.get('#tribal_authorization_certifying_official_name').type('Clint Eastwood'); - cy.get('#tribal_authorization_certifying_official_title').type('Official'); - cy.get('#continue').click(); - cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}$/); -} \ No newline at end of file + cy.get(`#is_tribal_information_authorized_to_be_public-no`).click({force:true}); + cy.get('#tribal_authorization_certifying_official_name').type('Clint Eastwood'); + cy.get('#tribal_authorization_certifying_official_title').type('Official'); + cy.get('#continue').click(); + cy.url().should('match', /\/audit\/submission-progress\/[0-9]{4}-[0-9]{2}-GSAFAC-[0-9]{10}$/); +} diff --git a/backend/dissemination/management/commands/end_to_end_test_data_generator.py b/backend/dissemination/management/commands/end_to_end_test_data_generator.py new file mode 100644 index 0000000000..be5914be46 --- /dev/null +++ b/backend/dissemination/management/commands/end_to_end_test_data_generator.py @@ -0,0 +1,61 @@ +import os +import logging +import sys + +from config.settings import ENVIRONMENT +from django.core.management.base import BaseCommand +from dissemination.workbooklib.end_to_end_core import run_end_to_end + +CYPRESS_TEST_EMAIL_ADDR = os.getenv("CYPRESS_LOGIN_TEST_EMAIL_AUDITEE") +logger = logging.getLogger(__name__) + + +class Command(BaseCommand): + def add_arguments(self, parser): + parser.add_argument("--email", type=str, required=False) + parser.add_argument("--dbkeys", type=str, required=False, default="") + parser.add_argument("--years", type=str, required=False, default="") + + def handle(self, *args, **options): + dbkeys_str = options["dbkeys"] + years_str = options["years"] + dbkeys = dbkeys_str.split(",") + years = years_str.split(",") + + if len(dbkeys) != len(years): + logger.error( + "Received {} dbkeys and {} years. Must be equal. Exiting.".format( + len(dbkeys), len(years) + ) + ) + sys.exit(-1) + + lengths = [len(s) == 2 for s in years] + if dbkeys_str and years_str and (not all(lengths)): + logger.error("Years must be two digits. Exiting.") + sys.exit(-2) + + email = options.get("email", CYPRESS_TEST_EMAIL_ADDR) + + defaults = [ + (182926, 22), + (181744, 22), + (191734, 22), + ] + + if ENVIRONMENT in ["LOCAL", "DEVELOPMENT", "PREVIEW", "STAGING"]: + if dbkeys_str and years_str: + logger.info( + f"Generating test reports for DBKEYS: {dbkeys_str} and YEARS: {years_str}" + ) + for dbkey, year in zip(dbkeys, years): + run_end_to_end(email, dbkey, year) + else: + for pair in defaults: + logger.info("Running {}-{} end-to-end".format(pair[0], pair[1])) + run_end_to_end(email, str(pair[0]), str(pair[1])) + else: + logger.error( + "Cannot run end-to-end workbook generation in production. Exiting." + ) + sys.exit(-3) diff --git a/backend/dissemination/management/commands/end_to_end_workbook_test.py b/backend/dissemination/workbooklib/end_to_end_core.py similarity index 91% rename from backend/dissemination/management/commands/end_to_end_workbook_test.py rename to backend/dissemination/workbooklib/end_to_end_core.py index 7788ca0c72..f0798501cc 100644 --- a/backend/dissemination/management/commands/end_to_end_workbook_test.py +++ b/backend/dissemination/workbooklib/end_to_end_core.py @@ -1,4 +1,3 @@ -from django.core.management.base import BaseCommand from users.models import User import argparse import logging @@ -90,7 +89,12 @@ def call_api(api_url, endpoint, rid, field): ) full_request = f"{api_url}/{endpoint}?report_id=eq.{rid}&select={field}" response = requests.get( - full_request, headers={"Authorization": f"Bearer {encoded_jwt}"}, timeout=10 + full_request, + headers={ + "Authorization": f"Bearer {encoded_jwt}", + "X-Api-Key": os.getenv("CYPRESS_API_GOV_KEY"), + }, + timeout=10, ) return response @@ -126,7 +130,7 @@ def check_equality(in_wb, in_json): def get_api_values(endpoint, rid, field): - api_url = settings.POSTGREST.get("URL") + api_url = settings.POSTGREST.get(settings.ENVIRONMENT) res = call_api(api_url, endpoint, rid, field) if res.status_code == 200: @@ -222,16 +226,3 @@ def run_end_to_end(email, dbkey, year): logger.info("No user found for %s, have you logged in once?", email) return generate_workbooks(user, email, dbkey, year) - - -class Command(BaseCommand): - def add_arguments(self, parser): - parser.add_argument("--email", type=str, required=True) - parser.add_argument("--dbkey", type=str, required=True) - parser.add_argument("--year", type=str, default="22") - - def handle(self, *args, **options): - email = options["email"] - dbkey = options["dbkey"] - year = options["year"] - run_end_to_end(email, dbkey, year)