/**
|
* @file ADSO-10266
|
* @description Transportation Accounts display relevant accounts
|
* @author Pethaperumal Natarajan (Pethaperumal.NATARAJAN.intern@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
|
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
|
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
|
import { StepList } from '../../../libappsop/listsop';
|
import { ListTransportationAccounts, ListTransportationAccountsColumn } from '../../../libmp/forms/form.transportationaccounts';
|
import { ListAccount, ListAccountColumn } from '../../../libmp/forms/form.account';
|
import { DataFoodBaseAccountCostDriver, DataFoodBaseAccountName, DataFoodBaseAccountUoM } from '../../../libmp/data/data.account';
|
|
describe('ADSO-10266 - Transportation Accounts display relevant accounts', () => {
|
const appMP = AppMP.getInstance();
|
const listTransportationAccounts = appMP.viewTransportationCost.formTransportationAccounts.listTransportationAccounts;
|
const listAccounts = appMP.viewAccount.frmAccount.listAccount;
|
|
const defaultNumRows = 6;
|
|
const transportationAccountSourcingCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.SourcingCost, 'Default value': '100', 'Default UoM': DataFoodBaseAccountUoM.EuroPerTon };
|
const transportationAccountTransportationCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.TransportationCost, 'Default value': '100', 'Default UoM': DataFoodBaseAccountUoM.EuroPerTon };
|
const transportationAccountOperatingCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.OperatingCost, 'Default value': '100', 'Default UoM': DataFoodBaseAccountUoM.EuroPerTon };
|
const transportationAccountProcessPreferenceCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.ProcessPreferenceCost, 'Default value': '10', 'Default UoM': DataFoodBaseAccountUoM.EuroPerTon };
|
const transportationAccountSourcingLotCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.SourcingLotCost, 'Default value': '100', 'Default UoM': DataFoodBaseAccountUoM.EuroPerLot };
|
const transportationAccountTransportationLotCost: ListTransportationAccountsColumn = { Account: DataFoodBaseAccountName.TransportationLotCost, 'Default value': '100', 'Default UoM': DataFoodBaseAccountUoM.EuroPerLot };
|
|
const accountCostOfSales: ListAccountColumn = { Name: DataFoodBaseAccountName.CostOfSales };
|
const accountTransportationCost: ListAccountColumn = { Name: DataFoodBaseAccountName.TransportationCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Volume };
|
const accountOperatingCost: ListAccountColumn = { Name: DataFoodBaseAccountName.OperatingCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Volume };
|
const accountSourcingCost: ListAccountColumn = { Name: DataFoodBaseAccountName.SourcingCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Volume };
|
const accountProcessPreferenceCost: ListAccountColumn = { Name: DataFoodBaseAccountName.ProcessPreferenceCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Volume };
|
const accountTransportationLotCost: ListAccountColumn = { Name: DataFoodBaseAccountName.TransportationLotCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Lot };
|
const accountSourcingLotCost: ListAccountColumn = { Name: DataFoodBaseAccountName.SourcingLotCost, 'Default cost driver': DataFoodBaseAccountCostDriver.Lot };
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewAccount);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}`, async () => {
|
await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false);
|
});
|
|
it(`Step 2 - Open view ${appMP.viewTransportationCost.viewPath}.`, async () => {
|
await appMP.viewTransportationCost.switchTo();
|
});
|
|
it(`Step 3 - ${StepList.verifyTotalRow(ListTransportationAccounts.title, defaultNumRows)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountSourcingCost)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountTransportationCost)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountOperatingCost)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountProcessPreferenceCost)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountSourcingLotCost)} ${StepList.verifyRowExists(ListTransportationAccounts.title, transportationAccountTransportationLotCost)}`, async () => {
|
await listTransportationAccounts.verifyTotalRow(defaultNumRows);
|
// Verifying that rows contain Account, Default value and Default UoM
|
await listTransportationAccounts.verifyRowExists(transportationAccountSourcingCost);
|
await listTransportationAccounts.verifyRowExists(transportationAccountTransportationCost);
|
await listTransportationAccounts.verifyRowExists(transportationAccountOperatingCost);
|
await listTransportationAccounts.verifyRowExists(transportationAccountProcessPreferenceCost);
|
await listTransportationAccounts.verifyRowExists(transportationAccountSourcingLotCost);
|
await listTransportationAccounts.verifyRowExists(transportationAccountTransportationLotCost);
|
});
|
|
it(`Step 4 - Open view ${appMP.viewAccount.viewPath}.`, async () => {
|
await appMP.viewAccount.switchTo();
|
});
|
|
it(`Step 5 - ${StepList.verifyRowExists(ListAccount.title, accountTransportationCost, [accountCostOfSales])} ${StepList.verifyRowExists(ListAccount.title, accountOperatingCost, [accountCostOfSales])} ${StepList.verifyRowExists(ListAccount.title, accountSourcingCost, [accountCostOfSales])} ${StepList.verifyRowExists(ListAccount.title, accountProcessPreferenceCost)} ${StepList.verifyRowExists(ListAccount.title, accountTransportationLotCost, [accountCostOfSales])}, ${StepList.verifyRowExists(ListAccount.title, accountSourcingLotCost, [accountCostOfSales])}`, async () => {
|
// Verify all these accounts have one of the two cost drivers: Volume & Lot
|
await listAccounts.verifyRowExists(accountTransportationCost, [accountCostOfSales]);
|
await listAccounts.verifyRowExists(accountOperatingCost, [accountCostOfSales]);
|
await listAccounts.verifyRowExists(accountSourcingCost, [accountCostOfSales]);
|
await listAccounts.verifyRowExists(accountProcessPreferenceCost);
|
await listAccounts.verifyRowExists(accountTransportationLotCost, [accountCostOfSales]);
|
await listAccounts.verifyRowExists(accountSourcingLotCost, [accountCostOfSales]);
|
});
|
});
|