/** 
 | 
 * @file        ADSO-9540 
 | 
 * @description Set non-base currency as base and verify marked as bold 
 | 
 * @author      Chan Clarence (ccn7@3ds.com) 
 | 
 * @copyright   Dassault Systèmes 
 | 
 */ 
 | 
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; 
 | 
import { AppMP, Demo, ImageAttribute, Scenario } from '../../libmp/appmp'; 
 | 
import { DataFoodBaseCurrency } from '../../libmp/data/data.currency'; 
 | 
import { ListCurrencyContextMenuItem } from '../../libmp/forms/form.currency'; 
 | 
  
 | 
describe('ADSO-9540 - Set non-base currency as base and verify marked as bold', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const euro = DataFoodBaseCurrency.Euro; 
 | 
  const krona = DataFoodBaseCurrency.Krona; 
 | 
  const listCurrency = appMP.viewCurrency.formCurrency.listCurrency; 
 | 
  
 | 
  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 - Verify "${euro}" is currently the base currency. "${euro}" marked as bold and image attribute indicating base currency.`, async () => { 
 | 
    await listCurrency.verifyFirstRowBaseCurrency(euro); 
 | 
  
 | 
    const row = await listCurrency.getRow({Name: euro}); 
 | 
    await listCurrency.verifyRowValues(row, {Base: ImageAttribute.IsDefault}); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - Right click "${krona}" and select menu "Set as base". Verify "${krona}" marked as bold and image attribute indicating base currency.<br> 
 | 
      Verify "${euro}" is now not the base currency and marked as normal font (not bold).`, async () => { 
 | 
    let row = await listCurrency.getRow({Name: krona}); 
 | 
    await listCurrency.selectContextMenu(ListCurrencyContextMenuItem.SetAsBase, row); 
 | 
  
 | 
    await listCurrency.verifyFirstRowBaseCurrency(krona); 
 | 
  
 | 
    // Re-query row since we set it as base and it moves to the top of list 
 | 
    row = await listCurrency.getRow({Name: krona}); 
 | 
    await listCurrency.verifyRowValues(row, {Base: ImageAttribute.IsDefault}); 
 | 
  }); 
 | 
}); 
 |