Adding
This commit is contained in:
+153
@@ -0,0 +1,153 @@
|
||||
import { browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { CreditCardPageOnePo } from './pages/page-one.po';
|
||||
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
||||
import { PageObjectTools } from '../shared/page-object-tools';
|
||||
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
||||
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
||||
import { CreditCardDisclosuresPagePo } from './pages/page-disclosures.po';
|
||||
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
||||
import { SpouseTypePagePo } from '../shared/pages/spouse-type-page.po';
|
||||
|
||||
describe('It should create a credit card application for 4 full info individuals', () => {
|
||||
|
||||
it('should accept maximum inputs for page 1 (Member/Loan Type)', () => {
|
||||
const page = new CreditCardPageOnePo();
|
||||
browser.get(page.PAGE_URL);
|
||||
browser.sleep(1000);
|
||||
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);
|
||||
page.fillFieldsMaximum();
|
||||
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.ALL_FIELDS, ...page.HIDDEN_FIELDS_1]);
|
||||
expect(inputArray.length).toEqual(page.ALL_FIELDS.length + page.HIDDEN_FIELDS_1.length);
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 2.A (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.fillFieldsPrimaryMarriedButNotMarriedToCoApplicant();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.A (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.fillFieldsMinimalLivingInWI();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.A (Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept FULL INFO SPOUSE input for Applicant spouse type page', () => {
|
||||
const page = new SpouseTypePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsFullInfoSpouse();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 2.B (Applicant\'s Spouse Personal Info)', () => {
|
||||
const page = new ContactPagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimalNoMarital();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.B (Applicant\'s Spouse Residence)', () => {
|
||||
const page = new ResidencePagePo();
|
||||
page.markAddressSame();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.B (Applicant\'s Spouse Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept maximum inputs for page 2.C (Co-Applicant Personal Info)', () => {
|
||||
const page = new ContactPagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMaximumCoApplicantNonPrimary();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.C (Co-applicant Residence)', () => {
|
||||
const page = new ResidencePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimalLivingInWI();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.C (Co-applicant Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept FULL INFO SPOUSE input for CoApplicant spouse type page', () => {
|
||||
const page = new SpouseTypePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsFullInfoSpouse();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 2.D (CoApplicant\'s Spouse Personal Info)', () => {
|
||||
const page = new ContactPagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimalNoMarital();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.D (CoApplicant\'s Spouse Residence)', () => {
|
||||
const page = new ResidencePagePo();
|
||||
page.markAddressSame();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.D (CoApplicant\'s Spouse Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should 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);
|
||||
});
|
||||
});
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
import { browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { CreditCardPageOnePo } from './pages/page-one.po';
|
||||
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
||||
import { PageObjectTools } from '../shared/page-object-tools';
|
||||
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
||||
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
||||
import { CreditCardDisclosuresPagePo } from './pages/page-disclosures.po';
|
||||
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
||||
import { WizardPagePo } from '../shared/pages/wizard-page.po';
|
||||
|
||||
describe('It should allow free navigation of a completed credit card application', () => {
|
||||
|
||||
it('should accept maximum inputs for page 1.', () => {
|
||||
const page = new CreditCardPageOnePo();
|
||||
browser.get(page.PAGE_URL);
|
||||
page.fillFieldsMaximum();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept maximum inputs for page 2 (Personal Info)', () => {
|
||||
const page = new ContactPagePo();
|
||||
page.fillFieldsMaximumCoApplicant();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept maximum inputs for page 3 (Residence)', () => {
|
||||
const page = new ResidencePagePo();
|
||||
page.fillFieldsMinimal();
|
||||
page.showMailingAddress();
|
||||
page.showSecondAddress();
|
||||
page.fillAdditionalFieldsMaximum();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept maximum inputs for page 4 (Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
page.showEmploymentFields();
|
||||
page.showOtherIncomeFields();
|
||||
page.showChildSupportFields();
|
||||
page.fillFieldsMaximum();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillChildSupportFields();
|
||||
page.fillOtherIncomeFields();
|
||||
page.markSingleIncomeNotEnough();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
// Will no longer happen.
|
||||
// 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();
|
||||
page.fillFieldsMaximum();
|
||||
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 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 maximum inputs for page 5 (Disclosures)', () => {
|
||||
const page = new CreditCardDisclosuresPagePo();
|
||||
page.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
});
|
||||
|
||||
it('should jump back to the beginning.', () => {
|
||||
const urlList = [
|
||||
'http://localhost:4200/loan-wizard/cc/cb/co-applicant-financial',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/co-applicant-residential',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/co-applicant-personal',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/step-4',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/step-3',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/step-2',
|
||||
'http://localhost:4200/loan-wizard/cc/cb/step-1'
|
||||
];
|
||||
const page = new WizardPagePo();
|
||||
urlList.forEach((eachUrl) => {
|
||||
expect(page.canGoPrevious()).toEqual(true);
|
||||
page.goPrevious();
|
||||
browser.getCurrentUrl().then((newUrl) => {
|
||||
expect(newUrl).toEqual(eachUrl);
|
||||
});
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
|
||||
}, this);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
import { browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { CreditCardPageOnePo } from './pages/page-one.po';
|
||||
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
||||
import { PageObjectTools } from '../shared/page-object-tools';
|
||||
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
||||
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
||||
import { CreditCardDisclosuresPagePo } from './pages/page-disclosures.po';
|
||||
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
||||
|
||||
describe('It should create a maximum credit card application ', () => {
|
||||
|
||||
it('should accept maximum inputs for page 1 (Member/Loan Type)', () => {
|
||||
const page = new CreditCardPageOnePo();
|
||||
browser.get(page.PAGE_URL);
|
||||
browser.sleep(1000);
|
||||
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);
|
||||
page.fillFieldsMaximum();
|
||||
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.ALL_FIELDS, ...page.HIDDEN_FIELDS_1]);
|
||||
expect(inputArray.length).toEqual(page.ALL_FIELDS.length + page.HIDDEN_FIELDS_1.length);
|
||||
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();
|
||||
page.showMailingAddress();
|
||||
page.showSecondAddress();
|
||||
page.fillAdditionalFieldsMaximum();
|
||||
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);
|
||||
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 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 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 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);
|
||||
});
|
||||
|
||||
});
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
import { browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { CreditCardPageOnePo } from './pages/page-one.po';
|
||||
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
||||
import { PageObjectTools } from '../shared/page-object-tools';
|
||||
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
||||
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
||||
import { CreditCardDisclosuresPagePo } from './pages/page-disclosures.po';
|
||||
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
||||
|
||||
describe('It should create a minimal credit card application ', () => {
|
||||
|
||||
it('should accept basic inputs for page 1 (Member/Loan Type)', () => {
|
||||
const page = new CreditCardPageOnePo();
|
||||
browser.get(page.PAGE_URL);
|
||||
browser.sleep(1000);
|
||||
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.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.fillFieldsForFailureToConfirmJointCredit();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.dismissModalByOkayButton();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept basic 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.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept basic 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 basic inputs for page 4 (Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
const inputArray = PageObjectTools.findFieldsInPageByIdArray(page.STARTING_FIELDS);
|
||||
expect(inputArray.length).toEqual(page.STARTING_FIELDS.length);
|
||||
// For a minimal credit card, don't enter any income :-)
|
||||
// expect(page.canGoNext()).toEqual(false);
|
||||
// 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.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept basic 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);
|
||||
});
|
||||
|
||||
// We could go to the next page, but we'd create X loans every time we run these tests...
|
||||
});
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
import { browser, by, element, ElementFinder, protractor } from 'protractor';
|
||||
import { CreditCardPageOnePo } from './pages/page-one.po';
|
||||
import { ContactPagePo } from '../shared/pages/contact-page.po';
|
||||
import { PageObjectTools } from '../shared/page-object-tools';
|
||||
import { ResidencePagePo } from '../shared/pages/residence-page.po';
|
||||
import { EmploymentPagePo } from '../shared/pages/employment-page.po';
|
||||
import { CreditCardDisclosuresPagePo } from './pages/page-disclosures.po';
|
||||
import { SummaryPagePo } from '../shared/pages/summary-page.po';
|
||||
import { SpouseTypePagePo } from '../shared/pages/spouse-type-page.po';
|
||||
import { TattleSpousePagePo } from '../shared/pages/tattle-spouse-page.po';
|
||||
|
||||
describe('It should create a credit card application for 2 full info individuals + 2 tattle spouses', () => {
|
||||
|
||||
it('should accept maximum inputs for page 1 (Member/Loan Type)', () => {
|
||||
const page = new CreditCardPageOnePo();
|
||||
browser.get(page.PAGE_URL);
|
||||
browser.sleep(1000);
|
||||
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);
|
||||
page.fillFieldsMaximum();
|
||||
inputArray = PageObjectTools.findFieldsInPageByIdArray([...page.ALL_FIELDS, ...page.HIDDEN_FIELDS_1]);
|
||||
expect(inputArray.length).toEqual(page.ALL_FIELDS.length + page.HIDDEN_FIELDS_1.length);
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 2.A (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.fillFieldsPrimaryMarriedButNotMarriedToCoApplicant();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.A (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.fillFieldsMinimalLivingInWI();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.A (Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept TATTLE SPOUSE input for Applicant spouse type page', () => {
|
||||
const page = new SpouseTypePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsTattleSpouse();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for tattle spouse page (Applicant\'s Spouse Tattle Info)', () => {
|
||||
const page = new TattleSpousePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
|
||||
it('should accept maximum inputs for page 2.C (Co-Applicant Personal Info)', () => {
|
||||
const page = new ContactPagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMaximumCoApplicantNonPrimary();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 3.C (Co-applicant Residence)', () => {
|
||||
const page = new ResidencePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimalLivingInWI();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for page 4.C (Co-applicant Employment)', () => {
|
||||
const page = new EmploymentPagePo();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept TATTLE SPOUSE input for CoApplicant spouse type page', () => {
|
||||
const page = new SpouseTypePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsTattleSpouse();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should accept minimum inputs for tattle spouse page (CoApplicant\'s Spouse Tattle Info)', () => {
|
||||
const page = new TattleSpousePagePo();
|
||||
expect(page.canGoNext()).toEqual(false);
|
||||
page.fillFieldsMinimal();
|
||||
expect(page.canGoNext()).toEqual(true);
|
||||
page.submit();
|
||||
});
|
||||
|
||||
it('should 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);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { browser, by, element, ElementFinder, protractor, promise } from 'protractor';
|
||||
import { PageObjectTools } from '../../shared/page-object-tools';
|
||||
|
||||
export class CreditCardDisclosuresPagePo {
|
||||
|
||||
public readonly PAGE_URL = '/loan-wizard/cc/cb/disclosures';
|
||||
|
||||
public readonly DISCLOSE_TRUTHFUL = 'truthful';
|
||||
public readonly DISCLOSE_CONTACT = 'contact';
|
||||
public readonly NEXT_BUTTON = 'buttonNext';
|
||||
public readonly ALL_FIELDS = [
|
||||
this.DISCLOSE_TRUTHFUL, this.DISCLOSE_CONTACT,
|
||||
this.NEXT_BUTTON];
|
||||
|
||||
|
||||
public canGoNext(): promise.Promise<boolean> {
|
||||
const nextButton = element(by.id(this.NEXT_BUTTON));
|
||||
if (nextButton) {
|
||||
return nextButton.isEnabled();
|
||||
}
|
||||
throw new Error('Couldn\'t get next button');
|
||||
}
|
||||
|
||||
public submit(): void {
|
||||
const nextButton = element(by.id(this.NEXT_BUTTON));
|
||||
nextButton.click();
|
||||
}
|
||||
|
||||
public fillFieldsMinimal(): void {
|
||||
const truthful = element(by.id(this.DISCLOSE_TRUTHFUL));
|
||||
PageObjectTools.clickCheckBox(truthful);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { browser, by, element, ElementFinder, protractor, promise } from 'protractor';
|
||||
import { PageObjectTools } from '../../shared/page-object-tools';
|
||||
import { TestInputSet, TestInputCommand, TestingInputType } from '../../shared/data-driven/test-input-command';
|
||||
|
||||
export class CreditCardPageOnePo {
|
||||
|
||||
public readonly PAGE_URL = '/loan-wizard/cc/cb/step-1';
|
||||
|
||||
public readonly LIMIT_REQUESTED = 'inputLimitRequested';
|
||||
public readonly ANOTHER_PERSON = 'inputApplicantType';
|
||||
public readonly LIVE_IN_WI = 'inputLivesInMaritalPropertyState';
|
||||
public readonly JOINT_CREDIT = 'inputConfirmJointCredit';
|
||||
public readonly CO_APP_LIVE_IN_WI = 'inputCoAppLivesInMaritalPropertyState';
|
||||
public readonly NEXT_BUTTON = 'buttonNext';
|
||||
public readonly MODAL_CLOSE_BUTTON = 'modalCloseButton';
|
||||
public readonly MODAL_OKAY_BUTTON = 'modalOkayButton';
|
||||
public readonly ALL_FIELDS = [this.LIMIT_REQUESTED, this.ANOTHER_PERSON, this.LIVE_IN_WI, this.NEXT_BUTTON];
|
||||
public readonly HIDDEN_FIELDS_1 = [this.JOINT_CREDIT, this.CO_APP_LIVE_IN_WI];
|
||||
|
||||
public readonly MINIMAL_DATA: TestInputSet = [
|
||||
{ fieldId: this.LIMIT_REQUESTED, fieldValue: 1234, fieldType: TestingInputType.TEXT },
|
||||
{ fieldId: this.ANOTHER_PERSON, fieldValue: 1, fieldType: TestingInputType.RADIO },
|
||||
{ fieldId: this.LIVE_IN_WI, fieldValue: 1, fieldType: TestingInputType.RADIO }
|
||||
];
|
||||
|
||||
public readonly MAXIMUM_DATA: TestInputSet = [
|
||||
{ fieldId: this.LIMIT_REQUESTED, fieldValue: 1234, fieldType: TestingInputType.TEXT },
|
||||
{ fieldId: this.ANOTHER_PERSON, fieldValue: 0, fieldType: TestingInputType.RADIO },
|
||||
{ fieldId: this.LIVE_IN_WI, fieldValue: 0, fieldType: TestingInputType.RADIO },
|
||||
{ fieldId: this.JOINT_CREDIT, fieldValue: 0, fieldType: TestingInputType.RADIO },
|
||||
{ fieldId: this.CO_APP_LIVE_IN_WI, fieldValue: 0, fieldType: TestingInputType.RADIO }
|
||||
];
|
||||
|
||||
public readonly JOINT_CREDIT_DATA: TestInputSet = [
|
||||
{ fieldId: this.ANOTHER_PERSON, fieldValue: 0, fieldType: TestingInputType.RADIO },
|
||||
{ fieldId: this.JOINT_CREDIT, fieldValue: 1, fieldType: TestingInputType.RADIO }
|
||||
];
|
||||
|
||||
public canGoNext(): promise.Promise<boolean> {
|
||||
const nextButton = element(by.id(this.NEXT_BUTTON));
|
||||
if (nextButton) {
|
||||
return nextButton.isEnabled();
|
||||
}
|
||||
throw new Error('Couldn\'t get next button');
|
||||
}
|
||||
|
||||
public submit(): void {
|
||||
const nextButton = element(by.id(this.NEXT_BUTTON));
|
||||
nextButton.click();
|
||||
}
|
||||
|
||||
public fillFieldsForFailureToConfirmJointCredit(): void {
|
||||
PageObjectTools.fillFields(this.JOINT_CREDIT_DATA);
|
||||
}
|
||||
|
||||
public dismissModalByOkayButton(): void {
|
||||
const modalOkayButton = element(by.id(this.MODAL_OKAY_BUTTON));
|
||||
modalOkayButton.click();
|
||||
}
|
||||
|
||||
public fillFieldsMinimal(): void {
|
||||
PageObjectTools.fillFields(this.MINIMAL_DATA);
|
||||
}
|
||||
|
||||
public fillFieldsMaximum(): void {
|
||||
PageObjectTools.fillFields(this.MAXIMUM_DATA);
|
||||
}
|
||||
|
||||
public getFocusedElement() {
|
||||
return PageObjectTools.getFocusedElement();
|
||||
}
|
||||
|
||||
public getFirstElement() {
|
||||
return PageObjectTools.getElementsIdField(this.LIMIT_REQUESTED);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user