/** 
 | 
 * @file        ADSO-9535 
 | 
 * @description Create new currency 
 | 
 * @author      Mehrab Kamrani (mehrab.hassan@3ds.com) 
 | 
 * @copyright   Dassault Systèmes 
 | 
 */ 
 | 
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; 
 | 
import { AppMP, Demo, Scenario } from '../../libmp/appmp'; 
 | 
import { ListCurrencyContextMenuItem } from '../../libmp/forms/form.currency'; 
 | 
  
 | 
describe('ADSO-9535 - Create new currency via context menu in currency list and action bar Create button', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  
 | 
  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} and via context menu create new currency`, async () => { 
 | 
    await appMP.viewCurrency.switchTo(); 
 | 
  
 | 
    const [dlgCurrency] = await appMP.viewCurrency.formCurrency.listCurrency.selectContextMenu(ListCurrencyContextMenuItem.Create); 
 | 
    // Create a new currency 
 | 
    await dlgCurrency.updateDialogValues({Name: 'Ringgit', ID: 'Ringgit', Symbol: 'MYR'}); 
 | 
    await dlgCurrency.clickOK(); 
 | 
  
 | 
    await appMP.viewCurrency.formCurrency.listCurrency.verifyRowExists({Name: 'Ringgit'}); 
 | 
  }); 
 | 
  
 | 
  it('Step 3 - Repeat test using action bar Create button', async () => { 
 | 
    const dlgCurrency = await appMP.viewCurrency.formCurrency.listCurrency.clickActionButton(appMP.abpData.btnCreate); 
 | 
    // Create a new currency 
 | 
    await dlgCurrency.updateDialogValues({Name: 'Rial', ID: 'Rial', Symbol: 'IRR'}); 
 | 
    await dlgCurrency.clickOK(); 
 | 
  
 | 
    await appMP.viewCurrency.formCurrency.listCurrency.verifyRowExists({Name: 'Rial'}); 
 | 
  }); 
 | 
}); 
 |