Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
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
/**
 * @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);
  });
});