/**
|
* @file ADSO-10235
|
* @description Delete multiple campaigns
|
* @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 { ListCampaignColumn } from '../../libmp/forms/form.campaign';
|
import { DataCampaignTypeName } from '../../libmp/data/data.campaign';
|
import { GanttChartCampaignPlanningColors, GanttChartCampaignPlanningContextMenuItem } from '../../libmp/forms/form.campaignplanning';
|
import { GanttChartNodeSOPCriteria, StepGanttChart } from '../../libappsop/ganttchartsop';
|
import { StepList } from '../../libappsop/listsop';
|
import { DataMetalBaseEntityName } from '../../libmp/data/data.unit';
|
import { GanttChartRow } from '../../e2elib/lib/src/pageobjects/ganttchart/ganttchartrow';
|
|
describe('ADSO-10235 - Delete multiple campaigns', () => {
|
const appMP = AppMP.getInstance();
|
const gcCampaign = appMP.viewCampaign.formCampaignPlanning.gcCampaign;
|
let gcRowMeltingFurnaceQuilmes: GanttChartRow;
|
const listCampaign = appMP.viewCampaign.formCampaign.listCampaign;
|
|
const indexesToDelete: number[] = [1, 3];
|
|
const itemBlue: ListCampaignColumn = {
|
Unit: DataMetalBaseEntityName.MeltingFurnaceQuilmes,
|
'Campaign type': DataCampaignTypeName.Campaignfor5XXXsmelt,
|
};
|
|
const nodeCriteria: GanttChartNodeSOPCriteria = {
|
ColorHex: GanttChartCampaignPlanningColors.cyan().Hex,
|
};
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewCampaign);
|
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.viewCampaign.viewPath}.`, async () => {
|
await appMP.viewCampaign.switchTo();
|
});
|
|
it(`Step 3 - ${StepList.verifyRowExists(listCampaign.name, itemBlue)}`, async () => {
|
await listCampaign.verifyRowExists(itemBlue);
|
});
|
|
it(`Step 4 - ${StepGanttChart.verifyNodeCount(gcCampaign.name, DataMetalBaseEntityName.MeltingFurnaceQuilmes, 2, nodeCriteria)}`, async () => {
|
const rows = await gcCampaign.getRowsByTitle(DataMetalBaseEntityName.MeltingFurnaceQuilmes);
|
// Since there are 2 rows with the same title, we need to pick the second row.
|
gcRowMeltingFurnaceQuilmes = rows[1];
|
// Initially there are 2 blue nodes.
|
await gcCampaign.verifyNodeCount(gcRowMeltingFurnaceQuilmes, 2, nodeCriteria);
|
});
|
|
it(`Step 5 - ${StepGanttChart.rightClickNodeIndexesAndSelectContextMenu(
|
gcCampaign.name,
|
DataMetalBaseEntityName.MeltingFurnaceQuilmes,
|
indexesToDelete,
|
GanttChartCampaignPlanningContextMenuItem.Delete.Label,
|
)}`, async () => {
|
// Deleting second and fourth node.
|
await gcCampaign.rightClickNodeIndexesAndSelectContextMenu(gcRowMeltingFurnaceQuilmes, indexesToDelete, GanttChartCampaignPlanningContextMenuItem.Delete);
|
});
|
|
it(`Step 6 - ${StepList.verifyRowNotExist(listCampaign.name, itemBlue)}`, async () => {
|
await listCampaign.verifyRowNotExist(itemBlue);
|
});
|
|
it(`Step 7 - ${StepGanttChart.verifyNodeCount(gcCampaign.name, DataMetalBaseEntityName.MeltingFurnaceQuilmes, 0, nodeCriteria)}`, async () => {
|
// There were 5 nodes initially, now that 2 has been removed, there should be 0 blue nodes left
|
await gcCampaign.verifyNodeCount(gcRowMeltingFurnaceQuilmes, 0, nodeCriteria);
|
});
|
});
|