/**
|
* @file ADSO-9493
|
* @description Create new strategy
|
* @author Mehrab Kamrani (mehrab.hassan@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, Demo, Scenario } from '../../libmp/appmp';
|
import { ListStrategyContextMenuItem } from '../../libmp/forms/form.optimizerstrategies';
|
|
describe('ADSO-9493 - Create new strategy via context menu in strategy list and action bar Create button', () => {
|
const appMP = AppMP.getInstance();
|
const listStrategy = appMP.viewOptimizerStrategies.frmOptimizerStrategies.listStrategy;
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.resetActiveView(appMP.viewScenarioAnalysisOverview);
|
await appMP.cleanupAndLogout();
|
});
|
|
afterEach(async () => {
|
await appMP.checkToastMessage();
|
});
|
|
it(`Setup - ${AppMP.getDemoDataPath(Demo.Food, Scenario.Base)}`, async () => {
|
await appMP.createDemoDataset(Demo.Food, Scenario.Base, false);
|
});
|
|
it(`Step 1 - Open view ${appMP.viewOptimizerStrategies.viewPath} and via context menu on Strategies list create new strategy`, async () => {
|
await appMP.viewOptimizerStrategies.switchTo();
|
|
// Create from context menu of strategy list
|
const [dlgStrategy] = await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Create);
|
|
// Verify Active Goal list is empty for new created strategy
|
const listActiveGoalsRowCount = await dlgStrategy.listActiveGoals.getRowCount();
|
expect(listActiveGoalsRowCount).toBe(0, 'Create strategy dialog, by default active goals list should be empty.');
|
|
await dlgStrategy.updateDialogValues({Name: 'Strategy Test 1'});
|
await dlgStrategy.clickOK();
|
|
// Verify strategy created in list
|
await listStrategy.verifyRowExists({Name: 'Strategy Test 1'});
|
});
|
|
it('Step 2 - Repeat test using action bar Create button', async () => {
|
// Create from Scenarios Action bar create menu
|
const dlgStrategy = await listStrategy.clickActionButton(appMP.abpScenario.btnCreate);
|
|
// Verify Active Goal list is empty for new created strategy
|
const listActiveGoalsRowCount = await dlgStrategy.listActiveGoals.getRowCount();
|
expect(listActiveGoalsRowCount).toBe(0, 'Create strategy dialog, by default active goals list should be empty.');
|
|
await dlgStrategy.updateDialogValues({Name: 'Strategy Test 2'});
|
await dlgStrategy.clickOK();
|
|
// Verify strategy created in list
|
await listStrategy.verifyRowExists({Name: 'Strategy Test 2'});
|
});
|
|
it('Clean Up the data - remove strategies and verify not in list', async () => {
|
// Delete the strategy created in step 1
|
let row = await listStrategy.getRow({Name: 'Strategy Test 1'});
|
await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Delete, row);
|
await listStrategy.verifyRowNotExist({Name: 'Strategy Test 1'});
|
|
// Delete the strategy created in step 2
|
row = await listStrategy.getRow({Name: 'Strategy Test 2'});
|
await listStrategy.selectContextMenu(ListStrategyContextMenuItem.Delete, row);
|
await listStrategy.verifyRowNotExist({Name: 'Strategy Test 2'});
|
});
|
});
|