Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ez/update solo cy tests #2241

Merged
merged 10 commits into from
Sep 25, 2023
65 changes: 65 additions & 0 deletions backend/cypress/e2e/additional-eins.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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 { testFileUploadMsg } from '../support/file-uploaded-msg.js';

import {
testWorkbookAdditionalEINs,
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('Additional EINs page', () => {
before(() => {
cy.session('login-session', () => {
cy.visit('/');
cy.login();
});
});

it('Additional EINs 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);

cy.get(".usa-link").contains("Additional EINs").click();
testWorkbookAdditionalEINs(false);
});

it('Displays message if file has already been uploaded', () => {
testFileUploadMsg('Edit the Additional EINs');
});

});
65 changes: 65 additions & 0 deletions backend/cypress/e2e/additional-ueis.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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 { testFileUploadMsg } from '../support/file-uploaded-msg.js';

import {
testWorkbookAdditionalUEIs,
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('Additional UEIs page', () => {
before(() => {
cy.session('login-session', () => {
cy.visit('/');
cy.login();
});
});

it('Additional UEIs 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);

cy.get(".usa-link").contains("Additional UEIs").click();
testWorkbookAdditionalUEIs(false);
});

it('Displays message if file has already been uploaded', () => {
testFileUploadMsg('Edit the Additional UEIs');
});

});
87 changes: 56 additions & 31 deletions backend/cypress/e2e/audit-findings-text.cy.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,65 @@
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 { testFileUploadMsg } from '../support/file-uploaded-msg.js';

describe('Audit findings text page', () => {
const reportTestId = '2023MAY0001000001'
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.visit(`/report_submission/audit-findings-text/${reportTestId}`);
cy.session('login-session', () => {
cy.visit('/');
cy.login();
});
});
it('Page loads successfully', () => {
cy.url().should('include', `/report_submission/audit-findings-text/${reportTestId}`);

it('Audit Findings Text 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);

cy.get(".usa-link").contains("Federal Awards Audit Findings Text").click();
testWorkbookFindingsText(false);
});

describe('findings text workbook upload successful', () => {
it('Successfully uploads audit findings text', () => {
cy.intercept('/audit/excel/findings-text/*', {
fixture: 'success-res.json',
}).as('uploadSuccess')
cy.visit(`/report_submission/audit-findings-text/${reportTestId}`);
cy.get('#file-input-audit-findings-text-xlsx').attachFile('findings-text-UPDATE.xlsx');
cy.wait('@uploadSuccess').its('response.statusCode').should('eq', 200)
cy.wait(2000).get('#info_box').should('have.text', 'File successfully validated! Your work has been saved.');
cy.get('#continue').click();
cy.url().should('contain', `/audit/submission-progress/${reportTestId}`);
})
it('Displays message if file has already been uploaded', () => {
testFileUploadMsg('Edit the Federal Awards Audit Findings Text');
});

describe('File upload fail', () => {
it('unsuccessful upload audit findings text', () => {
cy.intercept('POST', '/audit/excel/findings-text/*', {
statusCode: 400,
fixture: 'fail-res.json',
}).as('uploadFail')
cy.visit(`/report_submission/audit-findings-text/${reportTestId}`);
cy.get('#file-input-audit-findings-text-xlsx').attachFile('federal-awards-Test.xlsx');
cy.wait('@uploadFail').its('response.statusCode').should('eq', 400)
cy.wait(2000).get('#info_box').should('contain', 'A field is missing');
})
})

});
});
90 changes: 60 additions & 30 deletions backend/cypress/e2e/audit-findings.cy.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,69 @@
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 { testFileUploadMsg } from '../support/file-uploaded-msg.js';

describe('Audit findings page', () => {
const reportTestId = '2023MAY0001000001'
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.visit(`/report_submission/audit-findings/${reportTestId}`);
cy.session('login-session', () => {
cy.visit('/');
cy.login();
});
});
it('Page loads successfully', () => {
cy.url().should('include', `/report_submission/audit-findings/${reportTestId}`);

it('Audit Findings 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);

cy.get(".usa-link").contains("Federal Awards Audit Findings").click();
testWorkbookFindingsUniformGuidance(false);

});

describe('File upload successful', () => {
it('Successfully uploads audit findings', () => {
cy.intercept('/audit/excel/findings-uniform-guidance/*', {
fixture: 'success-res.json',
}).as('uploadSuccess')
cy.visit(`/report_submission/audit-findings/${reportTestId}`);
cy.get('#file-input-audit-findings-xlsx').attachFile('findings-uniform-guidance-UPDATE.xlsx');
cy.wait('@uploadSuccess').its('response.statusCode').should('eq', 200)
cy.wait(2000).get('#info_box').should('have.text', 'File successfully validated! Your work has been saved.');
cy.get('#continue').click();
})
it('Displays message if file has already been uploaded', () => {
testFileUploadMsg('Edit the Federal Awards Audit Findings');
});

describe('File upload fail', () => {
it('unsuccessful upload audit findings', () => {
cy.intercept('POST', '/audit/excel/findings-uniform-guidance/*', {
statusCode: 400,
fixture: 'fail-res.json',
}).as('uploadFail')
cy.visit(`/report_submission/audit-findings/${reportTestId}`);
cy.get('#file-input-audit-findings-xlsx').attachFile('federal-awards-Test.xlsx');
cy.wait('@uploadFail').its('response.statusCode').should('eq', 400)
cy.wait(2000).get('#info_box').should('contain', 'A field is missing');
})
})

});
});



Loading