Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from ualibweb/pax
Browse files Browse the repository at this point in the history
Create Alabama format Cypress test
  • Loading branch information
nhanaa authored Sep 14, 2023
2 parents bca4947 + 824bd6b commit fe36035
Show file tree
Hide file tree
Showing 3 changed files with 281 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import settingsMenu from '../../../../support/fragments/settingsMenu';
import TransferFeeFine from '../../../../support/fragments/users/transferFeeFine';

describe('Build the Duke bursar transfer file', () => {
before(() => {
cy.loginAsAdmin({
path: settingsMenu.usersTransferCriteria,
waiter: TransferFeeFine.waitLoadingTransferCriteria,
});
});

it('should be able to open all the panes', () => {
TransferFeeFine.openAllPanes();
TransferFeeFine.verifyOpenAllPanes();
});

it('should be able to set scheduling', () => {
TransferFeeFine.setTransferCriteriaScheduling(
'Weeks',
'0',
'12:00 A',
['Monday', 'Thursday']
);
TransferFeeFine.verifyTransferCriteriaScheduling(
'WEEK',
'0',
'12:00 AM',
['Monday', 'Thursday']
);
});

it('should be able to set no criteria', () => {
TransferFeeFine.setCriteria(false);
TransferFeeFine.verifyCriteria(false);
});

// Aggregate by patron: Box unchecked
it('should be able to set aggregate by patron', () => {
TransferFeeFine.setAggregateByPatron(false);
TransferFeeFine.verifyAggregateByPatron(false);
});

// Header Format
it('should be able to set header format', () => {
TransferFeeFine.clearFormat('header');
TransferFeeFine.verifyClearFormat('header');
TransferFeeFine.addAlabamaHeaderFormat();
TransferFeeFine.verifyAddAlabamaHeaderFormat();
});

// Account Data Format
it('should be able to set account data format', () => {
TransferFeeFine.clearFormat('data');
TransferFeeFine.verifyClearFormat('data');
TransferFeeFine.addAlabamaDataFormat();
TransferFeeFine.verifyAddAlabamaDataFormat();
});

// Footer Format
it('should be able to set footer format', () => {
TransferFeeFine.clearFormat('footer');
TransferFeeFine.verifyClearFormat('footer');
});

// Transer account data to
it('should be able to set transfer account data to', () => {
TransferFeeFine.setTransferAccount('Lost Item Fine Office', 'acct');
TransferFeeFine.verifyTransferAccount('b25fd8e7-a0e7-4690-ab0b-94039739c0db', '90c1820f-60bf-4b9a-99f5-d677ea78ddca');
});

it('should be able to run manually', () => {
TransferFeeFine.runManually();
TransferFeeFine.verifyRunManually();
});
});
246 changes: 206 additions & 40 deletions cypress/support/fragments/users/transferFeeFine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { el } from 'date-fns/locale';
import {
Button,
Modal,
Expand Down Expand Up @@ -347,45 +346,6 @@ export default {
});
},

verifyAddDukeHeaderFormat() {
cy.get('section[id="accordion_10"]').within(() => {
cy.expect(Select({ name: 'header[0].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[0].text', value: 'Batch' }).exists());

cy.expect(Select({ name: 'header[1].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[1].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[2].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[2].format', value: 'YYYYMMDD' }).exists());
cy.expect(Select({ name: 'header[2].timezone', value: 'America/New_York' }).exists());

cy.expect(Select({ name: 'header[3].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[3].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[4].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[4].text', value: 'DU LIBRARY' }).exists());

cy.expect(Select({ name: 'header[5].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[5].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[6].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[6].format', value: 'QUARTER' }).exists());
cy.expect(Select({ name: 'header[6].timezone', value: 'America/New_York' }).exists());

cy.expect(Select({ name: 'header[7].type', value: 'AggregateTotal' }).exists());
cy.get('input[name="header[7].decimal"]').should('be.checked');

cy.expect(Select({ name: 'header[8].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[8].text', value: 'TXT_CNT' }).exists());

cy.expect(Select({ name: 'header[9].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[9].text', value: 'DU LIBRARIES DEBITS' }).exists());

cy.expect(Select({ name: 'header[10].type', value: 'Newline' }).exists());
});
},


addDukeDataFormat() {
cy.get('section[id="accordion_11"]').within(() => {
const numItems = 14;
Expand Down Expand Up @@ -441,6 +401,44 @@ export default {
cy.do(Select({ name: 'data[13].type' }).choose('Newline (LF)'));
},

verifyAddDukeHeaderFormat() {
cy.get('section[id="accordion_10"]').within(() => {
cy.expect(Select({ name: 'header[0].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[0].text', value: 'Batch' }).exists());

cy.expect(Select({ name: 'header[1].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[1].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[2].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[2].format', value: 'YYYYMMDD' }).exists());
cy.expect(Select({ name: 'header[2].timezone', value: 'America/New_York' }).exists());

cy.expect(Select({ name: 'header[3].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[3].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[4].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[4].text', value: 'DU LIBRARY' }).exists());

cy.expect(Select({ name: 'header[5].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[5].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[6].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[6].format', value: 'QUARTER' }).exists());
cy.expect(Select({ name: 'header[6].timezone', value: 'America/New_York' }).exists());

cy.expect(Select({ name: 'header[7].type', value: 'AggregateTotal' }).exists());
cy.get('input[name="header[7].decimal"]').should('be.checked');

cy.expect(Select({ name: 'header[8].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[8].text', value: 'TXT_CNT' }).exists());

cy.expect(Select({ name: 'header[9].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[9].text', value: 'DU LIBRARIES DEBITS' }).exists());

cy.expect(Select({ name: 'header[10].type', value: 'Newline' }).exists());
});
},

verifyAddDukeDataFormat() {
cy.get('section[id="accordion_11"]').within(() => {
cy.expect(Select({ name: 'data[0].type', value: 'UserData' }).exists());
Expand Down Expand Up @@ -484,4 +482,172 @@ export default {
cy.expect(Select({ name: 'data[13].type', value: 'Newline' }).exists());
});
},

// Alabama format Helper functions

addAlabamaHeaderFormat() {
cy.get('section[id="accordion_10"]').within(() => {
const numItems = 13;
for (let i = 0; i < numItems; i++) {
cy.get('button:contains("Add")').click();
}

cy.do(Select({ name: 'header[0].type' }).choose('Text'));
cy.do(TextField({ name: 'header[0].text' }).fillIn('$$$LIB'));

cy.do(Select({ name: 'header[1].type' }).choose('Current date'));
cy.do(Select({ name: 'header[1].format' }).choose('Day of year'));
cy.get('select[name="header[1].timezone"]').find('option[value="America/Chicago"]').eq(1).then($option => {
const $select = $option.prevObject.prevObject;
cy.wrap($select).select($option.index());
});

cy.do(Select({ name: 'header[2].type' }).choose('Current date'));
cy.do(Select({ name: 'header[2].format' }).choose('MMDDYYYY'));
cy.get('select[name="header[2].timezone"]').find('option[value="America/Chicago"]').eq(1).then($option => {
const $select = $option.prevObject.prevObject;
cy.wrap($select).select($option.index());
});

cy.do(Select({ name: 'header[3].type' }).choose('Text'));
cy.do(TextField({ name: 'header[3].text' }).fillIn('Library B&F'));

cy.do(Select({ name: 'header[4].type' }).choose('Tab'));

cy.do(Select({ name: 'header[5].type' }).choose('Text'));
cy.do(TextField({ name: 'header[5].text' }).fillIn('YBR'));

cy.do(Select({ name: 'header[6].type' }).choose('Number of accounts'));
this.setLengthControl('header[6]', '5', '0', true, 'Start');

cy.do(Select({ name: 'header[7].type' }).choose('Total amount'));
cy.get('input[name="header[7].decimal"]').check();

cy.do(Select({ name: 'header[8].type' }).choose('Current date'));
cy.do(Select({ name: 'header[8].format' }).choose('Year (4-digit)'));
cy.get('select[name="header[8].timezone"]').find('option[value="America/Chicago"]').eq(1).then($option => {
const $select = $option.prevObject.prevObject;
cy.wrap($select).select($option.index());
});

cy.do(Select({ name: 'header[9].type' }).choose('Current date'));
cy.do(Select({ name: 'header[9].format' }).choose('Quarter'));
cy.get('select[name="header[9].timezone"]').find('option[value="America/Chicago"]').eq(1).then($option => {
const $select = $option.prevObject.prevObject;
cy.wrap($select).select($option.index());
});

cy.do(Select({ name: 'header[10].type' }).choose('Whitespace'));
cy.do(TextField({ name: 'header[10].repeat' }).fillIn('1'));

cy.do(Select({ name: 'header[11].type' }).choose('Text'));
cy.do(TextField({ name: 'header[11].text' }).fillIn('WMURPHY'));

cy.do(Select({ name: 'header[12].type' }).choose('Newline (LF)'));
});
},

addAlabamaDataFormat() {
cy.get('section[id="accordion_11"]').within(() => {
const numItems = 8;
for (let i = 0; i < numItems; i++) {
cy.get('button:contains("Add")').click();
}
});

cy.do(Select({ name: 'data[0].type' }).choose('Text'));
cy.do(TextField({ name: 'data[0].text' }).fillIn('64A'));

cy.do(Select({ name: 'data[1].type' }).choose('User info'));
cy.do(Select({ name: 'data[1].userAttribute' }).choose('External ID'));

cy.do(Select({ name: 'data[2].type' }).choose('Text'));
cy.do(TextField({ name: 'data[2].text' }).fillIn('00000'));

cy.do(Select({ name: 'data[3].type' }).choose('Whitespace'));
cy.do(TextField({ name: 'data[3].repeat' }).fillIn('16'));

cy.do(Select({ name: 'data[4].type' }).choose('Account amount'));
cy.get('input[name="data[4].decimal"]').check({ force: true });
this.setLengthControl('data[4]', '9', '0', true, 'Start');

cy.do(Select({ name: 'data[5].type' }).choose('Whitespace'));
cy.do(TextField({ name: 'data[5].repeat' }).fillIn('48'));

cy.do(Select({ name: 'data[6].type' }).choose('Text'));
cy.do(TextField({ name: 'data[6].text' }).fillIn('N'));

cy.do(Select({ name: 'data[7].type' }).choose('Newline (LF)'));
},

verifyAddAlabamaHeaderFormat() {
cy.get('section[id="accordion_10"]').within(() => {
cy.expect(Select({ name: 'header[0].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[0].text', value: '$$$LIB' }).exists());

cy.expect(Select({ name: 'header[1].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[1].format', value: 'DAY_OF_YEAR' }).exists());
cy.expect(Select({ name: 'header[1].timezone', value: 'America/Chicago' }).exists());

cy.expect(Select({ name: 'header[2].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[2].format', value: 'MMDDYYYY' }).exists());
cy.expect(Select({ name: 'header[2].timezone', value: 'America/Chicago' }).exists());

cy.expect(Select({ name: 'header[3].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[3].text', value: 'Library B&F' }).exists());

cy.expect(Select({ name: 'header[4].type', value: 'Tab' }).exists());

cy.expect(Select({ name: 'header[5].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[5].text', value: 'YBR' }).exists());

cy.expect(Select({ name: 'header[6].type', value: 'AggregateCount' }).exists());
this.verifyLengthControl('header[6]', '5', '0', true, 'FRONT');

cy.expect(Select({ name: 'header[7].type', value: 'AggregateTotal' }).exists());
cy.get('input[name="header[7].decimal"]').should('be.checked');

cy.expect(Select({ name: 'header[8].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[8].format', value: 'YEAR_LONG' }).exists());

cy.expect(Select({ name: 'header[9].type', value: 'CurrentDate' }).exists());
cy.expect(Select({ name: 'header[9].format', value: 'QUARTER' }).exists());

cy.expect(Select({ name: 'header[10].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'header[10].repeat', value: '1' }).exists());

cy.expect(Select({ name: 'header[11].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'header[11].text', value: 'WMURPHY' }).exists());

cy.expect(Select({ name: 'header[12].type', value: 'Newline' }).exists());
});
},

verifyAddAlabamaDataFormat() {
cy.get('section[id="accordion_11"]').within(() => {
cy.expect(Select({ name: 'data[0].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'data[0].text', value: '64A' }).exists());

cy.expect(Select({ name: 'data[1].type', value: 'UserData' }).exists());
cy.expect(Select({ name: 'data[1].userAttribute', value: 'EXTERNAL_SYSTEM_ID' }).exists());

cy.expect(Select({ name: 'data[2].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'data[2].text', value: '00000' }).exists());

cy.expect(Select({ name: 'data[3].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'data[3].repeat', value: '16' }).exists());

cy.expect(Select({ name: 'data[4].type', value: 'FeeAmount' }).exists());
cy.get('input[name="data[4].decimal"]').should('be.checked');
this.verifyLengthControl('data[4]', '9', '0', true, 'FRONT');

cy.expect(Select({ name: 'data[5].type', value: 'Space' }).exists());
cy.expect(TextField({ name: 'data[5].repeat', value: '48' }).exists());

cy.expect(Select({ name: 'data[6].type', value: 'Constant' }).exists());
cy.expect(TextField({ name: 'data[6].text', value: 'N' }).exists());

cy.expect(Select({ name: 'data[7].type', value: 'Newline' }).exists());
});
}
};

0 comments on commit fe36035

Please sign in to comment.