/**
|
* @file ADSO-50208
|
* @description Navigate and visualize forecasts
|
* Strategy used to test, will NOT verify all rows filtered based on certain stocking point/product/sales segment
|
* as it will be very slow for UI automation. Instead, get first row and check that after filtering in navigation panel,
|
* the first row is now based on the filtering criteria.
|
* @author Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
|
import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel';
|
import { StepList } from '../../libappsop/listsop';
|
import { DataMetalBaseProductName } from '../../libmp/data/data.product';
|
import { DataMetalBaseSalesSegmentName } from '../../libmp/data/data.salessegment';
|
import { dataMetalsUnits, dataMetalsUnitsProvider } from '../../libmp/data/data.unit';
|
|
describe('ADSO-50208 - Navigate and visualize forecasts', () => {
|
const appMP = AppMP.getInstance();
|
const listNavEntity = appMP.formNavigation.listEntity;
|
const listNavProduct = appMP.formNavigation.listProduct;
|
const listNavSalesSegment = appMP.formNavigation.listSalesSegment;
|
const listForecasts = appMP.viewForecasts.formForecasts.listForecasts;
|
const asiaSP = dataMetalsUnits.AsiaSP.Name;
|
const northAmericaSP = dataMetalsUnits.NorthAmericaSP.Name;
|
|
beforeAll(async () => {
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewForecasts);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}.`, async () => {
|
await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false);
|
});
|
|
it(`Step 2 - Open view ${appMP.viewForecasts.viewPath}.`, async () => {
|
await appMP.viewForecasts.switchTo();
|
});
|
|
it(`Step 3 - ${StepNavigationPanel.showEntitiesList()} ${StepList.verifyRowValuesForRowNum(listForecasts.title, 1, {'Stocking point': northAmericaSP})}`, async () => {
|
await appMP.formNavigation.toggleEntityList(true);
|
|
// Before filtering stocking point, check the 1st row is North America (we will filter Asia in next step)
|
const firstForecastRow = await listForecasts.getRowByIndex(0);
|
await listForecasts.verifyRowValues(firstForecastRow, {'Stocking point': northAmericaSP});
|
});
|
|
it(`Step 4 - ${StepNavigationPanel.checkStockingPoints([asiaSP])} ${StepList.verifyRowValuesForRowNum(listForecasts.title, 1, {'Stocking point': asiaSP, Product: DataMetalBaseProductName.BCCBNarrow})}`, async () => {
|
// Check Asia and verify 1st row is now Asia forecast
|
const row = await listNavEntity.getRow([dataMetalsUnitsProvider, dataMetalsUnits.AsiaSP]);
|
await listNavEntity.toggleRowCheckbox(row, true);
|
|
// Also verify 1st row product is BC CB narrow as next step will filter product that belong to another product family
|
const firstForecastRow = await listForecasts.getRowByIndex(0);
|
await listForecasts.verifyRowValues(firstForecastRow, {'Stocking point': asiaSP, Product: DataMetalBaseProductName.BCCBNarrow});
|
});
|
|
it(`Step 5 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([DataMetalBaseProductName.BCCanTab])}`, async () => {
|
await appMP.formNavigation.toggleProductList(true);
|
|
const filterByProductFamily = await listNavProduct.getRow({Name: DataMetalBaseProductName.BCCanTab}, [{Name: DataMetalBaseProductName.AllProducts}, {Name: DataMetalBaseProductName.Can}, {Name: DataMetalBaseProductName.BeverageCan}]);
|
await listNavProduct.toggleRowCheckbox(filterByProductFamily, true);
|
});
|
|
it(`Step 6 - ${StepList.verifyRowValuesForRowNum(listForecasts.title, 1, {Product: DataMetalBaseProductName.BCCTClearCoated, 'Stocking point': asiaSP})}`, async () => {
|
const firstForecastRow = await listForecasts.getRowByIndex(0);
|
await listForecasts.verifyRowValues(firstForecastRow, {Product: DataMetalBaseProductName.BCCTClearCoated, 'Stocking point': asiaSP});
|
});
|
|
it(`Step 7 - ${StepNavigationPanel.showSalesSegmentsList()} ${StepNavigationPanel.checkSalesSegments([DataMetalBaseSalesSegmentName.Automotive])}`, async () => {
|
await appMP.formNavigation.toggleSalesSegmentList(true);
|
|
const filterBySalesSegment = await listNavSalesSegment.getRow({Name: DataMetalBaseSalesSegmentName.Automotive}, [{Name: DataMetalBaseSalesSegmentName.AllSalesSegments}]);
|
await listNavSalesSegment.toggleRowCheckbox(filterBySalesSegment, true);
|
});
|
|
it(`Step 8 - ${StepList.verifyTotalRow(listForecasts.title, 0)}`, async () => {
|
await listForecasts.verifyTotalRow(0, 'Expected no forecast in list as none matching Automotive segment, Asia stocking point and BC can tab product family.');
|
});
|
|
it(`Step 9 - ${StepNavigationPanel.clickHomeResetToRoot()} ${StepList.verifyRowValuesForRowNum(listForecasts.title, 1, {'Sales segment': DataMetalBaseSalesSegmentName.AllOrganics})}`, async () => {
|
await appMP.formNavigation.resetNaviToRoot();
|
|
const firstForecastRow = await listForecasts.getRowByIndex(0);
|
await listForecasts.verifyRowValues(firstForecastRow, {'Sales segment': DataMetalBaseSalesSegmentName.AllOrganics});
|
});
|
|
it(`Step 10 - ${StepNavigationPanel.checkSalesSegments([DataMetalBaseSalesSegmentName.Automotive])}`, async () => {
|
const filterBySalesSegment = await listNavSalesSegment.getRow({Name: DataMetalBaseSalesSegmentName.Automotive}, [{Name: DataMetalBaseSalesSegmentName.AllSalesSegments}]);
|
await listNavSalesSegment.toggleRowCheckbox(filterBySalesSegment, true);
|
});
|
|
it(`Step 11 - ${StepList.verifyRowValuesForRowNum(listForecasts.title, 1, {'Sales segment': DataMetalBaseSalesSegmentName.AudiA8})}`, async () => {
|
const firstForecastRow = await listForecasts.getRowByIndex(0);
|
await listForecasts.verifyRowValues(firstForecastRow, {'Sales segment': DataMetalBaseSalesSegmentName.AudiA8});
|
});
|
});
|