diff --git a/front-end/cypress/e2e/F24/reports-f24-independent-expenditures.cy.ts b/front-end/cypress/e2e/F24/reports-f24-independent-expenditures.cy.ts index 21949dac41..68e75d4bd6 100644 --- a/front-end/cypress/e2e/F24/reports-f24-independent-expenditures.cy.ts +++ b/front-end/cypress/e2e/F24/reports-f24-independent-expenditures.cy.ts @@ -7,7 +7,7 @@ import { DisbursementFormData, } from '../models/TransactionFormModel'; import { F3XSetup } from '../F3X/f3x-setup'; -import { StartTransaction } from '../F3X/start-transaction/start-transaction'; +import { StartTransaction } from '../F3X/utils/start-transaction/start-transaction'; import { faker } from '@faker-js/faker'; import { F24Setup } from './f24-setup'; import { ReportListPage } from '../pages/reportListPage'; diff --git a/front-end/cypress/e2e/F3X/disbursements.cy.ts b/front-end/cypress/e2e/F3X/disbursements.cy.ts index 9fecb9cd13..0a39fe4faf 100644 --- a/front-end/cypress/e2e/F3X/disbursements.cy.ts +++ b/front-end/cypress/e2e/F3X/disbursements.cy.ts @@ -12,7 +12,7 @@ import { formTransactionDataForSchedule, } from '../models/TransactionFormModel'; import { F3XSetup } from './f3x-setup'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; import { faker } from '@faker-js/faker'; import { ReportListPage } from '../pages/reportListPage'; import { F24Setup } from '../F24/f24-setup'; diff --git a/front-end/cypress/e2e/F3X/reattributions.cy.ts b/front-end/cypress/e2e/F3X/reattributions.cy.ts index dd95bba6b7..ad06197d6a 100644 --- a/front-end/cypress/e2e/F3X/reattributions.cy.ts +++ b/front-end/cypress/e2e/F3X/reattributions.cy.ts @@ -9,10 +9,10 @@ import { createContact, defaultFormData as individualContactFormData, } from '../models/ContactFormModel'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; import { F3XSetup, reportFormDataApril, reportFormDataJuly } from './f3x-setup'; import { ScheduleFormData } from '../models/TransactionFormModel'; -import { Individual } from './start-transaction/receipts'; +import { Individual } from './utils/start-transaction/receipts'; import { faker } from '@faker-js/faker'; const APRIL_15 = 'APRIL 15'; diff --git a/front-end/cypress/e2e/F3X/receipts.cy.ts b/front-end/cypress/e2e/F3X/receipts.cy.ts index 5e86c3a9bf..a196606a7d 100644 --- a/front-end/cypress/e2e/F3X/receipts.cy.ts +++ b/front-end/cypress/e2e/F3X/receipts.cy.ts @@ -6,7 +6,7 @@ import { TransactionDetailPage } from '../pages/transactionDetailPage'; import { defaultFormData as defaultContactFormData } from '../models/ContactFormModel'; import { defaultScheduleFormData, formTransactionDataForSchedule } from '../models/TransactionFormModel'; import { F3XSetup } from './f3x-setup'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; const scheduleData = { ...defaultScheduleFormData, diff --git a/front-end/cypress/e2e/F3X/redesignations.cy.ts b/front-end/cypress/e2e/F3X/redesignations.cy.ts index 281a1b0bbf..4e47eb86ce 100644 --- a/front-end/cypress/e2e/F3X/redesignations.cy.ts +++ b/front-end/cypress/e2e/F3X/redesignations.cy.ts @@ -3,13 +3,13 @@ import { PageUtils } from '../pages/pageUtils'; import { ReportListPage } from '../pages/reportListPage'; import { TransactionDetailPage } from '../pages/transactionDetailPage'; import { candidateFormData, committeeFormData } from '../models/ContactFormModel'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; import { F3XSetup, reportFormDataApril, reportFormDataJuly } from './f3x-setup'; import { ContributionFormData, defaultScheduleFormData as defaultTransactionFormData, } from '../models/TransactionFormModel'; -import { Contributions } from './start-transaction/disbursements'; +import { Contributions } from './utils/start-transaction/disbursements'; const APRIL_15 = 'APRIL 15'; diff --git a/front-end/cypress/e2e/F3X/reports-f3x-debts.cy.ts b/front-end/cypress/e2e/F3X/reports-f3x-debts.cy.ts index ba8ee14f6b..75af96b559 100644 --- a/front-end/cypress/e2e/F3X/reports-f3x-debts.cy.ts +++ b/front-end/cypress/e2e/F3X/reports-f3x-debts.cy.ts @@ -4,7 +4,7 @@ import { TransactionDetailPage } from '../pages/transactionDetailPage'; import { defaultDebtFormData as debtFormData } from '../models/TransactionFormModel'; import { committeeFormData } from '../models/ContactFormModel'; import { F3XSetup } from './f3x-setup'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; describe('Debts', () => { beforeEach(() => { diff --git a/front-end/cypress/e2e/F3X/reports-f3x-loans-bank.cy.ts b/front-end/cypress/e2e/F3X/reports-f3x-loans-bank.cy.ts index c68165516e..e2df6726d6 100644 --- a/front-end/cypress/e2e/F3X/reports-f3x-loans-bank.cy.ts +++ b/front-end/cypress/e2e/F3X/reports-f3x-loans-bank.cy.ts @@ -4,7 +4,7 @@ import { Initialize } from '../pages/loginPage'; import { currentYear, PageUtils } from '../pages/pageUtils'; import { ReportListPage } from '../pages/reportListPage'; import { TransactionDetailPage } from '../pages/transactionDetailPage'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; import { F3XSetup, reportFormDataApril, reportFormDataJuly, Setup } from './f3x-setup'; const formData = { diff --git a/front-end/cypress/e2e/F3X/reports-f3x-loans-committee.cy.ts b/front-end/cypress/e2e/F3X/reports-f3x-loans-committee.cy.ts index b07530e476..9f79dbeefa 100644 --- a/front-end/cypress/e2e/F3X/reports-f3x-loans-committee.cy.ts +++ b/front-end/cypress/e2e/F3X/reports-f3x-loans-committee.cy.ts @@ -4,7 +4,7 @@ import { TransactionDetailPage } from '../pages/transactionDetailPage'; import { defaultLoanFormData } from '../models/TransactionFormModel'; import { committeeFormData, defaultFormData as individualContactFormData } from '../models/ContactFormModel'; import { F3XSetup } from './f3x-setup'; -import { StartTransaction } from './start-transaction/start-transaction'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; const formData = { ...defaultLoanFormData, diff --git a/front-end/cypress/e2e/F3X/review-report.cy.ts b/front-end/cypress/e2e/F3X/review-report.cy.ts new file mode 100644 index 0000000000..2f3155f492 --- /dev/null +++ b/front-end/cypress/e2e/F3X/review-report.cy.ts @@ -0,0 +1,76 @@ +import { defaultFormData as defaultContactFormData } from '../models/ContactFormModel'; +import { defaultScheduleFormData } from '../models/TransactionFormModel'; +import { ContactListPage } from '../pages/contactListPage'; +import { Initialize } from '../pages/loginPage'; +import { PageUtils, currentYear } from '../pages/pageUtils'; +import { TransactionDetailPage } from '../pages/transactionDetailPage'; +import { F3XSetup } from './f3x-setup'; +import { ReviewReport } from './utils/review-report'; +import { StartTransaction } from './utils/start-transaction/start-transaction'; + +const scheduleData = { + ...defaultScheduleFormData, + ...{ + electionYear: undefined, + electionType: undefined, + date_received: new Date(currentYear, 4 - 1, 27), + }, +}; + +describe('Receipt Transactions', () => { + beforeEach(() => { + Initialize(); + }); + + it('should calculate summary values on first visit', () => { + // Create report and check summary calc runs + F3XSetup(); + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('exist'); + + // Leave summary and come back to verify calc does NOT run + PageUtils.clickSidebarItem('ENTER A TRANSACTION'); + PageUtils.clickSidebarItem('Manage your transactions'); + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('not.exist'); + }); + + it('should recalculate after transaction created or updated', () => { + // Create report and check summary calc runs + F3XSetup({ individual: true }); + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('exist'); + + // Create transaction + StartTransaction.Receipts().Individual().IndividualReceipt(); + cy.get('[id="searchBox"]').type(defaultContactFormData['last_name'].slice(0, 1)); + cy.contains(defaultContactFormData['last_name']).should('exist'); + cy.contains(defaultContactFormData['last_name']).click({ force: true }); + TransactionDetailPage.enterScheduleFormData(scheduleData); + PageUtils.clickButton('Save'); + + // Go to summary and verify summary calc runs + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('exist'); + + // Verify summary calc doesn't run again + PageUtils.clickSidebarItem('ENTER A TRANSACTION'); + PageUtils.clickSidebarItem('Manage your transactions'); + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('not.exist'); + + // Update transaction + PageUtils.clickSidebarItem('ENTER A TRANSACTION'); + PageUtils.clickSidebarItem('Manage your transactions'); + cy.get('tr').should('contain', 'Individual Receipt'); + PageUtils.clickLink('Individual Receipt'); + const alias = PageUtils.getAlias(''); + cy.get(alias).find('#amount').clear().safeType(123.45); + PageUtils.clickButton('Save'); + cy.get('tr').should('contain', '$123.45'); + + // Return to summary page and verify summary calc runs + ReviewReport.Summary(); + cy.get('img.fec-loader-image').should('exist'); + }); +}); diff --git a/front-end/cypress/e2e/F3X/utils/review-report.ts b/front-end/cypress/e2e/F3X/utils/review-report.ts new file mode 100644 index 0000000000..c9c34ec2aa --- /dev/null +++ b/front-end/cypress/e2e/F3X/utils/review-report.ts @@ -0,0 +1,23 @@ +import { PageUtils } from '../../pages/pageUtils'; + +export class ReviewReport { + static Summary() { + PageUtils.clickSidebarItem('REVIEW A REPORT'); + PageUtils.clickSidebarItem('View summary page'); + } + + static DSP() { + PageUtils.clickSidebarItem('REVIEW A REPORT'); + PageUtils.clickSidebarItem('View detailed summary page'); + } + + static PrintPreview() { + PageUtils.clickSidebarItem('REVIEW A REPORT'); + PageUtils.clickSidebarItem('View print preview'); + } + + static AddReportLevelMemo() { + PageUtils.clickSidebarItem('REVIEW A REPORT'); + PageUtils.clickSidebarItem('Add a report level memo'); + } +} diff --git a/front-end/cypress/e2e/F3X/start-transaction/debts.ts b/front-end/cypress/e2e/F3X/utils/start-transaction/debts.ts similarity index 77% rename from front-end/cypress/e2e/F3X/start-transaction/debts.ts rename to front-end/cypress/e2e/F3X/utils/start-transaction/debts.ts index 305e581614..d84b09741b 100644 --- a/front-end/cypress/e2e/F3X/start-transaction/debts.ts +++ b/front-end/cypress/e2e/F3X/utils/start-transaction/debts.ts @@ -1,4 +1,4 @@ -import { PageUtils } from '../../pages/pageUtils'; +import { PageUtils } from '../../../pages/pageUtils'; export class Debts { static ByCommittee() { diff --git a/front-end/cypress/e2e/F3X/start-transaction/disbursements.ts b/front-end/cypress/e2e/F3X/utils/start-transaction/disbursements.ts similarity index 96% rename from front-end/cypress/e2e/F3X/start-transaction/disbursements.ts rename to front-end/cypress/e2e/F3X/utils/start-transaction/disbursements.ts index 7bd7bc1dfb..a07435594b 100644 --- a/front-end/cypress/e2e/F3X/start-transaction/disbursements.ts +++ b/front-end/cypress/e2e/F3X/utils/start-transaction/disbursements.ts @@ -1,4 +1,4 @@ -import { PageUtils } from '../../pages/pageUtils'; +import { PageUtils } from '../../../pages/pageUtils'; export class Disbursements { static Contributions() { diff --git a/front-end/cypress/e2e/F3X/start-transaction/loans.ts b/front-end/cypress/e2e/F3X/utils/start-transaction/loans.ts similarity index 76% rename from front-end/cypress/e2e/F3X/start-transaction/loans.ts rename to front-end/cypress/e2e/F3X/utils/start-transaction/loans.ts index 70281cc8eb..62f0376fc9 100644 --- a/front-end/cypress/e2e/F3X/start-transaction/loans.ts +++ b/front-end/cypress/e2e/F3X/utils/start-transaction/loans.ts @@ -1,4 +1,4 @@ -import { PageUtils } from '../../pages/pageUtils'; +import { PageUtils } from '../../../pages/pageUtils'; export class Loans { static FromBank() { diff --git a/front-end/cypress/e2e/F3X/start-transaction/receipts.ts b/front-end/cypress/e2e/F3X/utils/start-transaction/receipts.ts similarity index 96% rename from front-end/cypress/e2e/F3X/start-transaction/receipts.ts rename to front-end/cypress/e2e/F3X/utils/start-transaction/receipts.ts index 6f5c26297b..523aa2c066 100644 --- a/front-end/cypress/e2e/F3X/start-transaction/receipts.ts +++ b/front-end/cypress/e2e/F3X/utils/start-transaction/receipts.ts @@ -1,4 +1,4 @@ -import { PageUtils } from '../../pages/pageUtils'; +import { PageUtils } from '../../../pages/pageUtils'; export class Receipts { static Individual() { diff --git a/front-end/cypress/e2e/F3X/start-transaction/start-transaction.ts b/front-end/cypress/e2e/F3X/utils/start-transaction/start-transaction.ts similarity index 94% rename from front-end/cypress/e2e/F3X/start-transaction/start-transaction.ts rename to front-end/cypress/e2e/F3X/utils/start-transaction/start-transaction.ts index 72d1d4e7e5..4342d14e52 100644 --- a/front-end/cypress/e2e/F3X/start-transaction/start-transaction.ts +++ b/front-end/cypress/e2e/F3X/utils/start-transaction/start-transaction.ts @@ -1,4 +1,4 @@ -import { PageUtils } from '../../pages/pageUtils'; +import { PageUtils } from '../../../pages/pageUtils'; import { Receipts } from './receipts'; import { Disbursements, Independent } from './disbursements'; import { Loans } from './loans';