yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
/**
 * @file        ADSO-9544
 * @description Delete currency rate
 * @author      Chan Clarence (ccn7@3ds.com)
 * @copyright   Dassault Systèmes
 */
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { ListCurrencyRateContextMenuItem } from '../../libmp/forms/form.currencyrate';
import { ChartCurrencyRates } from '../../libmp/forms/form.currencyratechart';
import { DataFoodBaseCurrency } from '../../libmp/data/data.currency';
import { startOfPlanningYear } from '../../libmp/data/data.period';
 
describe('ADSO-9544 - Delete currency rate', () => {
  const appMP = AppMP.getInstance();
  const rmb = DataFoodBaseCurrency.RMB;
  const janSOPMinus2 = `1-Jan-${startOfPlanningYear - 2}`;
  const aprSOPMinus2 = `1-Apr-${startOfPlanningYear - 2}`;
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.viewCurrency.reset();
    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.viewCurrency.viewPath}.`, async () => {
    await appMP.viewCurrency.switchTo();
  });
 
  it(`Step 3 - Select RMB currency. Wait for Currency Rates list to refresh and delete (via context menu) currency rate for ${janSOPMinus2}.`, async () => {
    await appMP.viewCurrency.formCurrency.listCurrency.selectRow({Name: rmb});
 
    const row = await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.getRow({Start: janSOPMinus2});
    await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.selectContextMenu(ListCurrencyRateContextMenuItem.Delete, row);
  });
 
  it('Step 4 - Verify currency rate deleted from list and Rates chart.', async () => {
    await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.verifyRowNotExist({Start: janSOPMinus2});
    await appMP.viewCurrency.formCurrencyRateChart.chartCurrencyRate.verifyHasNoDataPoint(ChartCurrencyRates.LegendGroupName, rmb, janSOPMinus2);
  });
 
  it(`Step 5 - In Currency Rates list, select ${aprSOPMinus2} and click Delete action bar button.`, async () => {
    await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.selectRow({Start: aprSOPMinus2});
    await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.clickActionButton(appMP.abpData.btnDelete);
  });
 
  it('Step 6 - Verify currency rate deleted from list and Rates chart.', async () => {
    await appMP.viewCurrency.formCurrencyRate.listCurrencyRate.verifyRowNotExist({Start: aprSOPMinus2});
    await appMP.viewCurrency.formCurrencyRateChart.chartCurrencyRate.verifyHasNoDataPoint(ChartCurrencyRates.LegendGroupName, rmb, aprSOPMinus2);
  });
});