/**
|
* @file ADSO-10087 - Accounts list shows accounts for unit costs with correct information
|
* @description Create 4 new accounts and verify their correct creation
|
* @author Umar Adkhamov (umar.adkhamov@3ds.com)
|
* @copyright Dassault Systemes
|
*/
|
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
|
import { DataFoodBaseAccountCostDriver, DataFoodBaseAccountName, DataFoodBaseAccountTimeUnit, DataFoodBaseAccountUoM } from '../../../libmp/data/data.account';
|
import { ListAccountContextMenuItem } from '../../../libmp/forms/form.account';
|
import { AccountCostType } from '../../../libmp/views/view.account';
|
|
describe('ADSO-10087 - Accounts list shows accounts for unit costs with correct information', () => {
|
const appMP = AppMP.getInstance();
|
const costDriverCO = DataFoodBaseAccountCostDriver.Changeover;
|
const parentCostOfSales = [{ Name: DataFoodBaseAccountName.CostOfSales }];
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Setup - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => {
|
await appMP.createDemoDataset(Demo.Food, Scenario.Base, false); // This test does not need wait optimizer completed before proceed
|
});
|
|
it(`Step 1 - Open view ${appMP.viewAccount.viewPath}.<br>
|
Edit account '${AccountCostType.General}', set cost driver = ${DataFoodBaseAccountCostDriver.Fixed}, cost = 1000, time unit= ${DataFoodBaseAccountTimeUnit.Month}.<br>
|
Edit account '${AccountCostType.Changeover}', set cost driver = ${costDriverCO}, cost = 100.<br>
|
Create account '${AccountCostType.Maintenance}', set cost driver = Number of units, cost = 5000, time unit=${DataFoodBaseAccountTimeUnit.Year}.<br>
|
Create account '${AccountCostType.Labor}', set cost driver = Staffing, cost = 40.`, async () => {
|
await appMP.viewAccount.switchTo();
|
|
// In Food demo, General fixed costs, Labor cost & Changeover cost already exist
|
// Edit other values beside the name for these accounts
|
let accountRow = await appMP.viewAccount.frmAccount.listAccount.getRow({ Name: AccountCostType.General }, parentCostOfSales);
|
let [dlgAccount] = await appMP.viewAccount.frmAccount.listAccount.selectContextMenu(ListAccountContextMenuItem.Edit, accountRow);
|
await dlgAccount.updateDialogValues({ CostDriver: DataFoodBaseAccountCostDriver.Fixed, Cost: '1000', TimeUnit: DataFoodBaseAccountTimeUnit.Month });
|
await dlgAccount.clickOK();
|
|
accountRow = await appMP.viewAccount.frmAccount.listAccount.getRow({ Name: AccountCostType.Labor }, parentCostOfSales);
|
[dlgAccount] = await appMP.viewAccount.frmAccount.listAccount.selectContextMenu(ListAccountContextMenuItem.Edit, accountRow);
|
await dlgAccount.updateDialogValues({ CostDriver: 'Staffing', Cost: '40' });
|
await dlgAccount.clickOK();
|
|
accountRow = await appMP.viewAccount.frmAccount.listAccount.getRow({ Name: AccountCostType.Changeover }, parentCostOfSales);
|
[dlgAccount] = await appMP.viewAccount.frmAccount.listAccount.selectContextMenu(ListAccountContextMenuItem.Edit, accountRow);
|
await dlgAccount.updateDialogValues({ CostDriver: costDriverCO, Cost: '100' });
|
await dlgAccount.clickOK();
|
|
// Create as not exist in Food demo
|
[dlgAccount] = await appMP.viewAccount.frmAccount.listAccount.selectContextMenu(ListAccountContextMenuItem.Create);
|
await dlgAccount.updateDialogValues({ Name: AccountCostType.Maintenance, ParentAccountName: DataFoodBaseAccountName.CostOfSales, CostDriver: 'Number of units', Cost: '5000', TimeUnit: DataFoodBaseAccountTimeUnit.Year });
|
await dlgAccount.clickOK();
|
});
|
|
it(`Step 2 - Open view ${appMP.viewUnitCost.viewPath}. Verify the 4 accounts display correctly in Unit Accounts form.`, async () => {
|
await appMP.viewUnitCost.switchTo();
|
|
const euroMonth = DataFoodBaseAccountUoM.EuroPerMonth;
|
const euroYear = DataFoodBaseAccountUoM.EuroPerYear;
|
const euroDay = DataFoodBaseAccountUoM.EuroPerHour;
|
const euroChangeOver = `${DataFoodBaseAccountUoM.EuroPer}${costDriverCO}`;
|
|
// Verify that all the 4 unit accounts have the correct values as above
|
let accountRow = await appMP.viewUnitCost.frmUnitAccount.listAccount.getRow({ Account: AccountCostType.General });
|
await appMP.viewUnitCost.frmUnitAccount.listAccount.verifyRowValues(accountRow, { 'Default value': '1,000', 'Default UoM': euroMonth });
|
|
accountRow = await appMP.viewUnitCost.frmUnitAccount.listAccount.getRow({ Account: AccountCostType.Maintenance });
|
await appMP.viewUnitCost.frmUnitAccount.listAccount.verifyRowValues(accountRow, { 'Default value': '5,000', 'Default UoM': euroYear });
|
|
accountRow = await appMP.viewUnitCost.frmUnitAccount.listAccount.getRow({ Account: AccountCostType.Labor });
|
await appMP.viewUnitCost.frmUnitAccount.listAccount.verifyRowValues(accountRow, { 'Default value': '40', 'Default UoM': euroDay });
|
|
accountRow = await appMP.viewUnitCost.frmUnitAccount.listAccount.getRow({ Account: AccountCostType.Changeover });
|
await appMP.viewUnitCost.frmUnitAccount.listAccount.verifyRowValues(accountRow, { 'Default value': '100', 'Default UoM': euroChangeOver });
|
});
|
});
|