/**
|
* @file ADSO-50239
|
* @description Navigate and visualize customer orders
|
* Strategy used to test, use UTF to create copy of demo data.
|
* Remove all customer orders and create few data for easy verification.
|
* @author Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { AppMP, StepAppMP } from '../../libmp/appmp';
|
import { DataMetalBaseEntityName } from '../../libmp/data/data.navigation';
|
import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel';
|
import { DataMetalBaseProductName } from '../../libmp/data/data.product';
|
import { DataMetalBaseSalesSegmentName } from '../../libmp/data/data.salessegment';
|
import { DataMetalStockingPointName } from '../../libmp/data/data.stockingpoint';
|
import { ListCustomerOrdersColumn } from '../../libmp/forms/form.customerorders';
|
import { StepList } from '../../libappsop/listsop';
|
|
describe('ADSO-50239 - Navigate and visualize customer orders', () => {
|
const appMP = AppMP.getInstance();
|
const scenarioToSelect = 'ADSO-50251';
|
const listNavEntity = appMP.formNavigation.listEntity;
|
const listNavProduct = appMP.formNavigation.listProduct;
|
const listNavSalesSegment = appMP.formNavigation.listSalesSegment;
|
const listCustomerOrders = appMP.viewCustomerOrders.formCustomerOrders.listCustomerOrders;
|
const customerOrders: ListCustomerOrdersColumn[] = [{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Asia},
|
{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCTClearCoated, 'Stocking point': DataMetalStockingPointName.Asia},
|
{'Sales segment': DataMetalBaseSalesSegmentName.AudiA8, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Europe}];
|
|
// Function to loop each expected row (whether shown).
|
// Each time check/uncheck navigation panel, we verify the same rows whether exist/not.
|
const funcVerifyRowsShown = (async (expectedCustomerOrderRowsShown: boolean[]): Promise<void> => {
|
for (let x = 0; x < customerOrders.length; x++) {
|
const expectedShown = expectedCustomerOrderRowsShown[x];
|
if (expectedShown) {
|
await listCustomerOrders.verifyRowExists(customerOrders[x]);
|
} else {
|
await listCustomerOrders.verifyRowNotExist(customerOrders[x]);
|
}
|
}
|
});
|
|
// Function to retrieve the step description when verifying each expected row shown/not.
|
const funcStepDescriptionVerifyRowsShown = ((expectedCustomerOrderRowsShown: boolean[]): string => {
|
let stepDescription = '';
|
for (let x = 0; x < customerOrders.length; x++) {
|
const expectedShown = expectedCustomerOrderRowsShown[x];
|
stepDescription = expectedShown ?
|
stepDescription.concat(StepList.verifyRowExists(listCustomerOrders.title, customerOrders[x]), ' ') :
|
stepDescription.concat(StepList.verifyRowNotExist(listCustomerOrders.title, customerOrders[x]), ' ');
|
}
|
return stepDescription;
|
});
|
|
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 - ${StepNavigationPanel.showEntitiesList()} ${StepNavigationPanel.checkStockingPoints([DataMetalStockingPointName.Asia])}`, async () => {
|
await appMP.formNavigation.toggleEntityList(true);
|
|
const row = await listNavEntity.getEntityRowByName(DataMetalStockingPointName.Asia, [DataMetalBaseEntityName.QAluminum, DataMetalBaseEntityName.Asia]);
|
await listNavEntity.toggleRowCheckbox(row, true);
|
});
|
|
it(`Step 4 - ${funcStepDescriptionVerifyRowsShown([true, true, false])}`, async () => {
|
await funcVerifyRowsShown([true, true, false]);
|
});
|
|
it(`Step 5 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([DataMetalBaseProductName.BCCanBody])}`, async () => {
|
await appMP.formNavigation.toggleProductList(true);
|
|
const row = await listNavProduct.getRow({Name: DataMetalBaseProductName.BCCanBody}, [{Name: DataMetalBaseProductName.AllProducts}, {Name: DataMetalBaseProductName.Can}, {Name: DataMetalBaseProductName.BeverageCan}]);
|
await listNavEntity.toggleRowCheckbox(row, true);
|
});
|
|
it(`Step 6 - ${funcStepDescriptionVerifyRowsShown([true, false, false])}`, async () => {
|
await funcVerifyRowsShown([true, false, false]);
|
});
|
|
it(`Step 7 - ${StepNavigationPanel.showSalesSegmentsList()} ${StepNavigationPanel.checkSalesSegments([DataMetalBaseSalesSegmentName.Automotive])}`, async () => {
|
await appMP.formNavigation.toggleSalesSegmentList(true);
|
|
const row = await listNavSalesSegment.getRow({Name: DataMetalBaseSalesSegmentName.Automotive}, [{Name: DataMetalBaseSalesSegmentName.AllSalesSegments}]);
|
await listNavSalesSegment.toggleRowCheckbox(row, true);
|
});
|
|
it(`Step 8 - ${funcStepDescriptionVerifyRowsShown([false, false, false])}`, async () => {
|
await funcVerifyRowsShown([false, false, false]);
|
});
|
|
it(`Step 9 - ${StepNavigationPanel.clickHomeResetToRoot()}`, async () => {
|
await appMP.formNavigation.resetNaviToRoot();
|
});
|
|
it(`Step 10 - ${funcStepDescriptionVerifyRowsShown([true, true, true])}`, async () => {
|
await funcVerifyRowsShown([true, true, true]);
|
});
|
|
it(`Step 11 - ${StepNavigationPanel.checkSalesSegments([DataMetalBaseSalesSegmentName.Automotive])}`, async () => {
|
const row = await listNavSalesSegment.getRow({Name: DataMetalBaseSalesSegmentName.Automotive}, [{Name: DataMetalBaseSalesSegmentName.AllSalesSegments}]);
|
await listNavSalesSegment.toggleRowCheckbox(row, true);
|
});
|
|
it(`Step 12 - ${funcStepDescriptionVerifyRowsShown([false, false, true])}`, async () => {
|
await funcVerifyRowsShown([false, false, true]);
|
});
|
});
|