Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
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
62
63
64
/**
 * @file        ADSO-50252
 * @description Visualize only customer orders in Customer Orders view
 * @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 { ListCustomerOrdersColumn } from '../../libmp/forms/form.customerorders';
import { StepList } from '../../libappsop/listsop';
import { ListForecastsColumn } from '../../libmp/forms/form.forecasts';
import { DataMetalStockingPointName } from '../../libmp/data/data.stockingpoint';
 
describe('ADSO-50252 - Visualize only customer orders in Customer Orders view', () => {
  const appMP = AppMP.getInstance();
  const scenarioToSelect = 'ADSO-50251';
  const listCustomerOrders = appMP.viewCustomerOrders.formCustomerOrders.listCustomerOrders;
  const listForecasts = appMP.viewForecasts.formForecasts.listForecasts;
  // Invalid as stocking point is empty as invalid stocking point passed in during creation in UTF
  const invalidCustomerOrderRow: ListCustomerOrdersColumn = {'Stocking point': '', 'Sales segment': DataMetalBaseSalesSegmentName.CanManChina, Product: DataMetalBaseProductName.BCCBWide};
  const forecastRow: ListForecastsColumn = {'Stocking point': DataMetalStockingPointName.NorthAmerica, 'Sales segment': DataMetalBaseSalesSegmentName.AllOrganics, Product: DataMetalBaseProductName.CPNCoil};
 
  beforeAll(async () => {
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.resetActiveView(appMP.viewForecasts);
    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.verifyRowExists(listCustomerOrders.title, invalidCustomerOrderRow)}`, async () => {
    await listCustomerOrders.verifyRowExists(invalidCustomerOrderRow);
  });
 
  it(`Step 4 - ${StepList.verifyRowNotExist(listCustomerOrders.title, forecastRow)}`, async () => {
    await listCustomerOrders.verifyRowNotExist(forecastRow);
  });
 
  it(`Step 5 - Open view ${appMP.viewForecasts.viewPath}.`, async () => {
    await appMP.viewForecasts.switchTo();
  });
 
  it(`Step 6 - ${StepList.verifyRowExists(listForecasts.title, forecastRow)}`, async () => {
    await listForecasts.verifyRowExists(forecastRow);
  });
 
  it(`Step 7 - ${StepList.verifyRowNotExist(listForecasts.title, invalidCustomerOrderRow)}`, async () => {
    await listForecasts.verifyRowNotExist(invalidCustomerOrderRow);
  });
});