Skip to content

Commit

Permalink
Merge pull request #1629 from fecgov/release/sprint-35
Browse files Browse the repository at this point in the history
Release/sprint 35
  • Loading branch information
mjtravers authored Jan 3, 2024
2 parents c3acdb4 + ad13755 commit b92b9f1
Show file tree
Hide file tree
Showing 211 changed files with 4,972 additions and 3,481 deletions.
2 changes: 1 addition & 1 deletion front-end/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ export E2E_DATABASE_URL=''
export CYPRESS_EMAIL=''
export CYPRESS_COMMITTEE_ID=''
export CYPRESS_PASSWORD=''
sudo circleci local execute -e E2E_BRANCH_NAME=${E2E_BRANCH_NAME} -e E2E_DJANGO_SECRET_KEY=${E2E_DJANGO_SECRET_KEY} -e E2E_DATABASE_URL=${E2E_DATABASE_URL} -e CYPRESS_EMAIL=${CYPRESS_EMAIL} -e CYPRESS_COMMITTEE_ID=${CYPRESS_COMMITTEE_ID} -e CYPRESS_PASSWORD=${CYPRESS_PASSWORD} --job e2e-test
sudo circleci local execute e2e-test -e E2E_BRANCH_NAME=${E2E_BRANCH_NAME} -e E2E_DJANGO_SECRET_KEY=${E2E_DJANGO_SECRET_KEY} -e E2E_DATABASE_URL=${E2E_DATABASE_URL} -e CYPRESS_EMAIL=${CYPRESS_EMAIL} -e CYPRESS_COMMITTEE_ID=${CYPRESS_COMMITTEE_ID} -e CYPRESS_PASSWORD=${CYPRESS_PASSWORD}
```
4 changes: 2 additions & 2 deletions front-end/cypress/e2e/pages/f3xConfirmInfoPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export function enterFilingDetails(details: FilingDetails, save = true) {
cy.get('input[formControlName="treasurer_middle_name"]').overwrite(details.middle_name);
cy.get('input[formControlName="treasurer_prefix"]').overwrite(details.prefix);
cy.get('input[formControlName="treasurer_suffix"]').overwrite(details.suffix);
cy.get('input[formControlName="filing_password"]').overwrite(details.filing_pw);
cy.get('input[formControlName="filingPassword"]').overwrite(details.filing_pw);

cy.get('p-checkbox[formControlName="truth_statement"]').find('div').last().click({ force: true });
cy.get('p-checkbox[formControlName="userCertified"]').find('div').last().click({ force: true });

if (save) {
cy.get('button[label="Submit"]').click();
Expand Down
6 changes: 5 additions & 1 deletion front-end/cypress/e2e/pages/reportListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ export class ReportListPage {
}

static clickCreateButton(force: boolean = false) {
cy.get("button[label='Create a new report']").click({force: force});
cy.get("button[label='Create a new report']").click({ force: force });
cy.intercept({ method: 'GET', url: 'http://localhost:8080/api/v1/reports/form-3x/coverage_dates/' }).as(
'coverageDates'
);
cy.get('button').contains('Start building report').click();
cy.wait('@coverageDates'); // the page is ready when coverage_dates has returned
}

//Deletes all reports belonging to the logged-in committee
Expand Down
25 changes: 13 additions & 12 deletions front-end/cypress/e2e/reports-f3x-amendments.cy.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import { defaultFormData as contactFormData } from './models/ContactFormModel';
import { defaultFormData as reportFormData } from './models/ReportFormModel';
import { ContactListPage } from './pages/contactListPage';
import { F3xCreateReportPage } from './pages/f3xCreateReportPage';
import { LoginPage } from './pages/loginPage';
import { PageUtils } from './pages/pageUtils';
import { ReportListPage } from './pages/reportListPage';
import { ContactListPage } from './pages/contactListPage';
import { F3xCreateReportPage } from './pages/f3xCreateReportPage';
import { ContactFormData, defaultFormData as contactFormData } from './models/ContactFormModel';
import { defaultFormData as reportFormData } from './models/ReportFormModel';

const organizationFormData: ContactFormData = {
...contactFormData,
...{ contact_type: 'Organization' },
};
describe('Amendments', () => {
beforeEach(() => {
LoginPage.login();
ReportListPage.deleteAllReports();
ContactListPage.deleteAllContacts();
ContactListPage.goToPage();
ReportListPage.goToPage();
});

it('should test Create an amendment', () => {
ContactListPage.goToPage();
PageUtils.clickButton('New');
ContactListPage.enterFormData(organizationFormData);
const formData = {
...contactFormData,
...{
contact_type: 'Organization',
},
};
ContactListPage.enterFormData(formData);
PageUtils.clickButton('Save');

// Create report to add loan too
Expand All @@ -42,8 +43,8 @@ describe('Amendments', () => {
PageUtils.clickSidebarItem('SUBMIT YOUR REPORT');
PageUtils.clickLink('Submit report');
PageUtils.urlCheck('/submit/step2');
PageUtils.enterValue('#filing_password', 'T3stUpl@ad');
cy.get(alias).find('p-checkbox[inputid="truth_statement"]').click();
PageUtils.enterValue('#filingPassword', 'T3stUpl@ad');
cy.get(alias).find('p-checkbox[inputid="userCertified"]').click();
PageUtils.clickButton('Submit');
PageUtils.findOnPage('div', 'Are you sure?');

Expand Down
46 changes: 31 additions & 15 deletions front-end/cypress/e2e/reports-f3x-loans-bank.cy.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ContactFormData, defaultFormData as individualContactFormData } from './models/ContactFormModel';
import { defaultFormData as reportFormData, F3xCreateReportFormData } from './models/ReportFormModel';
import { defaultLoanFormData } from './models/TransactionFormModel';
import { ContactListPage } from './pages/contactListPage';
import { F3xCreateReportPage } from './pages/f3xCreateReportPage';
import { LoginPage } from './pages/loginPage';
import { currentYear, PageUtils } from './pages/pageUtils';
import { ReportListPage } from './pages/reportListPage';
import { TransactionDetailPage } from './pages/transactionDetailPage';
import { ContactListPage } from './pages/contactListPage';
import { F3xCreateReportPage } from './pages/f3xCreateReportPage';
import { defaultLoanFormData } from './models/TransactionFormModel';
import { defaultFormData as individualContactFormData, ContactFormData } from './models/ContactFormModel';
import { defaultFormData as reportFormData, F3xCreateReportFormData } from './models/ReportFormModel';

const reportFormDataApril: F3xCreateReportFormData = {
...reportFormData,
Expand All @@ -26,10 +26,7 @@ const reportFormDataJuly: F3xCreateReportFormData = {
},
};

const organizationFormData: ContactFormData = {
...individualContactFormData,
...{ contact_type: 'Organization' },
};
let organizationFormData: ContactFormData;

const formData = {
...defaultLoanFormData,
Expand All @@ -49,8 +46,12 @@ describe('Loans', () => {
LoginPage.login();
ReportListPage.deleteAllReports();
ContactListPage.deleteAllContacts();
ContactListPage.goToPage();
ReportListPage.goToPage();

organizationFormData = {
...individualContactFormData,
...{ contact_type: 'Organization' },
};
});

it('should test new C1 - Loan Agreement for existing Schedule C Loan', () => {
Expand Down Expand Up @@ -89,22 +90,32 @@ describe('Loans', () => {

// go back to reports, make new report

// Create report to add loan too
// Create report
ReportListPage.goToPage();
ReportListPage.clickCreateButton(true);
F3xCreateReportPage.enterFormData(reportFormDataJuly);
cy.intercept({
method: 'Post',
url: 'http://localhost:8080/api/v1/reports/form-3x/?fields_to_validate=filing_frequency,report_type_category,report_code,coverage_from_date,coverage_through_date,date_of_election,state_of_election,form_type',
}).as('saveReport');
PageUtils.clickButton('Save and continue');
cy.wait('@saveReport');

// Create report to add loan too
ReportListPage.goToPage();
const alias = PageUtils.getAlias('');
cy.get(alias).contains('JULY 15').siblings().last().find('app-table-actions-button').children().last().click();

cy.get(alias).contains('Edit report').first().click();
PageUtils.urlCheck('cash-on-hand');
PageUtils.enterValue('#L6a_cash_on_hand_jan_1_ytd', 60000);
PageUtils.calendarSetValue('p-calendar', new Date('05/27/2023'), alias);
PageUtils.clickButton('Save & continue');
cy.wait(500);
cy.url().then((currentUrl) => {
if (currentUrl.includes('cash-on-hand')) {
PageUtils.urlCheck('cash-on-hand');
PageUtils.enterValue('#L6a_cash_on_hand_jan_1_ytd', 60000);
PageUtils.calendarSetValue('p-calendar', new Date('05/27/2023'), alias);
PageUtils.clickButton('Save & continue');
}
});
cy.get(alias)
.find("[datatest='" + 'loans-and-debts-button' + "']")
.children()
Expand All @@ -125,7 +136,12 @@ describe('Loans', () => {
},
};
TransactionDetailPage.enterNewLoanAgreementFormData(fd);

cy.intercept({
method: 'Post',
}).as('saveNewAgreement');
PageUtils.clickButton('Save', '', true);
cy.wait('@saveNewAgreement');
cy.contains('Loan Received from Bank').should('exist');
PageUtils.urlCheck('/list');
cy.contains('Loan Received from Bank').last().should('exist');
Expand Down
6 changes: 4 additions & 2 deletions front-end/cypress/e2e/reports-f3x-loans-committee.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ describe('Loans', () => {
PageUtils.urlCheck('/C2_LOAN_GUARANTOR');
PageUtils.searchBoxInput(individualContactFormData.last_name);
cy.get('#amount').safeType(formData['amount']);
cy.intercept({
method: 'Post',
}).as('saveGuarantor');
PageUtils.clickButton('Save & add loan guarantor');
PageUtils.urlCheck('create-sub-transaction' + '/C2_LOAN_GUARANTOR');
PageUtils.clickButton('Cancel', '', true);
cy.wait('@saveGuarantor');
PageUtils.urlCheck('create-sub-transaction' + '/C2_LOAN_GUARANTOR');
PageUtils.clickButton('Cancel', '', true);

Expand Down
Loading

0 comments on commit b92b9f1

Please sign in to comment.