yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
62
63
64
65
66
67
/**
 * @file        ADSO-10028
 * @description Cannot delete an event from capacity gantt chart if it belongs to common calendar
 * @author      Pethaperumal Natarajan (Pethaperumal.NATARAJAN.intern@3ds.com)
 * @copyright   Dassault Systèmes
 */
 
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { dataFoodUnits } from '../../libmp/data/data.unit';
import { GanttChartCapacityPlanning, GanttChartCapacityPlanningContextMenuItem } from '../../libmp/forms/form.capacityplanning';
import { StepGanttChart } from '../../libappsop/ganttchartsop';
import { contextMenuItemDisabledTooltip, GanttChartCapacityPlanningEditCalendar, GanttChartCapacityPlanningEditCalendarContextMenuItem } from '../../libmp/dialogs/dialog.capacityplanningeditcalendar';
import { StepDialog } from '../../libappsop/dialogsop';
 
describe('ADSO-10028 - Cannot delete an event from capacity gantt chart if it belongs to common calendar', () => {
  const appMP = AppMP.getInstance();
  const gcCapacityPlanning = appMP.viewSupplyPlanning.frmCapacityPlanning.ganttChartCapacityPlanning;
  const dlgCapacityPlanningEditCalendar = gcCapacityPlanning.dlgCapacityPlanningEditCalendar;
  const gcCapacityPlanningEditCalendar = dlgCapacityPlanningEditCalendar.gcCapacityPlanningEditCalendar;
 
  const rowTitle = 'Always available';
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.resetActiveView(appMP.viewSupplyPlanning);
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}.`, async () => {
    await appMP.createDemoDataset(Demo.Food, Scenario.Base, false);
  });
 
  it(`Step 2 - Open view ${appMP.viewSupplyPlanning.viewPath}.`, async () => {
    await appMP.viewSupplyPlanning.switchTo();
  });
 
  it(`Step 3  - ${StepGanttChart.rightClickRowAndSelectContextMenu(GanttChartCapacityPlanning.title, dataFoodUnits.DEFermenter.Name, GanttChartCapacityPlanningContextMenuItem.EditCalendarRow.Label)}`, async () => {
    const [row] = await gcCapacityPlanning.getRowsByTitle(dataFoodUnits.DEFermenter.Name);
    await gcCapacityPlanning.rightClickRowAndSelectMenu(row, GanttChartCapacityPlanningContextMenuItem.EditCalendarRow);
 
    // Wait dialog displays before proceeding next
    await dlgCapacityPlanningEditCalendar.waitUntilPresent();
  });
 
  it(`Step 4 - ${StepGanttChart.verifyRowContextMenuItemDisabled(GanttChartCapacityPlanningEditCalendar.title, rowTitle, GanttChartCapacityPlanningEditCalendarContextMenuItem.DeleteEventRow.Label, contextMenuItemDisabledTooltip.notEvent())}`, async () => {
    // Edit calendar dialog displays, verify cannot delete common calendar event
    await gcCapacityPlanningEditCalendar.verifyRowContextMenuItemDisabled(rowTitle, GanttChartCapacityPlanningEditCalendarContextMenuItem.DeleteEventRow, contextMenuItemDisabledTooltip.notEvent(), false);
  });
 
  it(`Step 5 - ${StepGanttChart.verifyRowContextMenuItemDisabled(GanttChartCapacityPlanningEditCalendar.title, rowTitle, GanttChartCapacityPlanningEditCalendarContextMenuItem.EditEventRow.Label, contextMenuItemDisabledTooltip.notEvent())}`, async () => {
    // Verify cannot edit common calendar event
    await gcCapacityPlanningEditCalendar.verifyRowContextMenuItemDisabled(rowTitle, GanttChartCapacityPlanningEditCalendarContextMenuItem.EditEventRow, contextMenuItemDisabledTooltip.notEvent(), false);
  });
 
  it(`Step 6 - ${StepDialog.clickOK()}`, async () => {
    await dlgCapacityPlanningEditCalendar.clickOK();
  });
});