/**
|
* @file ADSO-10118
|
* @description Copy unit cost - multiple costs selection
|
* @testcategory Web - Financials - Units
|
* @author Jayden Chew (jayden.chew@3ds.com)
|
* @copyright Dassault Systemes
|
*/
|
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
|
import { LogMessage } from '../../../libappbase/logmessage';
|
import { ListUnitCostContextMenuItem } from '../../../libmp/forms/form.unitcost';
|
|
describe('ADSO-10118 - Copy unit cost - multiple costs selection', () => {
|
const appMP = AppMP.getInstance();
|
const listUnitCost = appMP.viewUnitCost.frmUnitCost.listUnitCost;
|
const expectedTooltips = '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.viewUnitCost.viewPath}.`, async () => {
|
// Open unit cost view
|
await appMP.viewUnitCost.switchTo();
|
});
|
|
it('Step 2 - Select 2 unit costs.', async () => {
|
for (let index = 0; index < 2; index++) {
|
const row = await listUnitCost.getRowByIndex(index);
|
const modifier = index !== 0 ? { control: true } : undefined;
|
await row.leftClick(modifier);
|
}
|
});
|
|
it('Step 3 - Right click and verify "Copy" context menu is disabled with tooltip', async () => {
|
await listUnitCost.rightClick();
|
const [isContextMenuItemEnabled, ctnMenuDisabledTooltip] = await listUnitCost.verifyIsMenuItemClickable(ListUnitCostContextMenuItem.MenuCopy);
|
expect(isContextMenuItemEnabled).toBe(false, LogMessage.menu_isEnabled(ListUnitCostContextMenuItem.MenuCopy));
|
expect(ctnMenuDisabledTooltip).toBe(expectedTooltips, LogMessage.tooltip_notMatched(expectedTooltips, ctnMenuDisabledTooltip));
|
});
|
|
it('Step 4 - Verify "Copy" button is disabled with tooltip.', async () => {
|
const [isButtonnEnabled, btnDisabledTooltip] = await appMP.abpData.btnCopy.getIsClickable();
|
|
expect(isButtonnEnabled).toBe(false, LogMessage.btn_isEnabled('Copy'));
|
expect(btnDisabledTooltip).toBe(expectedTooltips, LogMessage.tooltip_notMatched(expectedTooltips, btnDisabledTooltip));
|
});
|
});
|