/**
|
* @file ADSO-50247
|
* @description Adjust customer orders - Multiply
|
* @author Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { AppMP, StepAppMP } from '../../libmp/appmp';
|
import { ListCustomerOrdersColumn, ListCustomerOrdersContextMenuItem } from '../../libmp/forms/form.customerorders';
|
import { DataMetalBaseSalesSegmentName } from '../../libmp/data/data.salessegment';
|
import { DataMetalBaseProductName } from '../../libmp/data/data.product';
|
import { DataMetalStockingPointName } from '../../libmp/data/data.stockingpoint';
|
import { StepList } from '../../libappsop/listsop';
|
import { StepActionBarPage } from '../../libappsop/actionbarpagesop';
|
import { DialogForecastAdjustQuantity } from '../../libmp/dialogs/dialog.forecastadjustquantity';
|
import { DataAdjustForecastQuantityMode } from '../../libmp/data/data.forecasts';
|
import { StepDialog } from '../../libappsop/dialogsop';
|
import { startOfPlanningYear } from '../../libmp/data/data.period';
|
|
describe('ADSO-50247 - Adjust customer orders - Multiply', () => {
|
const appMP = AppMP.getInstance();
|
const scenarioToSelect = 'ADSO-50251';
|
const janSOP = `1-Jan-${startOfPlanningYear}`;
|
const listCustomerOrders = appMP.viewCustomerOrders.formCustomerOrders.listCustomerOrders;
|
const dlgAdjustQuantity: DialogForecastAdjustQuantity = new DialogForecastAdjustQuantity();
|
const adjustRows: ListCustomerOrdersColumn[] = [{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Asia, 'Order date': janSOP, Quantity: '300'},
|
{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Asia, 'Order date': janSOP, Quantity: '400'}];
|
const adjustedRows: ListCustomerOrdersColumn[] = [{...adjustRows[0], Quantity: '750'}, {...adjustRows[1], Quantity: '1,000'}];
|
const adjustedRows2: ListCustomerOrdersColumn[] = [{...adjustedRows[0], Quantity: '375'}, {...adjustedRows[1], Quantity: '500'}];
|
|
beforeAll(async () => {
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewCustomerOrders);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Step 1 - ${StepAppMP.selectScenario(scenarioToSelect)}`, async () => {
|
await appMP.selectScenario(scenarioToSelect);
|
});
|
|
it(`Step 2 - Open view ${appMP.viewCustomerOrders.viewPath}.`, async () => {
|
await appMP.viewCustomerOrders.switchTo();
|
});
|
|
it(`Step 3 - ${StepList.selectRowsAndClickMenu(listCustomerOrders.title, adjustRows, ListCustomerOrdersContextMenuItem.AdjustQuantity.Label)}`, async () => {
|
const rows = await listCustomerOrders.getRows(adjustRows);
|
await listCustomerOrders.selectRows(rows);
|
await listCustomerOrders.selectContextMenu(ListCustomerOrdersContextMenuItem.AdjustQuantity, rows, dlgAdjustQuantity);
|
});
|
|
it(`Step 4 - ${StepDialog.updateDialogValues(DialogForecastAdjustQuantity.title, {AdjustMode: DataAdjustForecastQuantityMode.Multiply})} ${StepDialog.verifyOKDisabled()}`, async () => {
|
await dlgAdjustQuantity.updateDialogValues({AdjustMode: DataAdjustForecastQuantityMode.Multiply});
|
await dlgAdjustQuantity.verifyOKDisabled();
|
});
|
|
it(`Step 5 - ${StepDialog.updateDialogValues(DialogForecastAdjustQuantity.title, {Value: '-2'})} ${StepDialog.verifyOKDisabled()}`, async () => {
|
await dlgAdjustQuantity.updateDialogValues({Value: '-2'});
|
await dlgAdjustQuantity.verifyOKDisabled();
|
});
|
|
it(`Step 6 - ${StepDialog.updateDialogValues(DialogForecastAdjustQuantity.title, {Value: '2.5'})} ${StepDialog.clickOK()}`, async () => {
|
await dlgAdjustQuantity.updateDialogValues({Value: '2.5'});
|
await dlgAdjustQuantity.clickOK();
|
});
|
|
it(`Step 7 - ${StepList.verifyRowExists(listCustomerOrders.title, adjustedRows[0])} ${StepList.verifyRowExists(listCustomerOrders.title, adjustedRows[1])}`, async () => {
|
await listCustomerOrders.verifyRowExists(adjustedRows[0]);
|
await listCustomerOrders.verifyRowExists(adjustedRows[1]);
|
});
|
|
it(`Step 8 - ${StepList.selectRows(listCustomerOrders.title, adjustedRows)} ${StepActionBarPage.clickButton('Adjust quantity')}`, async () => {
|
const rows = await listCustomerOrders.getRows(adjustedRows);
|
await listCustomerOrders.selectRows(rows);
|
await listCustomerOrders.clickActionButton(appMP.abpSales.btnAdjustQuantity, undefined, rows, dlgAdjustQuantity);
|
});
|
|
it(`Step 9 - ${StepDialog.updateDialogValues(DialogForecastAdjustQuantity.title, {AdjustMode: DataAdjustForecastQuantityMode.Multiply, Value: '0.5'})} ${StepDialog.clickOK()}`, async () => {
|
await dlgAdjustQuantity.updateDialogValues({AdjustMode: DataAdjustForecastQuantityMode.Multiply, Value: '0.5'});
|
await dlgAdjustQuantity.clickOK();
|
});
|
|
it(`Step 10 - ${StepList.verifyRowExists(listCustomerOrders.title, adjustedRows2[0])} ${StepList.verifyRowExists(listCustomerOrders.title, adjustedRows2[1])}`, async () => {
|
await listCustomerOrders.verifyRowExists(adjustedRows2[0]);
|
await listCustomerOrders.verifyRowExists(adjustedRows2[1]);
|
});
|
});
|