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) --- .../cypress/integration/mocks/importPage-spec.ts | 232 +++++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 public/cypress/integration/mocks/importPage-spec.ts (limited to 'public/cypress/integration/mocks/importPage-spec.ts') 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'); + }); + }); +}); -- cgit 1.2.3-korg