/** 
 | 
 * @file        ADSO-9595 
 | 
 * @description Create recipe 
 | 
 * @author      Chan Clarence (ccn7@3ds.com) 
 | 
 * @copyright   Dassault Systèmes 
 | 
 */ 
 | 
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const'; 
 | 
import { AppMP } from '../../libmp/appmp'; 
 | 
import { ListRecipeContextMenuItem } from '../../libmp/forms/form.recipedefinition'; 
 | 
  
 | 
describe('ADSO-9595 - Create recipe', () => { 
 | 
  const appMP = AppMP.getInstance(); 
 | 
  const listRecipe = appMP.viewRecipes.formRecipeDefinition.listRecipe; 
 | 
  const listScenario = appMP.viewScenario.formScenario.lstScenario; 
 | 
  const recipeName = 'Recipe 9595'; 
 | 
  const recipeDescription = 'Recipe 9595 description'; 
 | 
  const scenarioName = 'ADSO-9595 Create recipe'; 
 | 
  
 | 
  beforeAll(async () => { 
 | 
    jasmine.addMatchers(qCustomMatcher); 
 | 
    await appMP.login(); 
 | 
  }); 
 | 
  
 | 
  afterAll(async () => { 
 | 
    await appMP.viewScenario.reset(); 
 | 
    await appMP.viewRecipes.reset(); 
 | 
    await appMP.cleanupAndLogout(); 
 | 
  }); 
 | 
  
 | 
  afterEach(async () => { 
 | 
    await appMP.checkToastMessage(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 1 - Open view ${appMP.viewScenario.viewPath}`, async () => { 
 | 
    await appMP.viewScenario.switchTo(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 2 - In Scenario Manager form, right click and select Create scenario menu. In dialog, enter Scenario name = '${scenarioName}' and click OK.`, async () => { 
 | 
    await listScenario.createEmptyScenario(scenarioName); 
 | 
    await appMP.verifyActiveScenario(scenarioName); 
 | 
  }); 
 | 
  
 | 
  it(`Step 3 - Open view ${appMP.viewRecipes.viewPath}`, async () => { 
 | 
    await appMP.viewRecipes.switchTo(); 
 | 
  }); 
 | 
  
 | 
  it(`Step 4 - In Recipes list, right click and select "Create" menu. In dialog, set Name = ${recipeName} and Description = ${recipeDescription}. Click OK to create.`, async () => { 
 | 
    const [dlgRecipe] = await listRecipe.selectContextMenu(ListRecipeContextMenuItem.Create); 
 | 
    await dlgRecipe.updateDialogValues({Name: recipeName, Description: recipeDescription}); 
 | 
    await dlgRecipe.clickOK(); 
 | 
  }); 
 | 
  
 | 
  it('Step 5 - In Recipes list, verify recipe created with correct Name and Description. Verify there\'s constraint violation.', async () => { 
 | 
    const row = await listRecipe.getRow({Name: recipeName}); 
 | 
    await listRecipe.verifyRowValues(row, {Description: recipeDescription}); 
 | 
    await listRecipe.verifyRowHasConstraintViolation(row, true); 
 | 
  }); 
 | 
}); 
 |