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
/**
 * @file        ADSO-9811
 * @description Cannot define more than 24 hours of capacity
 * @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 { CellLocator } from '../../libappbase/matrixeditorbase';
import { DataMetalBaseShiftPattern } from '../../libmp/data/data.shiftpattern';
import { monday } from '../../libmp/data/data.period';
import { StepMatrix } from '../../libappsop/matrixeditorsop';
import { MatrixEditorShiftPattern, toastMatrixEditorShiftPattern } from '../../libmp/forms/form.shiftpattern';
import { StepToast, ToastSOP } from '../../libappsop/toastsop';
 
describe('ADSO-9811 - Cannot define more than 24 hours of capacity', () => {
  const appMP = AppMP.getInstance();
  const meShiftPatterns = appMP.viewCapacitiesTime.formShiftPattern.meShiftPattern;
  const toast = new ToastSOP();
 
  const cellLocation1: CellLocator = { columnName: monday, rowName: DataMetalBaseShiftPattern.SixteenTimesFive };
 
  const inputExceeded = '25:00';
  const inputNotExceeded = '17:00';
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.resetActiveView(appMP.viewCapacitiesTime);
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Step 1 - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}`, async () => {
    await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false);
  });
 
  it(`Step 2 - Open view ${appMP.viewCapacitiesTime.viewPath}.`, async () => {
    await appMP.viewCapacitiesTime.switchTo();
  });
 
  it(`Step 3 - ${StepMatrix.editCellValues(MatrixEditorShiftPattern.title, [cellLocation1], inputExceeded)} ${StepToast.verifyToastMessageAndClose(toastMatrixEditorShiftPattern.valueGreaterThanMaxAllowed())}`, async () => {
    await meShiftPatterns.editCellValues([cellLocation1], inputExceeded);
    await toast.verifyToastMessageAndClose(toastMatrixEditorShiftPattern.valueGreaterThanMaxAllowed());
  });
 
  it(`Step 4 - ${StepMatrix.editCellValues(MatrixEditorShiftPattern.title, [cellLocation1], inputNotExceeded)}`, async () => {
    await meShiftPatterns.editCellValues([cellLocation1], inputNotExceeded);
  });
 
  it(`Step 5 - ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, cellLocation1.rowName, cellLocation1.columnName, inputNotExceeded)}`, async () => {
    await meShiftPatterns.verifyCellValue(cellLocation1.rowName, 0, cellLocation1.columnName, inputNotExceeded);
  });
});