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