/**
|
* @file ADSO-10205
|
* @description Select parent level items in the navigation panel (Sales segment)
|
* @testcategory Web - Navigation
|
* @author Meng Yew Cheah (MengYew.CHEAH@3ds.com)
|
* @copyright Dassault Systemes
|
*/
|
import { qCustomMatcher } from '../../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, Demo, Scenario } from '../../../libmp/appmp';
|
import { ListSalesSegment, StepNavigationPanel, ListSalesSegmentColumn } from '../../../libmp/forms/navigationpanel/form.navigationpanel';
|
import { dataFoodSalesSegment, dataFoodSalesSegmentProvider } from '../../../libmp/data/data.salessegment';
|
import { StepList } from '../../../libappsop/listsop';
|
|
describe('ADSO-10205 - Select parent level items in the navigation panel (Sales segment)', () => {
|
const appMP = AppMP.getInstance();
|
const listNavSalesSegment = appMP.formNavigation.listSalesSegment;
|
let name: ListSalesSegmentColumn;
|
let parent: ListSalesSegmentColumn[] | undefined;
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
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 - ${StepNavigationPanel.openNavigationPanel()}`, async () => {
|
await appMP.formNavigation.openNavigationPanel();
|
});
|
|
it(`Step 2 - ${StepNavigationPanel.showSalesSegmentsList()}`, async () => {
|
await appMP.formNavigation.toggleSalesSegmentList();
|
});
|
|
it(`Step 3 - ${StepNavigationPanel.checkSalesSegments([dataFoodSalesSegment.Target.Name])}`, async () => {
|
// New mechanism to pass only the Sales Segment name to 'dataFoodSalesSegmentProvider' to retrieve the ancestors recursively for easy maintenance
|
[name, parent] = listNavSalesSegment.getHierarchy(dataFoodSalesSegmentProvider, dataFoodSalesSegment.Target);
|
const targetRow = await listNavSalesSegment.getRow(name, parent);
|
await listNavSalesSegment.toggleRowCheckbox(targetRow, true);
|
await targetRow.expandRow();
|
});
|
|
it(`Step 4 - ${StepList.verifyChildrenRowsChecked(ListSalesSegment.title, dataFoodSalesSegment.Target.Name)} `, async () => {
|
await listNavSalesSegment.verifyChildrenRowsChecked(true, name, parent);
|
});
|
|
it (`Step 5 - ${StepNavigationPanel.unCheckSalesSegments ([dataFoodSalesSegment.Target.Name])}`, async () => {
|
const target = await listNavSalesSegment.getRow(name, parent);
|
await listNavSalesSegment.toggleRowCheckbox(target, false);
|
await target.expandRow();
|
});
|
|
it (`Step 6 - ${StepList.verifyChildrenRowsUnchecked (ListSalesSegment.title, dataFoodSalesSegment.Target.Name)}`, async () => {
|
await listNavSalesSegment.verifyChildrenRowsChecked(false, name, parent);
|
});
|
});
|