yanweiyuan3
2023-10-10 d901b1ab0ee0b690f5ac211b9cdb1db3a58bca86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
 * @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));
  });
});