/**
|
* @file ADSO-52491
|
* @description Verify matrix cell enable state and filtered based on navigation
|
* @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 { StepNavigationPanel } from '../../libmp/forms/navigationpanel';
|
import { DataFoodBaseEntityName } from '../../libmp/data/data.navigation';
|
import { StepMatrix } from '../../libappsop/matrixeditorsop';
|
import { dataFoodProducts } from '../../libmp/data/data.product';
|
import { ListProductColumn } from '../../libmp/forms/form.product';
|
import { startOfPlanningYear } from '../../libmp/data/data.period';
|
import { DataFoodPISP } from '../../libmp/data/data.pisp';
|
import { MatrixEditorTripPlan } from '../../libmp/forms/form.tripplan';
|
import { dataFoodUnits, dataFoodUnitsProvider } from '../../libmp/data/data.unit';
|
import { DataHierarchy } from '../../libappsop/datahierarchy';
|
|
describe('ADSO-52491 - Verify matrix cell enable state and filtered based on navigation', () => {
|
const appMP = AppMP.getInstance();
|
const formNavigation = appMP.formNavigation;
|
const meTripPlan = appMP.viewTripPlan.formTripPlan.meTripPlan;
|
|
const expectedRows1 = 8;
|
const expectedRows2 = 1;
|
const expectedCellValue = '66';
|
const productRow: ListProductColumn = { Name: dataFoodProducts.GreekLemon12pk.Name };
|
const productParent: ListProductColumn[] = [{ Name: dataFoodProducts.AllProducts.Name }, { Name: dataFoodProducts.FinishedGoods.Name }, { Name: dataFoodProducts.Greek.Name }];
|
const columnApril = `1-Apr-${startOfPlanningYear}`;
|
const columnMay = `1-May-${startOfPlanningYear}`;
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewTripPlan);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => {
|
// Need wait optimizer completes as we need a valid plan
|
await appMP.createDemoDataset(Demo.Food, Scenario.Base, true);
|
});
|
|
it(`Step 2 - Open view ${appMP.viewTripPlan.viewPath}.`, async () => {
|
await appMP.viewTripPlan.switchTo();
|
});
|
|
it(`Step 3 - ${StepNavigationPanel.showEntitiesList()} ${StepNavigationPanel.checkStockingPoints([DataFoodBaseEntityName.DCAustria])}`, async () => {
|
await formNavigation.filterByEntity(DataFoodBaseEntityName.DCAustria, [DataFoodBaseEntityName.Europe]);
|
});
|
|
it(`Step 4 - ${StepMatrix.verifyTotalRow(MatrixEditorTripPlan.title, expectedRows1)}`, async () => {
|
await meTripPlan.verifyTotalRow(expectedRows1);
|
});
|
|
it(`Step 5 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([dataFoodProducts.GreekLemon12pk.Name])}`, async () => {
|
await formNavigation.filterByProduct(productRow, productParent);
|
});
|
|
it(`Step 6 - ${StepMatrix.verifyTotalRow(MatrixEditorTripPlan.title, expectedRows2)}`, async () => {
|
await meTripPlan.verifyTotalRow(expectedRows2);
|
});
|
|
it(`Step 7 - ${StepMatrix.verifyCellValue(MatrixEditorTripPlan.title, DataFoodPISP.GreekLemon12PkDCAustria, columnApril, expectedCellValue)}`, async () => {
|
await meTripPlan.verifyCellValue(DataFoodPISP.GreekLemon12PkDCAustria, 0, columnApril, expectedCellValue);
|
});
|
|
it(`Step 8 - ${StepMatrix.verifyCellHasNoData(MatrixEditorTripPlan.title, DataFoodPISP.GreekLemon12PkDCAustria, 0, columnMay)}`, async () => {
|
await meTripPlan.verifyCellHasNoData(DataFoodPISP.GreekLemon12PkDCAustria, 0, columnMay);
|
});
|
|
it(`Step 9 - ${StepNavigationPanel.clickHomeResetToRoot()}`, async () => {
|
await appMP.formNavigation.resetNaviToRoot();
|
await appMP.formNavigation.toggleProductList(false);
|
});
|
|
it(`Step 10 - ${StepNavigationPanel.checkUnits([dataFoodUnits.EURail.Name])}`, async () => {
|
const [unitEURail, unitEURailParents] = dataFoodUnitsProvider.getHierarchy(dataFoodUnits.EURail);
|
const parentsArr = unitEURailParents.map((x: DataHierarchy) => x.Name);
|
await formNavigation.filterByEntity(unitEURail.Name, parentsArr);
|
});
|
|
it(`Step 11 - ${StepMatrix.verifyTotalRow(MatrixEditorTripPlan.title, expectedRows1)}`, async () => {
|
await meTripPlan.verifyTotalRow(expectedRows1);
|
});
|
|
it(`Step 12 - ${StepNavigationPanel.checkProducts([dataFoodProducts.GreekLemon12pk.Name])}`, async () => {
|
const [greekLemon12pk, parents] = appMP.formNavigation.listProduct.getHierarchy(dataFoodUnitsProvider, dataFoodProducts.GreekLemon12pk);
|
await appMP.formNavigation.filterByProduct(greekLemon12pk, parents!);
|
});
|
|
it(`Step 13 - ${StepMatrix.verifyTotalRow(MatrixEditorTripPlan.title, expectedRows2)}`, async () => {
|
await meTripPlan.verifyTotalRow(expectedRows2);
|
});
|
});
|