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

feature/1721 - Add Report review cypress test with a test to make sure summary page is recalculating on transaction create/update #2311

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion front-end/cypress/e2e/F3X/disbursements.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions front-end/cypress/e2e/F3X/reattributions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion front-end/cypress/e2e/F3X/receipts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions front-end/cypress/e2e/F3X/redesignations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion front-end/cypress/e2e/F3X/reports-f3x-debts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion front-end/cypress/e2e/F3X/reports-f3x-loans-bank.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
76 changes: 76 additions & 0 deletions front-end/cypress/e2e/F3X/review-report.cy.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});
23 changes: 23 additions & 0 deletions front-end/cypress/e2e/F3X/utils/review-report.ts
Original file line number Diff line number Diff line change
@@ -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');
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageUtils } from '../../pages/pageUtils';
import { PageUtils } from '../../../pages/pageUtils';

export class Debts {
static ByCommittee() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageUtils } from '../../pages/pageUtils';
import { PageUtils } from '../../../pages/pageUtils';

export class Disbursements {
static Contributions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageUtils } from '../../pages/pageUtils';
import { PageUtils } from '../../../pages/pageUtils';

export class Loans {
static FromBank() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PageUtils } from '../../pages/pageUtils';
import { PageUtils } from '../../../pages/pageUtils';

export class Receipts {
static Individual() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down