/**
|
* @file ADSO-50244
|
* @description Delete customer orders
|
* @author Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { AppMP, StepAppMP } from '../../libmp/appmp';
|
import { DataMetalBaseSalesSegmentName } from '../../libmp/data/data.salessegment';
|
import { DataMetalBaseProductName } from '../../libmp/data/data.product';
|
import { DataMetalStockingPointName } from '../../libmp/data/data.stockingpoint';
|
import { StepList } from '../../libappsop/listsop';
|
import { StepActionBarPage } from '../../libappsop/actionbarpagesop';
|
import { ListCustomerOrdersColumn, ListCustomerOrdersContextMenuItem } from '../../libmp/forms/form.customerorders';
|
import { startOfPlanningYear } from '../../libmp/data/data.period';
|
|
describe('ADSO-50244 - Delete customer orders', () => {
|
const appMP = AppMP.getInstance();
|
const scenarioToSelect = 'ADSO-50244';
|
const janSOP = `1-Jan-${startOfPlanningYear}`;
|
const listCustomerOrders = appMP.viewCustomerOrders.formCustomerOrders.listCustomerOrders;
|
const deleteRows: ListCustomerOrdersColumn[] = [{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Asia, 'Order date': janSOP, Quantity: '100'},
|
{'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide, 'Stocking point': DataMetalStockingPointName.Asia, 'Order date': janSOP, Quantity: '200'}];
|
|
beforeAll(async () => {
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewCustomerOrders);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Step 1 - ${StepAppMP.selectScenario(scenarioToSelect)}`, async () => {
|
await appMP.selectScenario(scenarioToSelect);
|
});
|
|
it(`Step 2 - Open view ${appMP.viewCustomerOrders.viewPath}.`, async () => {
|
await appMP.viewCustomerOrders.switchTo();
|
});
|
|
it(`Step 3 - ${StepList.selectRows(listCustomerOrders.title, deleteRows)} ${StepActionBarPage.clickButton('Delete')}`, async () => {
|
const rows = await listCustomerOrders.selectListRows(deleteRows);
|
await listCustomerOrders.clickActionButton(appMP.abpSales.btnDelete, undefined, rows);
|
});
|
|
it(`Step 4 - ${StepList.verifyRowNotExist(listCustomerOrders.title, deleteRows[0])} ${StepList.verifyRowNotExist(listCustomerOrders.title, deleteRows[1])}`, async () => {
|
await listCustomerOrders.verifyRowNotExist(deleteRows[0]);
|
await listCustomerOrders.verifyRowNotExist(deleteRows[1]);
|
});
|
|
it(`Step 5 - ${StepList.selectAllRowsAndClickMenu(listCustomerOrders.title, ListCustomerOrdersContextMenuItem.Delete.Label)}`, async () => {
|
await listCustomerOrders.selectAllAndSelectContextMenu(ListCustomerOrdersContextMenuItem.Delete);
|
});
|
|
it(`Step 6 - ${StepList.verifyTotalRow(listCustomerOrders.title, 0)}`, async () => {
|
await listCustomerOrders.verifyTotalRow(0, 'Expected no more customer order in list after deleting all rows.');
|
});
|
|
it(`Step 7 - ${StepList.verifyContextMenuDisabled(listCustomerOrders.title, ListCustomerOrdersContextMenuItem.Delete.Label)}`, async () => {
|
await listCustomerOrders.verifyContextMenuDisabled(ListCustomerOrdersContextMenuItem.Delete);
|
});
|
|
it(`Step 8 - ${StepActionBarPage.verifyButtonDisabled('Delete')}`, async () => {
|
await appMP.abpSales.btnDelete.verifyEnabled(false);
|
});
|
});
|