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
59
60
61
/**
 * @file        ADSO-9303, ADSO-9305  - Create bookmark folder and two bookmark folder with same name is not allowed
 * @description ADSO-9303 - Create bookmark folder with name 'Folder X' and verify bookmark folder is created
 * ADSO-9305 - Create bookmark folder with name 'Folder X' and verify is ok button in dialog is disabled
 * as there is already a folder with same folder name
 * @author      Wong Jia Hui (jiahui.wong@3ds.com)
 * @copyright   Dassault Systemes
 */
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
import { AppMP, Demo, Scenario, Timeout } from '../../libmp/appmp';
import { ListBookmarkContextMenuItem } from '../../libmp/forms/navigationpanel/form.navigationpanel';
 
describe('ADSO-9303, ADSO-9305 - Create bookmark and verify two bookmark folder with same name is not allowed', () => {
  const appMP = AppMP.getInstance();
  const listBookmark = appMP.formNavigation.listBookmark;
 
  beforeAll(async () => {
    jasmine.addMatchers(qCustomMatcher);
    await appMP.login();
  });
 
  afterAll(async () => {
    await appMP.cleanupAndLogout();
  });
 
  afterEach(async () => {
    await appMP.checkToastMessage();
  });
 
  it(`Setup - ${AppMP.getDemoDataPath(Demo.Metals, Scenario.Base)}`, async () => {
    await appMP.createDemoDataset(Demo.Metals, Scenario.Base, false);
  });
 
  it('ADSO-9303 - Create bookmark folder in "Sales demo metals" bookmark folder', async () => {
    // Navigation panel form should show up directly after login
    // Verify if navigation panel form is visible 'FormNavigationPanel'
    expect(await appMP.formNavigation.isVisible()).toBe(true, 'Navigation panel should be visible');
    // Click on bookmark button to show Bookmarks list
    await appMP.formNavigation.toggleBookmarkList(true);
    // Expand "Sales demo metals" bookmark folder
    const salesDemoMetalsFolder = await listBookmark.getRow({Name: 'Sales demo metals'});
    await salesDemoMetalsFolder.expandRow();
    // Create 'Folder X' in bookmarks
    const [dlgBookmark] = await listBookmark.selectContextMenu(ListBookmarkContextMenuItem.CreateFolder);
    await dlgBookmark.updateDialogValues({Folder: 'Sales demo metals', Name: 'Folder X'});
    await dlgBookmark.clickOK(Timeout.ButtonState);
    await listBookmark.verifyRowExists({Name: 'Folder X'}, [{Name: 'Sales demo metals'}]);
  });
 
  it('ADSO-9305 - Two bookmarks folders with same name is not allowed', async () => {
    // Select 'Sales demo metals' folder in list
    const salesDemoMetalsFolder = await listBookmark.getRow({Name: 'Sales demo metals'});
    await salesDemoMetalsFolder.expandRow();
    // Create 'Folder X' in bookmarks
    const [dlgBookmark] = await listBookmark.selectContextMenu(ListBookmarkContextMenuItem.CreateFolder);
    await dlgBookmark.updateDialogValues({Folder: 'Sales demo metals', Name: 'Folder X'});
    // Verify if ok button is disabled
    await dlgBookmark.verifyOKDisabled();
    await dlgBookmark.clickCancel();
  });
});