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