Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| 2 | /// <reference types="Cypress" /> |
| 3 | import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; |
| 4 | import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; |
| 5 | |
| 6 | describe('search existing instance', function () { |
| 7 | var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| 8 | |
| 9 | beforeEach(() => { |
Ittay Stern | 32dbf80 | 2019-10-29 12:58:49 +0200 | [diff] [blame] | 10 | cy.clearSessionStorage(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 11 | cy.preventErrorsOnLoading(); |
| 12 | cy.initAAIMock(); |
| 13 | cy.initVidMock(); |
| 14 | cy.initZones(); |
| 15 | cy.permissionVidMock(); |
| 16 | cy.login(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 17 | }); |
| 18 | |
| 19 | afterEach(() => { |
| 20 | cy.screenshot(); |
| 21 | }); |
| 22 | |
| 23 | it('when find instance with resource group in the model then open new service planning in edit mode', function () { |
| 24 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 25 | const SUBSCRIBER_NAME:string ="SILVIA ROBBINS"; |
| 26 | const SERVICE_TYPE: string = "VIRTUALUSP"; |
| 27 | const SERVICE_INSTANCE_ID: string = "3d930d51-eed8-41b8-956f-70aa0d19940b"; |
| 28 | const SERVICE_MODEL_VERSION_ID: string = '5aece664-e92d-4a99-8a76-c7d7b8d23d09'; |
| 29 | const SERVICE_MODEL_INVARIANT_ID: string = 'd089c740-53ac-41f6-8e5b-32e862302ef1'; |
| 30 | |
| 31 | var searchServiceInstancesResponse = { |
| 32 | "service-instances": [{ |
| 33 | "serviceInstanceId":SERVICE_INSTANCE_ID, |
| 34 | "globalCustomerId": SUBSCRIBER_ID, |
| 35 | "serviceType": SERVICE_TYPE, |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 36 | "serviceInstanceName": "abc_CHARLOTTE_2017_1011_IST_Service_CSI", |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 37 | "subscriberName": SUBSCRIBER_NAME, |
| 38 | "aaiModelInvariantId": SERVICE_MODEL_INVARIANT_ID, |
| 39 | "aaiModelVersionId": SERVICE_MODEL_VERSION_ID, |
| 40 | "isPermitted": true |
| 41 | } |
| 42 | ] |
| 43 | }; |
| 44 | |
| 45 | cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { |
| 46 | jsonBuilderAndMock.basicJson( |
| 47 | res, |
| 48 | Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", |
| 49 | 200, 0, |
| 50 | "initServiceInstanceTopology", |
| 51 | ) |
| 52 | }); |
| 53 | |
| 54 | cy.server() |
| 55 | .route({ |
| 56 | method: 'GET', |
| 57 | status: 200, |
| 58 | delay : 0, |
| 59 | url: Cypress.config('baseUrl') + `/search_service_instances?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`, |
| 60 | response: searchServiceInstancesResponse |
| 61 | }).as('search_service_instances'); |
| 62 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 63 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/serviceForNewViewEdit.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 64 | jsonBuilderAndMock.basicJson( |
| 65 | res, |
| 66 | Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_VERSION_ID}`, |
| 67 | 200, |
| 68 | 0, |
| 69 | "serviceForNewViewEdit", |
| 70 | (res: ServiceModel)=>{ |
| 71 | res.service.uuid = SERVICE_MODEL_VERSION_ID; |
| 72 | res.service.invariantUuid =SERVICE_MODEL_INVARIANT_ID; |
| 73 | return res; |
| 74 | } |
| 75 | ) |
| 76 | }); |
| 77 | |
| 78 | cy.visit(`/serviceModels.htm#/instances/subdetails?subscriberId=${SUBSCRIBER_ID}&serviceInstanceIdentifier=${SERVICE_INSTANCE_ID}`); |
| 79 | cy.getElementByDataTestsId(`view/edit-test-data-id-${SERVICE_INSTANCE_ID}`).click(); |
| 80 | cy.url().should('contains',`servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_VERSION_ID}&subscriberId=${SUBSCRIBER_ID}`+ |
| 81 | `&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 82 | }); |
| 83 | |
| 84 | }); |
| 85 | |