| ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| /// <reference types="Cypress" /> |
| import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; |
| import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; |
| |
| describe('search existing instance', function () { |
| var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| |
| beforeEach(() => { |
| cy.clearSessionStorage(); |
| cy.preventErrorsOnLoading(); |
| cy.initAAIMock(); |
| cy.initVidMock(); |
| cy.initZones(); |
| cy.permissionVidMock(); |
| cy.login(); |
| }); |
| |
| afterEach(() => { |
| cy.screenshot(); |
| }); |
| |
| it('when find instance with resource group in the model then open new service planning in edit mode', function () { |
| const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| const SUBSCRIBER_NAME:string ="SILVIA ROBBINS"; |
| const SERVICE_TYPE: string = "VIRTUALUSP"; |
| const SERVICE_INSTANCE_ID: string = "3d930d51-eed8-41b8-956f-70aa0d19940b"; |
| const SERVICE_MODEL_VERSION_ID: string = '5aece664-e92d-4a99-8a76-c7d7b8d23d09'; |
| const SERVICE_MODEL_INVARIANT_ID: string = 'd089c740-53ac-41f6-8e5b-32e862302ef1'; |
| |
| var searchServiceInstancesResponse = { |
| "service-instances": [{ |
| "serviceInstanceId":SERVICE_INSTANCE_ID, |
| "globalCustomerId": SUBSCRIBER_ID, |
| "serviceType": SERVICE_TYPE, |
| "serviceInstanceName": "abc_CHARLOTTE_2017_1011_IST_Service_CSI", |
| "subscriberName": SUBSCRIBER_NAME, |
| "aaiModelInvariantId": SERVICE_MODEL_INVARIANT_ID, |
| "aaiModelVersionId": SERVICE_MODEL_VERSION_ID, |
| "isPermitted": true |
| } |
| ] |
| }; |
| |
| cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { |
| jsonBuilderAndMock.basicJson( |
| res, |
| Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", |
| 200, 0, |
| "initServiceInstanceTopology", |
| ) |
| }); |
| |
| cy.server() |
| .route({ |
| method: 'GET', |
| status: 200, |
| delay : 0, |
| url: Cypress.config('baseUrl') + `/search_service_instances?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`, |
| response: searchServiceInstancesResponse |
| }).as('search_service_instances'); |
| |
| cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/serviceForNewViewEdit.json').then((res) => { |
| jsonBuilderAndMock.basicJson( |
| res, |
| Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_VERSION_ID}`, |
| 200, |
| 0, |
| "serviceForNewViewEdit", |
| (res: ServiceModel)=>{ |
| res.service.uuid = SERVICE_MODEL_VERSION_ID; |
| res.service.invariantUuid =SERVICE_MODEL_INVARIANT_ID; |
| return res; |
| } |
| ) |
| }); |
| |
| cy.visit(`/serviceModels.htm#/instances/subdetails?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`); |
| cy.getElementByDataTestsId(`view/edit-test-data-id-${SERVICE_INSTANCE_ID}`).click(); |
| cy.url().should('contains',`servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_VERSION_ID}&subscriberId=${SUBSCRIBER_ID}`+ |
| `&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| }); |
| |
| }); |
| |