/**
|
* @file ADSO-52907
|
* @description Warning when adding process min qty to level greater than 1 in strategy
|
* @author Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
|
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
|
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
|
import { ListStrategy, ListStrategyContextMenuItem } from '../../libmp/forms/form.optimizerstrategies';
|
import { DialogStrategy, DialogStrategyWarningImage, ListActiveGoals, ListActiveGoalsColumn, ListActiveGoalsContextMenuItem, ListInactiveGoals, StepDialogStrategy } from '../../libmp/dialogs/dialog.strategy';
|
import { StepList } from '../../libappsop/listsop';
|
import { StepDialog } from '../../libappsop/dialogsop';
|
import { DataKPIName } from '../../libmp/data/data.kpi';
|
import { DataFoodStrategyName } from '../../libmp/data/data.strategy';
|
import { ListRow } from '../../e2elib/lib/src/pageobjects/list/listrow.component';
|
|
describe('ADSO-52907 - Warning when adding process min qty to level greater than 1 in strategy', () => {
|
const appMP = AppMP.getInstance();
|
const listStrategy = appMP.viewOptimizerStrategies.frmOptimizerStrategies.listStrategy;
|
let dlgStrategy: DialogStrategy;
|
let listActiveGoals: ListActiveGoals;
|
let listInactiveGoals: ListInactiveGoals;
|
let rowActiveFulfillmentTarget: ListRow;
|
const fieldsFulfillmentTargetDropOn: ListActiveGoalsColumn = {KPI: DataKPIName.FulfillmentTarget, Level: '2'};
|
const fieldsProcessMinQtyLevel2: ListActiveGoalsColumn = { KPI: DataKPIName.ProcessMinQuantity, Level: '2' };
|
|
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.viewOptimizerStrategies.viewPath}`, async () => {
|
await appMP.viewOptimizerStrategies.switchTo();
|
});
|
|
it(`Step 2 - ${StepList.selectRowAndClickMenu(ListStrategy.title, { Name: DataFoodStrategyName.Default }, ListStrategyContextMenuItem.Edit.Label)}`, async () => {
|
const row = await listStrategy.getRow({ Name: DataFoodStrategyName.Default });
|
[dlgStrategy] = await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Edit, row);
|
});
|
|
it(`Step 3 - ${StepDialogStrategy.verifyHasWarningImage(false)}`, async () => {
|
await dlgStrategy.verifyHasWarningImage(false);
|
});
|
|
it(`Step 4 - ${StepList.verifyRowExists(ListActiveGoals.title, fieldsFulfillmentTargetDropOn)}`, async () => {
|
listActiveGoals = dlgStrategy.listActiveGoals;
|
listInactiveGoals = dlgStrategy.listInactiveGoals;
|
rowActiveFulfillmentTarget = await listActiveGoals.getRow(fieldsFulfillmentTargetDropOn);
|
});
|
|
it(`Step 5 - ${StepList.dropRowsOnTargetRow(ListInactiveGoals.title, [{Goal: DataKPIName.ProcessMinQuantity}], fieldsFulfillmentTargetDropOn, ListActiveGoals.title)}`, async () => {
|
const rowInactiveProcessMinQty = await listInactiveGoals.getRow({Goal: DataKPIName.ProcessMinQuantity});
|
await dlgStrategy.listInactiveGoals.dropRowOnTargetRow(rowInactiveProcessMinQty, rowActiveFulfillmentTarget);
|
});
|
|
it(`Step 6 - ${StepList.verifyRowExists(ListActiveGoals.title, fieldsProcessMinQtyLevel2)}`, async () => {
|
await listActiveGoals.verifyRowExists(fieldsProcessMinQtyLevel2);
|
});
|
|
it(`Step 7 - ${StepList.verifyRowHasOnDrawImage(ListActiveGoals.title, fieldsProcessMinQtyLevel2, DialogStrategyWarningImage.Warning)}`, async () => {
|
const row = await listActiveGoals.getRow(fieldsProcessMinQtyLevel2);
|
await listActiveGoals.verifyRowHasOnDrawImage(row, DialogStrategyWarningImage.Warning);
|
});
|
|
it(`Step 8 - ${StepDialogStrategy.verifyHasWarningImage(true, DialogStrategyWarningImage.Warning)}`, async () => {
|
await dlgStrategy.verifyHasWarningImage(true, DialogStrategyWarningImage.Warning);
|
});
|
|
it(`Step 9 - ${StepDialog.clickOK()}`, async () => {
|
await dlgStrategy.clickOK();
|
});
|
|
it(`Step 10 - ${StepList.verifyRowValues(ListStrategy.title, {Name: DataFoodStrategyName.Default}, {ImgIsValid: DialogStrategyWarningImage.Warning})}`, async () => {
|
// Strategy saved with not ideal configuration, flag image icon WARNING
|
const row = await listStrategy.getRow({Name: DataFoodStrategyName.Default});
|
await listStrategy.verifyRowValues(row, {ImgIsValid: DialogStrategyWarningImage.Warning});
|
});
|
|
it(`Step 11 - ${StepList.selectRowAndClickMenu(ListStrategy.title, { Name: DataFoodStrategyName.Default }, ListStrategyContextMenuItem.Edit.Label)}`, async () => {
|
const row = await listStrategy.getRow({ Name: DataFoodStrategyName.Default });
|
[dlgStrategy] = await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Edit, row);
|
});
|
|
it(`Step 12 - ${StepDialogStrategy.verifyHasWarningImage(true, DialogStrategyWarningImage.Warning)}`, async () => {
|
// Verify editing the same strategy, the WARNING still present
|
await dlgStrategy.verifyHasWarningImage(true, DialogStrategyWarningImage.Warning);
|
});
|
|
it(`Step 13 - ${StepList.selectRowAndClickMenu(ListActiveGoals.title, { KPI: DataKPIName.ProcessMinQuantity }, ListActiveGoalsContextMenuItem.DecreaseLevel.Label)}`, async () => {
|
// Fix the not ideal configuration by decreasing Process min quantity goal to level 1
|
const row = await listActiveGoals.getRow({ KPI: DataKPIName.ProcessMinQuantity });
|
await listActiveGoals.selectContextMenu(ListActiveGoalsContextMenuItem.DecreaseLevel, row);
|
});
|
|
it(`Step 14 - ${StepDialogStrategy.verifyHasWarningImage(false)}`, async () => {
|
// And verify no more warning image
|
await dlgStrategy.verifyHasWarningImage(false);
|
});
|
|
it(`Step 15 - ${StepDialog.clickCancel()}`, async () => {
|
await dlgStrategy.clickCancel();
|
});
|
});
|