limj
2023-10-24 93652435728de839582440eefd5122c281181d35
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
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
 * @file        ADSO-9592
 * @description Create ingredient and link to 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 { ListIngredientContextMenuItem } from '../../libmp/forms/form.ingredient';
import { ListRecipeContextMenuItem } from '../../libmp/forms/form.recipedefinition';
 
describe('ADSO-9592 - Create ingredient and link to recipe', () => {
  const appMP = AppMP.getInstance();
  const listIngredient = appMP.viewRecipes.formIngredient.listIngredient;
  const listRecipe = appMP.viewRecipes.formRecipeDefinition.listRecipe;
  const listScenario = appMP.viewScenario.formScenario.lstScenario;
  const ingredientName = 'Ing';
  const ingredientDescription = 'Ing description';
  const recipeName = 'Recipe';
  const recipeDescription = 'Recipe description';
  const scenarioName = 'Create ingredient';
 
  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 Ingredients list, right click and select "Create" menu. In dialog, set Name = "${ingredientName}" and Description = "${ingredientDescription}". Click OK to create.`, async () => {
    const [dlgIngredient] = await listIngredient.selectContextMenu(ListIngredientContextMenuItem.Create);
    await dlgIngredient.updateDialogValues({Name: ingredientName, Description: ingredientDescription});
    await dlgIngredient.clickOK();
 
    await listIngredient.verifyRowExists({Name: ingredientName, Description: ingredientDescription});
  });
 
  it(`Step 5 - 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();
 
    await listRecipe.verifyRowExists({Name: recipeName, Description: recipeDescription});
  });
 
  it('Step 6 - In Recipes list, right click the new recipe and click menu "Create recipe ingredients". Verify ingredient assigned to recipe in list "Recipe ingredients" with Minimum, Maximum and Nominal all 0.', async () => {
    const row = await listRecipe.getRow({Name: recipeName});
    await listRecipe.selectContextMenu(ListRecipeContextMenuItem.CreateRecipeIngredient, row);
 
    const ingredientValue = '0.00000';
    await appMP.viewRecipes.formRecipeDefinition.listRecipeIngredient.verifyRowExists({'Display name': ingredientName, Minimum: ingredientValue, Maximum: ingredientValue, Nominal: ingredientValue});
  });
});