From 9b2ceb347a3371819fcad6bbe2268203afecaf4e Mon Sep 17 00:00:00 2001 From: "Stone, Avi (as206k)" Date: Thu, 12 Apr 2018 16:36:39 +0300 Subject: DCAE-D fe initial commit DCAE-D fe initial commit Change-Id: Ica8ccb7c7ef769c969664d1e168d205eb9fc67f2 Issue-ID: SDC-1218 Signed-off-by: Stone, Avi (as206k) --- .../integration/e2e/e2eWithIntegration-spec.ts | 145 +++++++++++++ .../cypress/integration/mocks/errorDialog-spec.ts | 22 ++ .../cypress/integration/mocks/generalPage-spec.ts | 84 ++++++++ public/cypress/integration/mocks/homePage-spec.ts | 209 +++++++++++++++++++ .../cypress/integration/mocks/importPage-spec.ts | 232 +++++++++++++++++++++ .../cypress/integration/mocks/ruleEngine-spec.ts | 168 +++++++++++++++ 6 files changed, 860 insertions(+) create mode 100644 public/cypress/integration/e2e/e2eWithIntegration-spec.ts create mode 100644 public/cypress/integration/mocks/errorDialog-spec.ts create mode 100644 public/cypress/integration/mocks/generalPage-spec.ts create mode 100644 public/cypress/integration/mocks/homePage-spec.ts create mode 100644 public/cypress/integration/mocks/importPage-spec.ts create mode 100644 public/cypress/integration/mocks/ruleEngine-spec.ts (limited to 'public/cypress/integration') diff --git a/public/cypress/integration/e2e/e2eWithIntegration-spec.ts b/public/cypress/integration/e2e/e2eWithIntegration-spec.ts new file mode 100644 index 0000000..459a7de --- /dev/null +++ b/public/cypress/integration/e2e/e2eWithIntegration-spec.ts @@ -0,0 +1,145 @@ +const randomNodeName = () => + Math.random() + .toString(36) + .substr(2, 7); +const NODE_NAME = randomNodeName(); + +const serverGetDDLData = () => { + return cy + .server() + .route( + 'GET', + Cypress.env('backendUrl') + '/getResourcesByMonitoringTemplateCategory' + ) + .as('templateAPi') + .route( + 'GET', + Cypress.env('backendUrl') + + '/service/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a' + ) + .as('vfniListAPi'); +}; + +const saveAndDoneHttp = () => { + cy.server(); + cy + .route({ + method: 'POST', + url: Cypress.env('backendUrl') + '/rule-editor/rule/**/**/**/**' + }) + .as('doneSaveCopyRule'); +}; + +const createNewMC = () => { + cy + .get('input[data-tests-id="nameMc"]') + .type(`Hello${NODE_NAME}`) + .get('textarea[data-tests-id="descMc"]') + .type('Hello Description') + .get('select[data-tests-id="templateDdl"]') + .then($els => { + const opt = $els.find('option'); + const first = opt.get(1) as any; + return $els.val(first.value); + }) + .trigger('change') + .get('select[data-tests-id="vfniDdl"]') + .then($els => { + const opt = $els.find('option'); + const first = opt.get(1) as any; + return $els.val(first.value); + }) + .trigger('change') + .get('button[data-tests-id="createMonitoring"]') + .not('[disabled]') + .should('not.contain', 'Disabled'); + cy + .server() + .route({ + method: 'POST', + url: Cypress.env('backendUrl') + '/createMC' + }) + .as('newMC') + .get('button[data-tests-id="createMonitoring"]') + .click() + .wait('@newMC'); +}; + +import { buttonCreateMC } from '../mocks/homePage-spec'; +import { + selectVersionAndTypeAndAddFirstRule, + fillRuleDecription, + addCopyAction, + editFirstRule +} from '../mocks/ruleEngine-spec'; + +describe('DCAED - forntend e2e and inagration test', () => { + context('Empty Monitoring Configuration list for service', () => { + it('Loads', () => { + cy.homePage(); + }); + }); + + context('Create new monitoring configuration', () => { + beforeEach(() => { + serverGetDDLData(); + cy.homePage(); + buttonCreateMC() + .click() + .wait(['@templateAPi', '@vfniListAPi']); + }); + + it('After api call success verify create button is disabled', () => { + cy + .get('button[data-tests-id="createMonitoring"]') + .should('be.visible') + .and('be.disabled'); + }); + + it('click on create mc - more then one tab should be visible', () => { + createNewMC(); + cy + .get('ul[p-tabviewnav]') + .children() + .should($el => { + expect($el.length).to.be.greaterThan(1); + }); + }); + + it('should enter rule engine in map tab and create new rule', () => { + createNewMC(); + cy + .get('#ui-tabpanel-1-label') + .should('contain', 'map') + .click(); + selectVersionAndTypeAndAddFirstRule(); + fillRuleDecription('newRule'); + addCopyAction(); + saveAndDoneHttp(); + cy.get('button[data-tests-id="btnDone"]').click(); + cy + .wait('@doneSaveCopyRule') + .get('div[data-tests-id="ruleElement"]') + .should('be.visible') + .then(function($lis) { + expect($lis).to.have.length(1); + expect($lis.eq(0)).to.contain('newRule'); + }); + editFirstRule(); + fillRuleDecription('LiavRule'); + saveAndDoneHttp(); + cy + .get('button[data-tests-id="btnSave"]') + .click() + .wait('@doneSaveCopyRule') + .get('a[data-tests-id="btnBackRule"]') + .click() + .get('div[data-tests-id="ruleElement"]') + .should('be.visible') + .then(function($lis) { + expect($lis).to.have.length(1); + expect($lis.eq(0)).to.contain('LiavRule'); + }); + }); + }); +}); diff --git a/public/cypress/integration/mocks/errorDialog-spec.ts b/public/cypress/integration/mocks/errorDialog-spec.ts new file mode 100644 index 0000000..9141ab2 --- /dev/null +++ b/public/cypress/integration/mocks/errorDialog-spec.ts @@ -0,0 +1,22 @@ +describe('Dialog error - E2E test flow with mock', () => { + describe('Simulate errors', () => { + beforeEach(() => { + cy.getMCListEmpty(); + cy.getTemplateApiError(); + }); + + it('Simulate error dialog is visible', () => { + cy.get('.ui-dialog').should('be.visible'); + }); + + it('Simulate error dialog is close by cancel button', () => { + cy.get('button[data-tests-id="error-cancel"]').click(); + cy.get('.ui-dialog').should('not.be.visible'); + }); + + it('Simulate error dialog is close by X button', () => { + cy.get('.ui-dialog-titlebar-icon').click(); + cy.get('.ui-dialog').should('not.be.visible'); + }); + }); +}); diff --git a/public/cypress/integration/mocks/generalPage-spec.ts b/public/cypress/integration/mocks/generalPage-spec.ts new file mode 100644 index 0000000..1297de8 --- /dev/null +++ b/public/cypress/integration/mocks/generalPage-spec.ts @@ -0,0 +1,84 @@ +describe('General Page - E2E test flow with mock', () => { + describe('Create new MC', () => { + beforeEach(() => { + cy.httpGetDDLData(); + cy.getMCListEmpty(); + cy.homePage(); + cy.get('button[data-tests-id="btn-create-mc"]').click(); + }); + + it('Create button need to be disabled', () => { + cy + .get('button[data-tests-id="createMonitoring"]') + .should('be.visible') + .and('be.disabled'); + }); + + it('Fill form then click to submit verify setting button and constrain ddl', () => { + cy.fillNewMcForm(); + cy + .get('button[data-tests-id="createMonitoring"]') + .as('createButton') + .not('[disabled]') + .should('not.contain', 'Disabled'); + + cy.httpCreateNewMc(); + cy.emptyRuleEngine('Type1'); + + cy.get('@createButton').click(); + cy + .get('#ui-tabpanel-1-label') + .should('contain', 'map') + .click(); + cy + .get('button[data-tests-id="setting-gear"]') + .should('be.visible') + .first() + .click({ multiple: true }); + + cy + .get('.map-setting-list #mappingType > .field-text') + .should('have.value', 'multiple'); + }); + }); + + describe('Tabs after MC created', () => { + beforeEach(() => { + cy.httpGetDDLData(); + cy.getMCListEmpty(); + cy.homePage(); + cy.get('button[data-tests-id="btn-create-mc"]').click(); + cy.fillNewMcForm(); + cy.httpCreateNewMc(); + cy.emptyRuleEngine('Type1'); + cy.get('button[data-tests-id="createMonitoring"]').click(); + }); + + it('should have 4 icon buttons in map tab', () => { + cy + .get('#ui-tabpanel-1-label') + .should('contain', 'map') + .click(); + cy + .get('.map-bar-icon-container>button') + .should('have.length', 2) + .get('.map-bar-icon-container>div>button') + .should('have.length', 2) + .and('be.visible'); + }); + + it('should have 2 icon buttons in supplement tab', () => { + cy + .get('#ui-tabpanel-2-label') + .should('contain', 'supplement') + .click(); + cy + .get('.supplement-bar-icon-container>button') + .should('have.length', 2) + .and('be.visible') + .get('.supplement-bar-icon-container') + .children() + .should('have.length', 3); + }); + }); +}); diff --git a/public/cypress/integration/mocks/homePage-spec.ts b/public/cypress/integration/mocks/homePage-spec.ts new file mode 100644 index 0000000..2889390 --- /dev/null +++ b/public/cypress/integration/mocks/homePage-spec.ts @@ -0,0 +1,209 @@ +export const buttonCreateMC = () => { + return cy.get('button[data-tests-id="btn-create-mc"]'); +}; +export const buttonCreateMCSpan = () => { + return cy.get('span[data-tests-id="btn-span-create-mc"]'); +}; + +export const tableItems = () => { + return cy.get('tr[data-tests-id="monitoringComponentTableItems"]'); +}; + +export const tableHeaders = () => { + return cy.get('tr[data-tests-id="monitoringComponentTableHeaders"]'); +}; +export const tableItemsDeleteButton = () => { + return cy.get('button[data-tests-id="tableItemsButtonDelete"]'); +}; + +export const tableItemsInfoButton = () => { + return cy.get('button[data-tests-id="tableItemsButtonInfo"]'); +}; + +export const popupGetDeleteBtn = () => { + return cy.get('button[data-tests-id="btnDelete"]'); +}; + +export const popupGetCancelBtn = () => { + return cy.get('button[data-tests-id="btnCancel"]'); +}; + +export const getMonitoringConfiguration = () => { + return cy.get('div[data-tests-id="tableItemsMonitoringConfiguration"]'); +}; + +export const doHoverOverFirstLine = () => { + return tableItems() + .first() + .trigger('mouseover'); +}; + +export const doHoverOverFirstLineMonitoringConfiguration = () => { + tableItems() + .first() + .trigger('mouseover'); + return getMonitoringConfiguration(); +}; + +const NUMBER_OF_ITEMS = 12; + +const navigateButtonDisabled = () => { + return buttonCreateMC() + .should('be.visible') + .and('be.disabled') + .get('button[data-tests-id="btn-fab-create-mc"]') + .should('be.visible') + .and('be.disabled'); +}; + +describe('Home Page - E2E test flow with mock', () => { + describe('MC List empty', () => { + beforeEach(() => { + cy.getMCListEmpty(); + cy.homePage(); + }); + + it("Shouldn't have create table with headers", () => { + tableHeaders().should('not.be.visible'); + }); + it("Shouldn't have create table without items", () => { + buttonCreateMC() + .get('div[data-tests-id="new-monitoring-title"]') + .should('contain', 'Monitoring'); + }); + }); + + describe('Check Edit Save and Submit', () => { + beforeEach(() => { + cy.getMCList(); + cy.homePage(); + cy.getMC(); + cy.submitMonitoringComponent(); + cy.saveMonitoringComponent(); + }); + + it('Edit VFCMT', () => { + this.doHoverOverFirstLineMonitoringConfiguration() + .first() + .click({ force: true }); + }); + }); + + describe('MC List', () => { + beforeEach(() => { + cy.getMCList(); + cy.homePage(); + }); + + it('Should have create button on top of the screen', () => { + buttonCreateMC().should('be.visible'); + }); + + it('Should have create table with headers', () => { + tableHeaders().should('be.visible'); + }); + it('Should have create table with items', () => { + tableItems().should('have.length', NUMBER_OF_ITEMS); + }); + }); + + describe('MC List Edit Tests', () => { + beforeEach(() => { + cy.getMCList(); + cy.homePage(); + }); + }); + + describe('MC List Delete Tests', () => { + beforeEach(() => { + cy.getMCList(); + cy.homePage(); + cy.deleteMonitoringComponent(); + cy.deleteMonitoringComponentWithBlueprint(); + }); + it('Mouse hover over item, delete is visible, info not visible', () => { + doHoverOverFirstLine(); + tableItemsDeleteButton().should('be.visible'); + tableItemsInfoButton().should('not.be.visible'); + }); + it('Mouse hover over item, call delete and remove not submitted (call delete without blueprint api)', () => { + tableItems().should('have.length', NUMBER_OF_ITEMS); + doHoverOverFirstLine(); + tableItemsDeleteButton() + .should('be.visible') + .click({ force: true }); + popupGetDeleteBtn().click({ force: true }); + tableItems().should('have.length', NUMBER_OF_ITEMS - 1); + }); + it('Mouse hover over item, call delete and remove submitted (call delete with blueprint api)', () => { + tableItems() + .should('have.length', NUMBER_OF_ITEMS) + .last() + .trigger('mouseover'); + tableItemsDeleteButton() + .should('be.visible') + .click({ force: true }); + popupGetDeleteBtn().click({ force: true }); + tableItems().should('have.length', NUMBER_OF_ITEMS - 1); + }); + it('Mouse hover over item, call delete and cancelOperation', () => { + tableItems().should('have.length', NUMBER_OF_ITEMS); + doHoverOverFirstLine(); + tableItemsDeleteButton() + .should('be.visible') + .click({ force: true }); + popupGetCancelBtn().click({ force: true }); + tableItems().should('have.length', NUMBER_OF_ITEMS); + }); + }); + + describe('Show Info icon', () => { + beforeEach(() => { + cy.getMCList(); + cy.homePageCertified(); + }); + it('Mouse hover over item, delete is not visible, info visible', () => { + doHoverOverFirstLine(); + tableItemsInfoButton().should('be.visible'); + tableItemsDeleteButton().should('not.be.visible'); + }); + }); + + describe('Successfully Entry Home Page Monitoring Configuration', () => { + beforeEach(() => { + cy.getMCListEmpty(); + cy.homePage(); + }); + + it('Buttons looks Assertion', () => { + buttonCreateMC() + .should('contain', 'Create New MC') + .and('be.visible') + .and('not.be.disabled'); + + buttonCreateMCSpan() + .should('contain', 'Add First MC') + .and('be.visible') + .and('not.be.disabled'); + }); + + it('Buttons Functionality Assertion', () => { + buttonCreateMC() + .click() + .get('div[data-tests-id="new-monitoring-title"]') + .should('contain', 'Monitoring'); + }); + }); + + describe('Not Auth Entry Home Page Monitoring Configuration', () => { + it('Buttons disabled when user not owner', () => { + cy.sdcIsOwnerFalse(); + navigateButtonDisabled(); + }); + + it('Buttons disabled when user not checkout', () => { + cy.sdcUserNotCheckout(); + navigateButtonDisabled(); + }); + }); +}); diff --git a/public/cypress/integration/mocks/importPage-spec.ts b/public/cypress/integration/mocks/importPage-spec.ts new file mode 100644 index 0000000..7af904e --- /dev/null +++ b/public/cypress/integration/mocks/importPage-spec.ts @@ -0,0 +1,232 @@ +const loadVfcmtList = () => { + return cy + .server() + .route({ + method: 'GET', + url: + Cypress.env('backendUrl') + + '/SERVICE/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/getVfcmtsForMigration', + response: 'fixture:importVfcmt' + }) + .as('importVfcmtList') + .visit( + 'http://localhost:4300/#/main/SERVICE/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/import' + ); +}; + +const getVfcmtRefData = data => { + return cy + .server() + .route({ + method: 'GET', + url: + Cypress.env('backendUrl') + + '/getVfcmtReferenceData/cb06b8a9-c7e0-4451-a941-89fc338303c9', + response: data + }) + .as('vfcmtRef'); +}; + +const getFlowType = () => { + return cy + .server() + .route({ + method: 'GET', + url: Cypress.env('backendUrl') + '/conf/composition', + response: { + flowTypes: ['Syslog', 'SNMP', 'FOI'] + } + }) + .as('flowTypes'); +}; + +const getVfniList = () => { + return cy + .server() + .route({ + method: 'GET', + url: + Cypress.env('backendUrl') + + '/service/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a', + response: 'fixture:serviceDdl' + }) + .as('vfniListApi'); +}; + +const importMCServerApi = () => { + return cy + .server() + .route({ + method: 'POST', + url: Cypress.env('backendUrl') + '/importMC', + response: 'fixture:createMcRes' + }) + .as('importMC'); +}; + +const chooseVfcmtFromDDLWithVersion = () => { + return cy + .get('.ng-input > input') + .click() + .type('liav') + .type('{enter}') + .get('select[data-tests-id="vfcmtVersion"]') + .select('0.1'); +}; + +const getName = () => { + return cy.get('input[data-tests-id="nameMc"]'); +}; +const getDescription = () => { + return cy.get('textarea[data-tests-id="descMc"]'); +}; +const getFlowTypeSelect = () => { + return cy.get('select[data-tests-id="flowTypeDdl"]'); +}; +const getVfniSelect = () => { + return cy.get('select[data-tests-id="vfniDdl"]'); +}; +const getImportButton = () => { + return cy.get('button[data-tests-id="importMonitoring"]'); +}; + +describe('Import Page', () => { + context('First step - get vfcmts list and pick one', () => { + beforeEach(() => { + loadVfcmtList(); + }); + + it('should have values in ddl', () => { + cy + .get('ng-select') + .should('be.visible') + .click() + .get('.ng-option') + .should('contain', 7); + }); + + it('should have value on typing and press enter key', () => { + cy + .get('.ng-input > input') + .click() + .type('liav') + .type('{enter}') + .get('.ng-value-label') + .should('contain', 'LiavSprint10.3'); + }); + + it('should have version when pick vfcmt from list', () => { + cy + .get('.ng-input > input') + .click() + .type('liav') + .type('{enter}') + .get('select[data-tests-id="vfcmtVersion"]') + .should('be.visible') + .and('contain', '0.1'); + }); + }); + + context('second step - fill fileds according to server response', () => { + beforeEach(() => { + loadVfcmtList(); + }); + + it('get flow type true and service is match to context service', () => { + getVfcmtRefData({ + serviceUuid: '06c7d927-4e2f-47e1-a29d-b6ed229ebc0a', + name: 'test', + description: 'test', + flowType: 'FOI', + vfiName: 'LiavSrv' + }); + chooseVfcmtFromDDLWithVersion(); + getName() + .should('have.value', 'test') + .and('be.disabled'); + getDescription() + .should('have.value', 'test') + .and('be.disabled'); + getFlowTypeSelect().should('have.value', 'FOI'); + getVfniSelect().should('have.value', 'LiavSrv'); + getImportButton() + .not('[disabled]') + .should('not.contain', 'Disabled'); + }); + + it('get flow type true but service not match', () => { + getVfcmtRefData({ + serviceUuid: '555555-4e2f-47e1-a29d-b6ed229ebc0a', + name: 'test', + description: 'test', + flowType: 'FOI', + vfiName: 'ChcoSrv' + }); + getVfniList(); + chooseVfcmtFromDDLWithVersion(); + getFlowTypeSelect().should('have.value', 'FOI'); + }); + + it('get flow type false service match', () => { + getVfcmtRefData({ + serviceUuid: '06c7d927-4e2f-47e1-a29d-b6ed229ebc0a', + name: 'test', + description: 'test', + vfiName: 'LiavSrv' + }); + getImportButton() + .should('be.visible') + .and('be.disabled'); + getFlowType(); + chooseVfcmtFromDDLWithVersion(); + getName() + .should('have.value', 'test') + .and('be.disabled'); + getDescription() + .should('have.value', 'test') + .and('be.disabled'); + getVfniSelect().should('have.value', 'LiavSrv'); + }); + + it('get flow type false service not match', () => { + getVfcmtRefData({ + serviceUuid: '555555-4e2f-47e1-a29d-b6ed229ebc0a', + name: 'test', + description: 'test', + vfiName: 'ChcoSrv' + }); + getImportButton() + .should('be.visible') + .and('be.disabled'); + getFlowType(); + getVfniList(); + chooseVfcmtFromDDLWithVersion(); + getName().should('have.value', ''); + getDescription().should('have.value', ''); + }); + }); + + context('final step - import vfcmt and getting cdump for tabs', () => { + beforeEach(() => { + loadVfcmtList(); + getVfcmtRefData({ + serviceUuid: '06c7d927-4e2f-47e1-a29d-b6ed229ebc0a', + name: 'test', + description: 'test', + flowType: 'FOI', + vfiName: 'LiavSrv' + }); + chooseVfcmtFromDDLWithVersion(); + }); + + it('should get cdump after import and vfcmt import not visible', () => { + importMCServerApi(); + getImportButton().click({ force: true }); + cy + .get('.import-wrapper') + .should('not.be.visible') + .get('#ui-tabpanel-1-label') + .should('contain', 'map'); + }); + }); +}); diff --git a/public/cypress/integration/mocks/ruleEngine-spec.ts b/public/cypress/integration/mocks/ruleEngine-spec.ts new file mode 100644 index 0000000..9a75b87 --- /dev/null +++ b/public/cypress/integration/mocks/ruleEngine-spec.ts @@ -0,0 +1,168 @@ +export const mappingTragetDDL = () => { + return cy.get('select[data-tests-id="mappingDdl"]'); +}; + +export const selectVersionAndTypeAndAddFirstRule = () => { + return cy + .get('select[data-tests-id="selectVersion"]') + .select('4.1') + .get('select[data-tests-id="selectEventType"]') + .select('syslog') + .get('button[data-tests-id="btnAddFirstRule"]') + .click(); +}; + +export const fillRuleDecription = text => { + return cy + .get('input[data-tests-id="inputDescription"]') + .clear() + .type(text); +}; + +export const addCopyAction = () => { + return cy + .get('select[data-tests-id="selectAction"]') + .select('copy') + .get('button[data-tests-id="btnAddAction"]') + .click() + .get('input[data-tests-id="valueInput"]') + .type('A') + .get('span[data-tests-id="openTargetTree"]') + .click() + .get('.bottom-select') + .should('be.visible') + .find('.toggle-children') + .first() + .click() + .get('span[data-tests-id="targetNode"]') + .should(node => { + expect(node.eq(0)).to.contain('commonEventHeader'); + expect(node.eq(1)).to.contain('domain'); + }) + .each(($el, index) => { + if (index === 1) { + cy.wrap($el).click(); + } + }); +}; + +export const editFirstRule = () => { + return cy + .get('div[data-tests-id="ruleElement"]') + .first() + .trigger('mouseover') + .get('button[data-tests-id="editRule"]') + .should('be.visible') + .click(); +}; + +export const translateValue = () => { + return '{"processing":[{"phase":"snmp_map","processors":[{"array":"varbinds","datacolumn":"varbind_value","keycolumn":"varbind_oid","class":"SnmpConvertor"},{"phase":"sto2","class":"RunPhase"}]},{"phase":"sto2","processors":[{"updates":{"event.commonEventHeader.domain":"a"},"class":"Set"}]},{"phase":"sto2","processors":[{"phase":"map_publish","class":"RunPhase"}]}]}'; +}; + +describe('Rule engine - E2E test flow with mock', () => { + describe('Mapping target select', () => { + beforeEach(() => { + cy.httpGetDDLData(); + cy.getMCListEmpty(); + cy.homePage(); + cy.get('button[data-tests-id="btn-create-mc"]').click(); + cy.fillNewMcForm(); + cy.httpCreateNewMc(); + cy.emptyRuleEngine('Type1'); + cy.get('button[data-tests-id="createMonitoring"]').click(); + cy + .get('#ui-tabpanel-1-label') + .should('contain', 'map') + .click(); + }); + + it('should exist and contain options', () => { + mappingTragetDDL() + .should('be.visible') + .contains('json'); + }); + + it('should page refrash after change select value in mapping target ddl', () => { + cy.httpTargetTree(); + cy + .get('select[data-tests-id="selectVersion"]') + .select('4.1') + .get('select[data-tests-id="selectEventType"]') + .select('syslog') + .get('button[data-tests-id="btnAddFirstRule"]') + .should('be.visible'); + cy.emptyRuleEngine('json'); + mappingTragetDDL() + .select('json') + .get('select[data-tests-id="selectVersion"]') + .should('have.value', null); + }); + }); + + describe('Translate And Save Rule List', () => { + beforeEach(() => { + cy.httpGetDDLData(); + cy.getMCListEmpty(); + cy.homePage(); + cy.get('button[data-tests-id="btn-create-mc"]').click(); + cy.fillNewMcForm(); + cy.httpCreateNewMc(); + cy.emptyRuleEngine('Type1'); + cy + .get('button[data-tests-id="createMonitoring"]') + .click() + .get('#ui-tabpanel-1-label') + .should('contain', 'map') + .click(); + cy.httpTargetTree(); + selectVersionAndTypeAndAddFirstRule(); + fillRuleDecription('newRule'); + addCopyAction(); + cy.doneSaveRule(); + }); + + context('Play with save, back and done button', () => { + it('should rule exist in list after save rule and click back', () => { + cy + .get('button[data-tests-id="btnSave"]') + .click() + .get('a[data-tests-id="btnBackRule"]') + .click() + .get('div[data-tests-id="ruleElement"]') + .should('be.visible') + .then(function($lis) { + expect($lis).to.have.length(1); + expect($lis.eq(0)).to.contain('newRule'); + }); + }); + + it('should rule exist in list after done edit rule', () => { + cy + .get('button[data-tests-id="btnDone"]') + .click() + .get('div[data-tests-id="ruleElement"]') + .should('be.visible') + .then(function($lis) { + expect($lis).to.have.length(1); + expect($lis.eq(0)).to.contain('newRule'); + }); + }); + }); + + context('Translate', () => { + it('should open advanced setting when translate successfuly', () => { + cy.get('button[data-tests-id="btnDone"]').click(); + cy.httpTransalte(); + cy + .get('button[data-tests-id="btnTranslate"]') + .click() + .get('.toast-container') + .should('be.visible') + .get('.map-setting-list > #Type1 > input') + .should('be.visible') + .and('have.value', translateValue()); + }); + }); + }); +}); -- cgit 1.2.3-korg