/**
|
* @file ADSO-9980
|
* @description Create event with occurrences
|
* @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 { DataEventCategoryName, DataEventTypeName } from '../../libmp/data/data.calendar';
|
import { StepList } from '../../libappsop/listsop';
|
import { GanttChartCommonEvent, ListCommonEvent, ListCommonEventColumn, ListCommonEventOccurrence, ListEventCategory, ListEventCategoryColumn, ListEventCategoryContextMenuItem, ListCommonEventOccurrenceColumn, PanelCommonEventsList } from '../../libmp/forms/commoncalendar';
|
import { StepGanttChart } from '../../libappsop/ganttchartsop';
|
import { startOfPlanningYear } from '../../libmp/data/data.period';
|
import { StepDialog } from '../../libappsop/dialogsop';
|
import { CalendarEventRepeat, DialogCalendarEvent, PanelCalendarEventFields, StepDialogCalendarEvent, StepPanelRecurrenceWeekly } from '../../libmp/dialogs/calendarevent';
|
import { ColorList } from '../../libappsop/colorsop';
|
|
describe('ADSO-9980 - Create event with occurrences', () => {
|
const appMP = AppMP.getInstance();
|
const listEventCategories = appMP.viewCalendar.formCommonCalendar.listEventCategory;
|
const panelCommonEventsGanttChart = appMP.viewCalendar.formCommonCalendar.pnlCommonEventsGanttChart;
|
const panelCommonEventsList = appMP.viewCalendar.formCommonCalendar.pnlCommonEventsList;
|
const gcCommonEvents = panelCommonEventsGanttChart.gcCommonCalendarEvent;
|
const listCommonEvents = panelCommonEventsList.listCommonEvent;
|
const dlgCommonEvents = listCommonEvents.dlgCreateEdit;
|
const listOccurrence = panelCommonEventsList.listCommonEventOccurrence;
|
|
const eventName = 'Weekly Maintenance';
|
const inputDialogEvents: PanelCalendarEventFields = {
|
Name: eventName,
|
Description: 'Machine unavailable due to maintenance.',
|
Type: DataEventTypeName.Unavailable,
|
ApplyToNewResources: 'true',
|
StartDate: `03-Jan-${startOfPlanningYear}`,
|
IsAllDay: 'true',
|
// TODO: https://jira.delmia.dsone.3ds.com/browse/CTQC-4779. Work around for the bug where the year changes into a random value upon selecting "all day".
|
EndDate: `04-Jan-${startOfPlanningYear}`,
|
};
|
|
const startDate1 = new Date(`03-Jan-${startOfPlanningYear}`);
|
const endDate1 = new Date(`04-Jan-${startOfPlanningYear}`);
|
const startDate2 = new Date(`10-Jan-${startOfPlanningYear}`);
|
const endDate2 = new Date(`11-Jan-${startOfPlanningYear}`);
|
const startDate3 = new Date(`17-Jan-${startOfPlanningYear}`);
|
const endDate3 = new Date(`18-Jan-${startOfPlanningYear}`);
|
|
const inputPanelReccurenceWeekly: PanelCalendarEventFields = {
|
RecurWeeklyRepeatEvery: '1',
|
RecurWeeklyEndBy: 'true',
|
RecurWeeklyEndByDate: `17-Jan-${startOfPlanningYear}`,
|
};
|
const repeatOnDays: number[] = [startDate1.getDay()];
|
|
const itemUnavailableListCategory: ListEventCategoryColumn = { Name: DataEventCategoryName.Unavailable };
|
|
const rowListCommonCalendar: ListCommonEventColumn = { Name: eventName, NrOfOccurrences: '3' };
|
const parentListCommonCalendar: ListCommonEventColumn[] = [{ Category: DataEventCategoryName.Unavailable }];
|
|
const rowOccurrenceList1: ListCommonEventOccurrenceColumn = { Start: `3-Jan-${startOfPlanningYear}`, End: `4-Jan-${startOfPlanningYear}` };
|
const rowOccurrenceList2: ListCommonEventOccurrenceColumn = { Start: `10-Jan-${startOfPlanningYear}`, End: `11-Jan-${startOfPlanningYear}` };
|
const rowOccurrenceList3: ListCommonEventOccurrenceColumn = { Start: `17-Jan-${startOfPlanningYear}`, End: `18-Jan-${startOfPlanningYear}` };
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewCalendar);
|
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.viewCalendar.viewPath}.`, async () => {
|
await appMP.viewCalendar.switchTo();
|
});
|
|
it(`Step 3 - ${StepList.selectRowAndClickMenu(ListEventCategory.title, itemUnavailableListCategory, ListEventCategoryContextMenuItem.CreateEvent.Label)}`, async () => {
|
const row = await listEventCategories.getRow(itemUnavailableListCategory);
|
await listEventCategories.selectContextMenu(ListEventCategoryContextMenuItem.CreateEvent, row);
|
});
|
|
it(`Step 4 - ${StepDialog.updateDialogValues(DialogCalendarEvent.title, inputDialogEvents)}`, async () => {
|
await dlgCommonEvents.updateDialogValues(inputDialogEvents);
|
});
|
|
it(`Step 5 - ${StepDialogCalendarEvent.setEventRepeat(CalendarEventRepeat.Weekly)}`, async () => {
|
await dlgCommonEvents.setEventRepeat(CalendarEventRepeat.Weekly);
|
});
|
|
it(`Step 6 - ${StepDialogCalendarEvent.clickCustomizeRepetition()}`, async () => {
|
await dlgCommonEvents.clickCustomizeRepetition();
|
});
|
|
it(`Step 7 - ${StepDialog.updateDialogValues(DialogCalendarEvent.title, inputPanelReccurenceWeekly)}`, async () => {
|
await dlgCommonEvents.updateDialogValues(inputPanelReccurenceWeekly);
|
});
|
|
it(`Step 8 - ${StepPanelRecurrenceWeekly.setRepeatWeeklyOnDays(repeatOnDays)}`, async () => {
|
await dlgCommonEvents.pnlRecurrenceWeekly.setRepeatWeeklyOnDays(repeatOnDays);
|
});
|
|
it(`Step 9 - ${StepDialog.clickOK()}`, async () => {
|
await dlgCommonEvents.clickOK();
|
});
|
|
it(`Step 10 - ${StepGanttChart.ensureVisible(GanttChartCommonEvent.title, startDate1.toDateString())} ${StepGanttChart.verifyNodeExists(GanttChartCommonEvent.title, eventName, startDate1, endDate1, ColorList.gray().Color)}`, async () => {
|
await gcCommonEvents.ensureVisible(startDate1);
|
await gcCommonEvents.verifyNodeExists(eventName, startDate1, endDate1, ColorList.gray());
|
});
|
|
it(`Step 11 - ${StepGanttChart.ensureVisible(GanttChartCommonEvent.title, startDate2.toDateString())} ${StepGanttChart.verifyNodeExists(GanttChartCommonEvent.title, eventName, startDate2, endDate2, ColorList.gray().Color)}`, async () => {
|
await gcCommonEvents.ensureVisible(startDate2);
|
await gcCommonEvents.verifyNodeExists(eventName, startDate2, endDate2, ColorList.gray());
|
});
|
|
it(`Step 12 - ${StepGanttChart.ensureVisible(GanttChartCommonEvent.title, startDate3.toDateString())} ${StepGanttChart.verifyNodeExists(GanttChartCommonEvent.title, eventName, startDate3, endDate3, ColorList.gray().Color)}`, async () => {
|
await gcCommonEvents.ensureVisible(startDate3);
|
await gcCommonEvents.verifyNodeExists(eventName, startDate3, endDate3, ColorList.gray());
|
});
|
|
it(`Step 13 - ${StepDialog.clickTab(PanelCommonEventsList.title)}`, async () => {
|
await panelCommonEventsList.clickTab();
|
});
|
|
it(`Step 14 - ${StepList.verifyRowExists(ListCommonEvent.title, rowListCommonCalendar, parentListCommonCalendar)}`, async () => {
|
await listCommonEvents.verifyRowExists(rowListCommonCalendar, parentListCommonCalendar);
|
});
|
|
it(`Step 15 - ${StepList.selectRow(ListCommonEvent.title, rowListCommonCalendar)}`, async () => {
|
await listCommonEvents.selectRow(rowListCommonCalendar);
|
});
|
|
it(`Step 16 - ${StepList.verifyRowExists(ListCommonEventOccurrence.title, rowOccurrenceList1)} ${StepList.verifyRowExists(ListCommonEventOccurrence.title, rowOccurrenceList2)} ${StepList.verifyRowExists(ListCommonEventOccurrence.title, rowOccurrenceList3)}`, async () => {
|
await listOccurrence.verifyRowExists(rowOccurrenceList1);
|
await listOccurrence.verifyRowExists(rowOccurrenceList2);
|
await listOccurrence.verifyRowExists(rowOccurrenceList3);
|
});
|
});
|