178 lines
7.8 KiB
TypeScript
178 lines
7.8 KiB
TypeScript
import { browser, protractor } from 'protractor';
|
|
import { PageObjectTools } from '../shared/page-object-tools';
|
|
import { HelocPageOnePo } from './pages/page-one.po';
|
|
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
|
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
|
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
|
import { HmdaPagePo } from '../shared/pages/hmda-page.po';
|
|
import { CollateralPagePo } from '../shared/pages/collateral-page.po';
|
|
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
|
import { CreditCardDisclosuresPagePo } from '../credit-card/pages/page-disclosures.po';
|
|
|
|
describe('It should create a maximum HELOC application ', () => {
|
|
|
|
it('should accept maximum inputs for page 1 (Member/Loan Type)', () => {
|
|
const page = new HelocPageOnePo();
|
|
browser.get(page.PAGE_URL);
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for page 2 (Personal Info)', () => {
|
|
const page = new ContactPagePo();
|
|
expect(page.getFocusedElement()).toEqual(page.getFirstElement());
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximumCoApplicant();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for page 3 (Residence)', () => {
|
|
const page = new ResidencePagePo();
|
|
expect(page.getFocusedElement()).toEqual(page.getFirstElement(page.DEFAULT_PREFIX));
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMinimal();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for HMDA page (HMDA: Race/Ethnicity/Gender)', () => {
|
|
const page = new HmdaPagePo();
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
|
|
it('should accept maximum inputs for page 4 (Employment)', () => {
|
|
const page = new EmploymentPagePo();
|
|
let inputArray = PageObjectTools.findFieldsInPageByIdArray(page.STARTING_FIELDS, page.DEFAULT_PREFIX);
|
|
expect(inputArray.length).toEqual(page.STARTING_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.showEmploymentFields();
|
|
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.STARTING_FIELDS, ...page.EMPLOYMENT_FIELDS], page.DEFAULT_PREFIX);
|
|
expect(inputArray.length).toEqual([...page.STARTING_FIELDS, ...page.EMPLOYMENT_FIELDS].length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.showOtherIncomeFields();
|
|
page.showChildSupportFields();
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillChildSupportFields();
|
|
page.fillOtherIncomeFields();
|
|
page.markSingleIncomeNotEnough();
|
|
// Will no longer happen.
|
|
// expect(page.canGoNext()).toEqual(false);
|
|
// page.fillSecondIncome();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for page 2.A (Co-Applicant Personal Info)', () => {
|
|
const page = new ContactPagePo();
|
|
const EC = protractor.ExpectedConditions;
|
|
browser.wait(EC.visibilityOf(page.getFirstElement()), 5000).then(() => {});
|
|
expect(page.getFocusedElement()).toEqual(page.getFirstElement());
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.COAPP_FIELDS);
|
|
expect(inputArray.length).toEqual(page.COAPP_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximumCoApplicantNonPrimary();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
|
|
it('should accept maximum inputs for page 3.A (Co-applicant Residence)', () => {
|
|
const page = new ResidencePagePo();
|
|
page.markAddressNotSame();
|
|
expect(page.getFocusedElement()).toEqual(page.getFirstElement(page.DEFAULT_PREFIX));
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMinimal();
|
|
page.showMailingAddress();
|
|
page.showSecondAddress();
|
|
page.fillAdditionalFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for co-applicant HMDA page (Co-applicant HMDA: Race/Ethnicity/Gender)', () => {
|
|
const page = new HmdaPagePo();
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for page 4.A (Co-applicant Employment)', () => {
|
|
const page = new EmploymentPagePo();
|
|
let inputArray = PageObjectTools.findFieldsInPageByIdArray(page.STARTING_FIELDS);
|
|
expect(inputArray.length).toEqual(page.STARTING_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.showEmploymentFields();
|
|
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.EMPLOYMENT_FIELDS], page.DEFAULT_PREFIX);
|
|
expect(inputArray.length).toEqual([...page.EMPLOYMENT_FIELDS].length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.showOtherIncomeFields();
|
|
page.showChildSupportFields();
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillChildSupportFields();
|
|
page.fillOtherIncomeFields();
|
|
page.markSingleIncomeNotEnough();
|
|
// Will no longer happen.
|
|
// expect(page.canGoNext()).toEqual(false);
|
|
// page.fillSecondIncome();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for collateral page (Collateral)', () => {
|
|
const page = new CollateralPagePo();
|
|
const EC = protractor.ExpectedConditions;
|
|
browser.wait(EC.visibilityOf(page.getFirstElement()), 5000).then(() => {});
|
|
expect(page.getFocusedElement()).toEqual(page.getFirstElement());
|
|
let inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.ALL_FIELDS, ...page.ADDRESS_FIELDS, ...page.LIEN_POSITION_FIELDS]);
|
|
expect(inputArray.length).toEqual([...page.ALL_FIELDS, ...page.ADDRESS_FIELDS, ...page.LIEN_POSITION_FIELDS].length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMaximum();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should accept maximum inputs for page 5 (Disclosures)', () => {
|
|
const page = new CreditCardDisclosuresPagePo();
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
expect(page.canGoNext()).toEqual(false);
|
|
page.fillFieldsMinimal();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
page.submit();
|
|
});
|
|
|
|
it('should show application information on page 6 (Summary)', () => {
|
|
const page = new SummaryPagePo();
|
|
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.ALL_FIELDS);
|
|
expect(inputArray.length).toEqual(page.ALL_FIELDS.length);
|
|
page.fillFieldsMinimal();
|
|
expect(page.canGoNext()).toEqual(true);
|
|
});
|
|
|
|
});
|