/**
|
* @file ADSO-10175
|
* @description Stocking costs list is filtered by selection in the navigation panel
|
* @testcategory Web - Financials - Stocking points
|
* @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 { DataFoodBaseAccountCostDriver, DataFoodBaseAccountName, DataFoodBaseAccountTimeUnit } from '../../../libmp/data/data.account';
|
import { LogMessage } from '../../../libappbase/logmessage';
|
import { DataFoodBaseEntityName } from '../../../libmp/data/data.navigation';
|
import { ActionTriggerType } from '../../../libappbase/utils';
|
import { QConsole } from '../../../e2elib/lib/src/helper/qconsole';
|
import { ListAccountContextMenuItem } from '../../../libmp/forms/form.account';
|
|
describe('ADSO-10175 - Stocking costs list is filtered by selection in the navigation panel', () => {
|
const appMP = AppMP.getInstance();
|
const formNavigation = appMP.formNavigation;
|
const listStockingCost = appMP.viewStockingCost.frmStockingCost.lstStockingCost;
|
const entityEurope = DataFoodBaseEntityName.Europe;
|
const accNameStockingCost = DataFoodBaseAccountName.StockingCosts;
|
const accNameGeneralFixedCost = DataFoodBaseAccountName.GeneralFixedCosts;
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
// Reset navigation
|
await formNavigation.reset();
|
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(`Setup - Open view ${appMP.viewAccount.viewPath}. Create a new account`, async () => {
|
// Open account view
|
const listAccount = appMP.viewAccount.frmAccount.listAccount;
|
await appMP.viewAccount.switchTo();
|
// Create new account
|
const [dlgAccount] = await listAccount.selectContextMenu(ListAccountContextMenuItem.Create);
|
await dlgAccount.updateDialogValues({ ParentAccountName: DataFoodBaseAccountName.CostOfSales, Name: accNameStockingCost, CostDriver: DataFoodBaseAccountCostDriver.Fixed, Cost: '12345', TimeUnit: DataFoodBaseAccountTimeUnit.Year, LengthOfTime: '1' });
|
|
// Verify new account can be created
|
const [canCreateAccount, btnDisabledTooltip] = await dlgAccount.btnOk.verifyIsButtonClickable();
|
expect(canCreateAccount).toBe(true, LogMessage.btn_notClickable('OK', btnDisabledTooltip));
|
await dlgAccount.clickOK();
|
});
|
|
it(`Setup - Open view ${appMP.viewStockingCost.viewPath}. Create a new stocking cost`, async () => {
|
// Open stocking cost view
|
await appMP.viewStockingCost.switchTo();
|
// Create new stocking cost
|
const dlgStockingCost = await listStockingCost.openStockingCostDialog(ActionTriggerType.ContextMenu);
|
await dlgStockingCost.ddlAccount.selectItemSOP(accNameStockingCost);
|
await dlgStockingCost.ddlStockingPoint.selectItemSOP(DataFoodBaseEntityName.DCAustria);
|
// Verify new stocking cost can be created
|
const [canCreateStockingCost, btnDisabledTooltip] = await dlgStockingCost.btnOk.verifyIsButtonClickable();
|
expect(canCreateStockingCost).toBe(true, LogMessage.btn_notClickable('OK', btnDisabledTooltip));
|
await dlgStockingCost.clickOK();
|
});
|
|
it(`Step 1 - Verify stocking cost list showing 18 stocking costs (1 ${accNameStockingCost}, 17 ${accNameGeneralFixedCost}) when filtered by ${entityEurope}`, async () => {
|
// Verify filter by accounts toggled off by default
|
expect(await appMP.viewStockingCost.frmStockingCost.cbFilterByAccount.isChecked()).toBe(false, 'Filter by Accounts should be toggled OFF by default');
|
// Check Europe in navigation panel and verify there is 18 stocking costs (1 Stocking costs, 17 General fixed costs)
|
await formNavigation.filterByEntity(entityEurope);
|
expect(await listStockingCost.getRowCount()).toBe(18, 'There should be 18 stocking cost showing in stocking cost list');
|
|
const stockingCostCount = (await listStockingCost.getStockingCostsByAccount(accNameStockingCost)).length;
|
const generalFixedCostCount = (await listStockingCost.getStockingCostsByAccount(accNameGeneralFixedCost)).length;
|
expect(stockingCostCount).toBe(1, `There should be 1 stocking cost that has "${accNameStockingCost}" as account name in the list`);
|
expect(generalFixedCostCount).toBe(17, `There should be 17 stocking cost that has "${accNameGeneralFixedCost}" as account name in the list`);
|
});
|
|
it(`Step 2 - Verify no stocking cost showing in stocking cost list when filtered by ${DataFoodBaseEntityName.Plants}`, async () => {
|
// Uncheck Europe unit in navigation panel
|
await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(false, DataFoodBaseEntityName.Europe);
|
|
// Check Europe > Plants unit in navigation panel
|
await formNavigation.filterByEntity(DataFoodBaseEntityName.Plants, [DataFoodBaseEntityName.Europe]);
|
expect(await listStockingCost.getRowCount()).toBe(0, 'There should be no stocking cost showing in stocking cost list');
|
});
|
|
it(`Step 3 - Verify 2 stocking costs showing in stocking cost list when filtered by ${DataFoodBaseEntityName.DCAustria}`, async () => {
|
// uncheck Europe > Plants unit in navigation panel
|
await appMP.formNavigation.listEntity.toggleEntityRowCheckbox(false, DataFoodBaseEntityName.Plants, [entityEurope]);
|
|
// check Europe > DC Austria
|
await formNavigation.filterByEntity(DataFoodBaseEntityName.DCAustria, [entityEurope]);
|
await QConsole.waitForStable(1000);
|
expect(await listStockingCost.getRowCount()).toBe(2, 'There should be 2 stocking cost showing in stocking cost list');
|
});
|
});
|