| /** | 
|  * @file        ADSO-9806 | 
|  * @description Create shift pattern | 
|  * @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 { MatrixEditorShiftPattern, MatrixEditorShiftPatternContextMenuItem } from '../../libmp/forms/form.shiftpattern'; | 
| import { btnOkTooltip, DialogShiftPattern, DialogShiftPatternFields } from '../../libmp/dialogs/dialog.shiftpattern'; | 
| import { StepMatrix } from '../../libappsop/matrixeditorsop'; | 
| import { StepDialog } from '../../libappsop/dialogsop'; | 
| import { friday, monday, saturday, sunday, thursday, tuesday, wednesday } from '../../libmp/data/data.period'; | 
| import { DataMetalBaseShiftPattern } from '../../libmp/data/data.shiftpattern'; | 
| import { StepActionBarPage } from '../../libappsop/actionbarpagesop'; | 
|   | 
| describe('ADSO-9806 - Create shift pattern', () => { | 
|   const appMP = AppMP.getInstance(); | 
|   const meShiftPattern = appMP.viewCapacitiesTime.formShiftPattern.meShiftPattern; | 
|   let dlgShiftPattern: DialogShiftPattern; | 
|   const abpData = appMP.abpData; | 
|   | 
|   const nameShiftPattern12x5 = DataMetalBaseShiftPattern.TwelveTimesFive; | 
|   const input12x5: DialogShiftPatternFields = { Name: nameShiftPattern12x5 }; | 
|   const input8x5: DialogShiftPatternFields = { Name: DataMetalBaseShiftPattern.EightTimesFive }; | 
|   const expectedValue = '0:00: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.rightClickMatrixSelectContextmenu(MatrixEditorShiftPattern.title, MatrixEditorShiftPatternContextMenuItem.Create.Label)}`, async () => { | 
|     dlgShiftPattern = await meShiftPattern.rightClickMatrixSelectContextmenu(MatrixEditorShiftPatternContextMenuItem.Create.Name); | 
|   }); | 
|   | 
|   it(`Step 4 - ${StepDialog.verifyOKDisabled('OK', btnOkTooltip.missingName())}`, async () => { | 
|     await dlgShiftPattern.verifyOKDisabled(btnOkTooltip.missingName()); | 
|   }); | 
|   | 
|   it(`Step 5 - ${StepDialog.updateDialogValues(DialogShiftPattern.title, input12x5)} ${StepDialog.clickOK()}`, async () => { | 
|     await dlgShiftPattern.updateDialogValues(input12x5); | 
|     await dlgShiftPattern.clickOK(); | 
|   }); | 
|   | 
|   it(`Step 6 - ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, monday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, tuesday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, wednesday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, thursday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, friday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, saturday, expectedValue)} ${StepMatrix.verifyCellValue(MatrixEditorShiftPattern.title, nameShiftPattern12x5, sunday, expectedValue)}`, async () => { | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, monday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, tuesday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, wednesday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, thursday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, friday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, saturday, expectedValue); | 
|     await meShiftPattern.verifyCellValue(nameShiftPattern12x5, 0, sunday, expectedValue); | 
|   }); | 
|   | 
|   it(`Step 7 - ${StepActionBarPage.clickButton('Create')}`, async () => { | 
|     await abpData.btnCreate.click(); | 
|   }); | 
|   | 
|   it(`Step 8 - ${StepDialog.updateDialogValues(DialogShiftPattern.title, input12x5)} ${StepDialog.verifyOKDisabled('OK', btnOkTooltip.uniqueName(nameShiftPattern12x5))}`, async () => { | 
|     await dlgShiftPattern.updateDialogValues(input12x5); | 
|     await dlgShiftPattern.verifyOKDisabled(btnOkTooltip.uniqueName(nameShiftPattern12x5)); | 
|   }); | 
|   | 
|   it(`Step 9 - ${StepDialog.updateDialogValues(DialogShiftPattern.title, input8x5)} ${StepDialog.verifyOKEnabled()} ${StepDialog.clickCancel()}`, async () => { | 
|     await dlgShiftPattern.updateDialogValues(input8x5); | 
|     await dlgShiftPattern.verifyOKEnabled(); | 
|     await dlgShiftPattern.clickCancel(); | 
|   }); | 
| }); |