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