| /** | 
|  * @file        ADSO-50251 | 
|  * @description Visualize customer order with invalid PISP | 
|  * @author      Clarence (ccn7@3ds.com) | 
|  * @copyright   Dassault Systèmes | 
|  */ | 
| import { AppMP, StepAppMP } from '../../libmp/appmp'; | 
| import { DataMetalBaseSalesSegmentName } from '../../libmp/data/data.salessegment'; | 
| import { DataMetalBaseProductName } from '../../libmp/data/data.product'; | 
| import { ListCustomerOrdersColumn } from '../../libmp/forms/form.customerorders'; | 
| import { DataIconEmoticons } from '../../libappsop/data.iconnames'; | 
| import { StepList } from '../../libappsop/listsop'; | 
| import { StepNavigationPanel } from '../../libmp/forms/navigationpanel/form.navigationpanel'; | 
| import { startOfPlanningYear } from '../../libmp/data/data.period'; | 
|   | 
| describe('ADSO-50251 - Visualize customer order with invalid PISP', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const scenarioToSelect = 'ADSO-50251'; | 
|   const janSOP = `1-Jan-${startOfPlanningYear}`; | 
|   const listCustomerOrders = appMP.viewCustomerOrders.formCustomerOrders.listCustomerOrders; | 
|   // Invalid as stocking point is empty as invalid stocking point passed in during creation in UTF | 
|   const invalidRow: ListCustomerOrdersColumn = {'Stocking point': '', 'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Order date': janSOP}; | 
|   | 
|   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.verifyRowExists(listCustomerOrders.title, invalidRow)}`, async () => { | 
|     await listCustomerOrders.verifyRowExists(invalidRow); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepList.verifyRowConstraintViolation(listCustomerOrders.title, invalidRow, true)}`, async () => { | 
|     const row = await listCustomerOrders.getRow(invalidRow); | 
|     await listCustomerOrders.verifyRowHasOnDrawImage(row, DataIconEmoticons.ConstraintViolations); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepNavigationPanel.showSalesSegmentsList()} ${StepNavigationPanel.checkSalesSegments([DataMetalBaseSalesSegmentName.Automotive])}`, async () => { | 
|     await appMP.formNavigation.toggleSalesSegmentList(true); | 
|   | 
|     // Filter sales segment by segment that does NOT intersect with the invalid customer order | 
|     // To prove that customer order with invalid PISP always shown regardless of navigation panel filtering | 
|     const row = await appMP.formNavigation.listSalesSegment.getRow({Name: DataMetalBaseSalesSegmentName.Automotive}, [{Name: DataMetalBaseSalesSegmentName.AllSalesSegments}]); | 
|     await appMP.formNavigation.listSalesSegment.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepList.verifyRowExists(listCustomerOrders.title, invalidRow)}`, async () => { | 
|     await listCustomerOrders.verifyRowExists(invalidRow); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepNavigationPanel.showProductsList()} ${StepNavigationPanel.checkProducts([DataMetalBaseProductName.Automotive])}`, async () => { | 
|     await appMP.formNavigation.toggleProductList(true); | 
|   | 
|     // Filter product by product that does NOT intersect with the invalid customer order | 
|     // To prove that customer order with invalid PISP always shown regardless of navigation panel filtering | 
|     const row = await appMP.formNavigation.listProduct.getRow({Name: DataMetalBaseProductName.Automotive}, [{Name: DataMetalBaseProductName.AllProducts}]); | 
|     await appMP.formNavigation.listSalesSegment.toggleRowCheckbox(row, true); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepList.verifyRowExists(listCustomerOrders.title, invalidRow)}`, async () => { | 
|     await listCustomerOrders.verifyRowExists(invalidRow); | 
|   }); | 
| }); |