/**
|
* @file ADSO-9529
|
* @description Create Unit of Measure (UoM)
|
* @author Chan Clarence (ccn7@3ds.com)
|
* @copyright Dassault Systèmes
|
*/
|
import { qCustomMatcher } from '../../e2elib/lib/src/main/qmatchers.const';
|
import { AppMP, ImageAttribute } from '../../libmp/appmp';
|
import { DialogUnitOfMeasure } from '../../libmp/dialogs/dialog.unitofmeasure';
|
import { ListUnitsOfMeasureContextMenuItem } from '../../libmp/forms/form.unitsofmeasure';
|
|
describe('ADSO-9529 - Create Unit of Measure (UoM)', () => {
|
const appMP = AppMP.getInstance();
|
let dlgUoM: DialogUnitOfMeasure;
|
const listUoM = appMP.viewUnitsOfMeasure.formUnitsOfMeasure.listUnitsOfMeasure;
|
|
beforeAll(async () => {
|
jasmine.addMatchers(qCustomMatcher);
|
await appMP.login();
|
});
|
|
afterAll(async () => {
|
await appMP.viewScenario.reset();
|
await appMP.viewUnitsOfMeasure.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 list and click Create scenario menu. Fill name as \'1\' and click OK.', async () => {
|
await appMP.viewScenario.formScenario.lstScenario.createEmptyScenario('1');
|
});
|
|
it(`Step 3 - Open view ${appMP.viewUnitsOfMeasure.viewPath}`, async () => {
|
await appMP.viewUnitsOfMeasure.switchTo();
|
});
|
|
it(`Step 4 - Verify Ton exists in UoM list and set as default UoM (ImgIsDefault column has ${ImageAttribute.IsDefault} icon).`, async () => {
|
const row = await listUoM.getRow({Name: 'Ton'});
|
await listUoM.verifyRowValues(row, {ImgIsDefault: ImageAttribute.IsDefault});
|
});
|
|
it('Step 5 - Right click in UoM list and click Create menu. In dialog, verify factor default 1.', async () => {
|
[dlgUoM] = await listUoM.selectContextMenu(ListUnitsOfMeasureContextMenuItem.Create);
|
await dlgUoM.verifyDialogValues({Factor: '1'});
|
});
|
|
it('Step 6 - Set UoM name = \'UoM 2\' and factor = 2. Click OK. Verify UoM created in list and not marked as default.', async () => {
|
await dlgUoM.updateDialogValues({Name: 'UoM 2', Factor: '2'});
|
await dlgUoM.clickOK();
|
|
const row = await listUoM.getRow({Name: 'UoM 2'}); // Check row exists
|
await listUoM.verifyRowValues(row, {ImgIsDefault: ImageAttribute.IsEmpty}); // Created not as default (empty img attribute)
|
});
|
|
it('Step 7 - Focus on UoM list and click Create action bar button. Set UoM name = \'UoM 3\' and factor = 3. Click OK. Verify UoM created in list and not marked as default.', async () => {
|
dlgUoM = await listUoM.clickActionButton(appMP.abpData.btnCreate);
|
await dlgUoM.updateDialogValues({Name: 'UoM 3', Factor: '3'});
|
await dlgUoM.clickOK();
|
|
const row = await listUoM.getRow({Name: 'UoM 3'}); // Check row exists
|
await listUoM.verifyRowValues(row, {ImgIsDefault: ImageAttribute.IsEmpty}); // Created not as default (empty img attribute)
|
});
|
});
|