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