| /** | 
|  * @file         ADSO-10180 | 
|  * @description  Cannot create unit costs in the Stocking Costs list | 
|  * @testcategory Web - Financials - Stocking points | 
|  * @author       Gay Er Xuan (erxuan.gay@3ds.com) | 
|  * @copyright    Dassault Systèmes | 
|  */ | 
| import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const'; | 
| import { LogMessage } from '../../../libappbase/logmessage'; | 
| import { AppMP, Demo, Scenario } from '../../../libmp/appmp'; | 
| import { DataFoodBaseEntityName } from '../../../libmp/data/data.navigation'; | 
| import { ListStockingCostContextMenuItem } from '../../../libmp/forms/form.stockingcost'; | 
|   | 
| describe('ADSO-10180 - Cannot create unit costs in the Stocking Costs list', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     // Reset views and navigation | 
|     await appMP.formNavigation.reset(); | 
|     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.viewStockingCost.viewPath}. Check any units without child stocking point in navigation panel`, async () => { | 
|     // Open Inventory Cost View | 
|     await appMP.viewStockingCost.switchTo(); | 
|     const isChecked = await appMP.formNavigation.filterByEntity(DataFoodBaseEntityName.Plants, [DataFoodBaseEntityName.Europe]); | 
|     expect(isChecked).toBe(true, `${DataFoodBaseEntityName.Plants} should be checked in entity list of navigation form`); | 
|   }); | 
|   | 
|   it('Step 2 - Verify "Create" context menu item disabled with correct tooltip', async () => { | 
|     // Verify context menu item is disabled | 
|     const listStockingCost = appMP.viewStockingCost.frmStockingCost.lstStockingCost; | 
|     await listStockingCost.rightClick(); | 
|     const expectedTooltip = 'Please select a stocking point or a unit with child stocking point in the navigation panel to create a stocking cost.'; | 
|     const [isMenuItemClickable, cmMenuItemDisabledTooltip] = await listStockingCost.verifyIsMenuItemClickable(ListStockingCostContextMenuItem.Create); | 
|     expect(isMenuItemClickable).toBe(false, LogMessage.menu_isEnabled(ListStockingCostContextMenuItem.Create)); | 
|     expect(cmMenuItemDisabledTooltip).toBe(expectedTooltip, LogMessage.tooltip_notMatched(expectedTooltip, cmMenuItemDisabledTooltip)); | 
|   }); | 
|   | 
|   it('Step 3 - Verify drag and drop units without child stocking point to create stocking cost is not allowed with correct tooltip', async () => { | 
|     // Get unit row in navigation form | 
|     const unitRow = await appMP.formNavigation.listEntity.getEntityRowByName(DataFoodBaseEntityName.Suppliers, [DataFoodBaseEntityName.Europe]); | 
|     await unitRow.leftClick(); | 
|     // Get stocking acount row in stocking account form | 
|     const listStockingAccount = appMP.viewStockingCost.frmStockingAccount.lstStockingAccount; | 
|     const accRow = await listStockingAccount.getRowByIndex(0); | 
|     // Verify drag and drop is not allowed with correct tooltip | 
|     const expectedTooltip = 'Only stocking point can be dropped onto account to create stocking point cost.'; | 
|     const tooltip = await listStockingAccount.dropRowOnTargetRow(unitRow, accRow, true); | 
|     expect(tooltip).toBe(expectedTooltip, LogMessage.list_dragAndDropAllowed(expectedTooltip)); | 
|   }); | 
| }); |