| /** | 
|  * @file         ADSO-10173 | 
|  * @description  Stocking account display relevant account | 
|  * @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 { AppMP, Demo, Scenario } from '../../../libmp/appmp'; | 
| import { ListColumnStockingAccount } from '../../../libmp/forms/form.stockingaccount'; | 
| import { DataFoodBaseAccountCostDriver, DataFoodBaseAccountName } from '../../../libmp/data/data.account'; | 
|   | 
| describe('ADSO-10173 - Stocking account display relevant account', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const accNameGFC = DataFoodBaseAccountName.GeneralFixedCosts; | 
|   const costDriverName = DataFoodBaseAccountCostDriver.Fixed; | 
|   | 
|   beforeAll(async () => { | 
|     jasmine.addMatchers(qCustomMatcher); | 
|     await appMP.login(); | 
|   }); | 
|   | 
|   afterAll(async () => { | 
|     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}. Verify ${accNameGFC} is the only stocking account in the list`, async () => { | 
|     // Switch to stocking cost view | 
|     await appMP.viewStockingCost.switchTo(); | 
|     const listStockingAccount = appMP.viewStockingCost.frmStockingAccount.lstStockingAccount; | 
|     // Verify General fixed costs is the only stocking account in the list | 
|     const rowcount = await listStockingAccount.getRowCount(); | 
|     expect(rowcount).toBe(1, `There should be only 1 stocking account in the list. Actual: ${rowcount}`); | 
|   | 
|     const stockingAccRow = await listStockingAccount.getRowByIndex(0); | 
|     const stockingAccName = await listStockingAccount.getCellValueFromRow(ListColumnStockingAccount.Account, stockingAccRow); | 
|     expect(stockingAccName).toBe(accNameGFC, `${accNameGFC} should be the only stocking account in the list. Actual: ${stockingAccName}`); | 
|   }); | 
|   | 
|   it(`Step 2 - Open view ${appMP.viewAccount.viewPath}. Verify ${accNameGFC} is the only account with cost driver = ${costDriverName}`, async () => { | 
|     // Switch to account view | 
|     await appMP.viewAccount.switchTo(); | 
|     // Expand row | 
|     const listAccount = appMP.viewAccount.frmAccount.listAccount; | 
|     const rowCOS = await listAccount.getRowByValue([{ columnID: 'Name', value: 'Cost of sales' }]); | 
|     await rowCOS.expandRow(); | 
|     // Get all account with Default cost driver = Fixed | 
|     const rowsFixedAcc = await listAccount.findAccountByCostDriver('Fixed'); | 
|     // Verify there is only 1 account with Default cost driver = Fixed | 
|     expect(rowsFixedAcc.length).toBe(1, `There should be only 1 account with default cost driver = Fixed. Actual: ${rowsFixedAcc.length}`); | 
|     // Verify General fixed costs is in the fixed list | 
|     const isAccountExistInRows = await listAccount.isAccountExistInRows(accNameGFC, rowsFixedAcc); | 
|     expect(isAccountExistInRows).toBe(true, `${accNameGFC} with cost driver = ${costDriverName} should exist in the list. Actual: ${isAccountExistInRows}`); | 
|   }); | 
| }); |