/** 
 | 
 * @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); 
 | 
  }); 
 | 
}); 
 |