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(() => { |
Ittay Stern | 32dbf80 | 2019-10-29 12:58:49 +0200 | [diff] [blame] | 11 | cy.clearSessionStorage(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 12 | cy.preventErrorsOnLoading(); |
| 13 | cy.initAAIMock(); |
| 14 | cy.initVidMock(); |
| 15 | cy.initZones(); |
| 16 | cy.login(); |
| 17 | cy.visit("welcome.htm") |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 18 | }); |
| 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 Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 30 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 31 | jsonBuilderAndMock.basicJson(res, |
| 32 | Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED', |
| 33 | 200, |
| 34 | 0, |
| 35 | 'list_services'); |
| 36 | }); |
| 37 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 38 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/service-with-configuration.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 39 | 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 Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 46 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 47 | 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 Stern | 7befef8 | 2019-07-11 15:54:36 +0300 | [diff] [blame] | 54 | cy.get('span').contains('Browse SDC Service Models').click({force: true}); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 55 | 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 Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 68 | const TEST_MOCKS_PATH="cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/"; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 69 | |
| 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 Stern | 7befef8 | 2019-07-11 15:54:36 +0300 | [diff] [blame] | 88 | cy.get('span').contains('Browse SDC Service Models').click({force: true}); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 89 | 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 | }); |