/**
|
* @file ADSO-10125
|
* @description Operation account display relevant account
|
* @testcategory Web - Financials - Operations
|
* @author Gay Er Xuan (erxuan.gay@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
|
import { ListOperationAccountColumn } from '../../../libmp/forms/form.operationaccount';
|
import { ListRow } from '../../../e2elib/lib/src/pageobjects/list/listrow.component';
|
|
describe('ADSO-10125 - Operation account display relevant account', () => {
|
const appMP = AppMP.getInstance();
|
const operationAccs = ['Operation utilization penalty', 'Labor cost', 'Rework cost', 'Sourcing(Lot) cost', 'Transportation(Lot) Cost', 'Operating cost', 'Sourcing cost', 'Transportation cost', 'Process preference cost'];
|
const costDrivers = ['Time', 'Volume', 'Lot', 'One time cost'];
|
|
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);
|
});
|
|
it(`Step 1 - Open view ${appMP.viewOperationCost.viewPath}. Verify ${operationAccs.length} accounts exist in operation account list`, async () => {
|
// Switch to operation cost view
|
await appMP.viewOperationCost.switchTo();
|
const listOperationAccount = appMP.viewOperationCost.frmOperationsAccount.listOperationAccount;
|
// Verify Account, Default value, and Default UoM column is shown in the list
|
expect(await listOperationAccount.getColumnByValue(ListOperationAccountColumn.Account)).toBeDefined('Account column should exist in operation account list');
|
expect(await listOperationAccount.getColumnByValue(ListOperationAccountColumn.DefaultValue)).toBeDefined('Default value column should exist in operation account list');
|
expect(await listOperationAccount.getColumnByValue(ListOperationAccountColumn.DefaultUoM)).toBeDefined('Default UoM column should exist in operation account list');
|
// Verify the account number in the list
|
expect(await listOperationAccount.getOperationAccountCount()).toBe(operationAccs.length, `The number of account in operation account list should be ${operationAccs.length}`);
|
// Verify each of the account is in the list
|
for (const operationAcc of operationAccs) {
|
const accRow: ListRow | undefined = await listOperationAccount.getOperationAccountByName(operationAcc).catch(() => undefined);
|
expect(accRow).toBeDefined(`${operationAcc} should exist in the list`);
|
}
|
});
|
|
it(`Step 2 - Open view ${appMP.viewAccount.viewPath}. Verify the ${operationAccs.length} accounts have any one of these cost drivers: ${costDrivers.join(', ')}`, async () => {
|
// Switch to account view
|
await appMP.viewAccount.switchTo();
|
// Expand row
|
const listAccount = appMP.viewAccount.frmAccount.listAccount;
|
await (await listAccount.getRowByValue([{ columnID: 'Name', value: 'Cost of sales' }])).expandRow();
|
// Verify account and cost driver match
|
for (const operationAcc of operationAccs) {
|
expect(await listAccount.isAccountCostDriverMatch(operationAcc, costDrivers)).toBe(true, `${operationAcc} should have any one of these cost drivers: ${costDrivers.join(', ')}`);
|
}
|
});
|
});
|