/** 
 | 
 * @file         ADSO-10190 
 | 
 * @description  Copy stocking cost via action bar or context menu - multiple costs selection 
 | 
 * @testcategory Web - Financials - Stocking points 
 | 
 * @author       Umar Adkhamov (umar.adkhamov@3ds.com) 
 | 
 * @copyright    Dassault Systemes 
 | 
 */ 
 | 
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const'; 
 | 
import { LogMessage } from '../../../libappbase/logmessage'; 
 | 
import { AppMP, Demo, Scenario } from '../../../libmp/appmp'; 
 | 
import { ListStockingCostContextMenuItem, ListStockingCost } from '../../../libmp/forms/form.stockingcost'; 
 | 
  
 | 
describe('ADSO-10190 - Verify that copying multiple stocking costs at a time is not allowed', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  let listStockingCost: ListStockingCost; 
 | 
  const expectedTooltip = 'Copy one cost at a time.'; 
 | 
  
 | 
  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}`, async () => { 
 | 
    await appMP.viewStockingCost.switchTo(); 
 | 
    listStockingCost = appMP.viewStockingCost.frmStockingCost.lstStockingCost; 
 | 
    expect(await listStockingCost.isVisible()).toBe(true, 'Stocking Cost list should be visible.'); 
 | 
  }); 
 | 
  
 | 
  it('Step 2 - Select 2 stocking costs and verify "Copy" context menu is disabled with tooltip', async () => { 
 | 
    // By default, first row (index 0) of the list will be selected. Only extend the selection to second row (index 1). 
 | 
    await listStockingCost.selectListRowsByIndex([1], true); 
 | 
    const rows = await listStockingCost.getInboundSelectedRows(); 
 | 
    await rows[0].rightClick(); 
 | 
  
 | 
    // Verify context menu item "Copy" is disabled 
 | 
    const [isMenuEnable, cmMenuDisabledTooltip] = await listStockingCost.verifyIsMenuItemClickable(ListStockingCostContextMenuItem.Copy); 
 | 
    expect(isMenuEnable).toBe(false, LogMessage.menu_isEnabled('Copy')); 
 | 
    // Verify tooltip text of the "Copy" menu item 
 | 
    expect(cmMenuDisabledTooltip).toBe(expectedTooltip, LogMessage.tooltip_notMatched(expectedTooltip, cmMenuDisabledTooltip)); 
 | 
  }); 
 | 
  
 | 
  it('Step 3 - Verify "Copy" button in action bar page is disabled with tooltip', async () => { 
 | 
    // Verify "Copy" button in action bar is disabled 
 | 
    const [isBtnClickable, btnDisabledTooltip] = await appMP.abpData.btnCopy.getIsClickable(); 
 | 
    expect(isBtnClickable).toBe(false, LogMessage.btn_isEnabled('Copy')); 
 | 
    // Verify tooltip text of the "Copy" button in action bar 
 | 
    expect(btnDisabledTooltip).toBe(expectedTooltip, LogMessage.tooltip_notMatched(expectedTooltip, btnDisabledTooltip)); 
 | 
  }); 
 | 
}); 
 |