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