///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
/// <reference types="Cypress" />
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';

describe('Browse SDC', function () {
    var jsonBuilderAndMock : JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();


    beforeEach(() => {
        cy.clearSessionStorage();
        cy.preventErrorsOnLoading();
        cy.initAAIMock();
        cy.initVidMock();
        cy.initZones();
        cy.login();
        cy.visit("welcome.htm")
    });

    afterEach(() => {
      cy.screenshot();
    });

    it(`browse sdc open macro with network and then macro for new flow`, function () {
       // const MACRO_WITH_CONFIGURATION_ID: string = 'ee6d61be-4841-4f98-8f23-5de9da846ca7';
      const MACRO_WITH_NETWORK_ID: string = "bd8ffd14-da36-4f62-813c-6716ba9f4354";
      const MACRO_FOR_NEW_FLOW_ID: string = '74fa72dd-012b-49c3-800d-06b12bcaf1a0';
      const CANCEL_BUTTON = "cancelButton";

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => {
        jsonBuilderAndMock.basicJson(res,
          Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED',
          200,
          0,
          'list_services');
      });

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/service-with-configuration.json').then((res) => {
        jsonBuilderAndMock.basicJson(res,
          Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_WITH_NETWORK_ID,
          200,
          0,
          'MACRO_WITH_CONFIGURATION');
      });

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => {
        jsonBuilderAndMock.basicJson(res,
          Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_FOR_NEW_FLOW_ID,
          200,
          0,
          'MACRO_FOR_NEW_FLOW');
      });

      cy.get('span').contains('Browse SDC Service Models').click({force: true});
      cy.wait("@list_services").then(() => {
        cy.getElementByDataTestsId('deploy-' + MACRO_WITH_NETWORK_ID).click({force: true})
          .getElementByDataTestsId(CANCEL_BUTTON).click({force: true});
        cy.getElementByDataTestsId('deploy-' + MACRO_FOR_NEW_FLOW_ID).click({force: true});
        cy.get("iframe");
      });

      cy.visit("welcome.htm"); //relaod page to not break the following tests

    });

  it(`browse sdc of service without instantiationType open aLaCarte popup`, function () {
    const VERY_OLD_SERVICE_UUID: string = "09c476c7-91ae-44b8-a731-04d8d8fa3695";
    const TEST_MOCKS_PATH="cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/";

    const CANCEL_BUTTON = "cancelButton";

    cy.readFile(TEST_MOCKS_PATH+'list-services.json').then((res) => {
      jsonBuilderAndMock.basicJson(res,
        Cypress.config('baseUrl') + '/rest/models/services?distributionStatus=DISTRIBUTED',
        200,
        0,
        'list_services');
    });

    cy.readFile(TEST_MOCKS_PATH+'serviceWithoutInstantiationType.json').then((res) => {
      jsonBuilderAndMock.basicJson(res,
        Cypress.config('baseUrl') + '/rest/models/services/' + VERY_OLD_SERVICE_UUID,
        200,
        0,
        'MACRO_WITH_CONFIGURATION');
    });

    cy.get('span').contains('Browse SDC Service Models').click({force: true});
    cy.wait("@list_services").then(() => {
      cy.getElementByDataTestsId('deploy-' + VERY_OLD_SERVICE_UUID).click({force: true})
        .getElementByDataTestsId('create-modal-title').contains("Create Service Instance -- a la carte");
    });

    cy.visit("welcome.htm"); //relaod page to not break the following tests

  });



});
