blob: b3ef7f03275fbe3face2e93512750f776cd89d43 [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('Browse SDC', function () {
7 var jsonBuilderAndMock : JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
8
9
10 beforeEach(() => {
Ittay Stern32dbf802019-10-29 12:58:49 +020011 cy.clearSessionStorage();
Ittay Stern6f900cc2018-08-29 17:01:32 +030012 cy.preventErrorsOnLoading();
13 cy.initAAIMock();
14 cy.initVidMock();
15 cy.initZones();
16 cy.login();
17 cy.visit("welcome.htm")
Ittay Stern6f900cc2018-08-29 17:01:32 +030018 });
19
20 afterEach(() => {
21 cy.screenshot();
22 });
23
24 it(`browse sdc open macro with network and then macro for new flow`, function () {
25 // const MACRO_WITH_CONFIGURATION_ID: string = 'ee6d61be-4841-4f98-8f23-5de9da846ca7';
26 const MACRO_WITH_NETWORK_ID: string = "bd8ffd14-da36-4f62-813c-6716ba9f4354";
27 const MACRO_FOR_NEW_FLOW_ID: string = '74fa72dd-012b-49c3-800d-06b12bcaf1a0';
28 const CANCEL_BUTTON = "cancelButton";
29
Ittay Stern607ea3d2019-10-23 17:10:52 +030030 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030031 jsonBuilderAndMock.basicJson(res,
32 Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED',
33 200,
34 0,
35 'list_services');
36 });
37
Ittay Stern607ea3d2019-10-23 17:10:52 +030038 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/service-with-configuration.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030039 jsonBuilderAndMock.basicJson(res,
40 Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_WITH_NETWORK_ID,
41 200,
42 0,
43 'MACRO_WITH_CONFIGURATION');
44 });
45
Ittay Stern607ea3d2019-10-23 17:10:52 +030046 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030047 jsonBuilderAndMock.basicJson(res,
48 Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_FOR_NEW_FLOW_ID,
49 200,
50 0,
51 'MACRO_FOR_NEW_FLOW');
52 });
53
Ittay Stern7befef82019-07-11 15:54:36 +030054 cy.get('span').contains('Browse SDC Service Models').click({force: true});
Ittay Stern6f900cc2018-08-29 17:01:32 +030055 cy.wait("@list_services").then(() => {
56 cy.getElementByDataTestsId('deploy-' + MACRO_WITH_NETWORK_ID).click({force: true})
57 .getElementByDataTestsId(CANCEL_BUTTON).click({force: true});
58 cy.getElementByDataTestsId('deploy-' + MACRO_FOR_NEW_FLOW_ID).click({force: true});
59 cy.get("iframe");
60 });
61
62 cy.visit("welcome.htm"); //relaod page to not break the following tests
63
64 });
65
66 it(`browse sdc of service without instantiationType open aLaCarte popup`, function () {
67 const VERY_OLD_SERVICE_UUID: string = "09c476c7-91ae-44b8-a731-04d8d8fa3695";
Ittay Stern607ea3d2019-10-23 17:10:52 +030068 const TEST_MOCKS_PATH="cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/";
Ittay Stern6f900cc2018-08-29 17:01:32 +030069
70 const CANCEL_BUTTON = "cancelButton";
71
72 cy.readFile(TEST_MOCKS_PATH+'list-services.json').then((res) => {
73 jsonBuilderAndMock.basicJson(res,
74 Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED',
75 200,
76 0,
77 'list_services');
78 });
79
80 cy.readFile(TEST_MOCKS_PATH+'serviceWithoutInstantiationType.json').then((res) => {
81 jsonBuilderAndMock.basicJson(res,
82 Cypress.config('baseUrl') + '/rest/models/services/' + VERY_OLD_SERVICE_UUID,
83 200,
84 0,
85 'MACRO_WITH_CONFIGURATION');
86 });
87
Ittay Stern7befef82019-07-11 15:54:36 +030088 cy.get('span').contains('Browse SDC Service Models').click({force: true});
Ittay Stern6f900cc2018-08-29 17:01:32 +030089 cy.wait("@list_services").then(() => {
90 cy.getElementByDataTestsId('deploy-' + VERY_OLD_SERVICE_UUID).click({force: true})
91 .getElementByDataTestsId('create-modal-title').contains("Create Service Instance -- a la carte");
92 });
93
94 cy.visit("welcome.htm"); //relaod page to not break the following tests
95
96 });
97
98
99
100});