1 declare namespace Cypress {
3 initVidMock: typeof initVidMock;
4 preventErrorsOnLoading : typeof preventErrorsOnLoading;
5 initCategoryParameter : typeof initCategoryParameter;
6 initAuditInfoMSO: typeof initAuditInfoMSO;
7 initAuditInfoMSOALaCarte: typeof initAuditInfoMSOALaCarte;
8 initAsyncInstantiation : typeof initAsyncInstantiation;
9 mockLatestVersionForService : typeof mockLatestVersionForService;
13 function preventErrorsOnLoading() : void {
14 cy.on('uncaught:exception', (err, runnable) => {
19 function initGetToMenuInfo(response? : JSON) : void {
20 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/topMenuInfo.json').then((res) => {
25 url : Cypress.config('baseUrl') + "/get_topMenuInfo",
26 response : response ? response : res
33 function initCategoryParameter(response? : JSON) : void {
34 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/categoryParametres.json').then((res) => {
39 url : Cypress.config('baseUrl') + "/category_parameter**",
40 response : response ? response : res
41 }).as('initCategoryParameters');
45 function initFlags(response? : JSON, delay?: number, status?: number) : void {
46 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => {
50 delay : delay ? delay : 0,
51 status : status ? status : 200,
52 url : Cypress.config('baseUrl') + "/flags**",
53 response : response ? response : res
58 function initAuditInfoVID(response? : JSON, delay?: number, status?: number) : void {
59 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/auditInfoVid.json').then((res) => {
63 delay : delay ? delay : 0,
64 status : status ? status : 200,
65 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**?source=VID",
66 response : response ? response : res
67 }).as('initAuditInfoVID');
71 function initAuditInfoMSO(response? : JSON, delay?: number, status?: number) : void {
72 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/auditInfoMSO.json').then((res) => {
76 delay : delay ? delay : 0,
77 status : status ? status : 200,
78 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**?source=MSO",
79 response : response ? response : res
80 }).as('initAuditInfoMSO');
84 function initAuditInfoMSOALaCarte(response? : JSON, delay?: number, status?: number) : void {
85 cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
89 delay : delay ? delay : 0,
90 status : status ? status : 200,
91 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**/mso**",
92 response : response ? response : res
93 }).as('initAuditInfoMSOAlaCarte');
97 function initAsyncInstantiation(response? : JSON, delay?: number, status?: number) : void {
98 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicAsyncInstantiation.json').then((res) => {
102 delay : delay ? delay : 0,
103 status : status ? status : 200,
104 url : Cypress.config('baseUrl') + "/asyncInstantiation",
105 response : response ? response : res
106 }).as('initAsyncInstantiation');
110 function mockLatestVersionForService(uuidObject :any) {
111 if(uuidObject && uuidObject.serviceUuid && uuidObject.invariantId){
113 url: Cypress.config('baseUrl') + '/aai_get_newest_model_version_by_invariant/' + uuidObject.invariantId,
117 "modelVersionId": uuidObject.serviceUuid,
118 "modelName": "SERVICE_INSTANCE_NAME",
119 "modelVersion": "2.0",
120 "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
121 "resourceVersion": "resourceVersion",
122 "modelDescription": "modelDescription"
124 }).as("expectLatestServiceModelUpgradeVersion")
128 function initVidMock(...args :any): void {
130 initCategoryParameter();
134 mockLatestVersionForService(args[0]);
138 Cypress.Commands.add('initVidMock', initVidMock);
139 Cypress.Commands.add('preventErrorsOnLoading', preventErrorsOnLoading);
140 Cypress.Commands.add('initCategoryParameter', initCategoryParameter);
141 Cypress.Commands.add('initAuditInfoMSO', initAuditInfoMSO);
142 Cypress.Commands.add('initAuditInfoMSOALaCarte', initAuditInfoMSOALaCarte);
143 Cypress.Commands.add('initAsyncInstantiation', initAsyncInstantiation);
144 Cypress.Commands.add('mockLatestVersionForService', mockLatestVersionForService);