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;
10 initAuditInfoMSOALaCarteNew: typeof initAuditInfoMSOALaCarteNew;
14 function preventErrorsOnLoading() : void {
15 cy.on('uncaught:exception', (err, runnable) => {
20 function initGetToMenuInfo(response? : JSON) : void {
21 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/topMenuInfo.json').then((res) => {
26 url : Cypress.config('baseUrl') + "/get_topMenuInfo",
27 response : response ? response : res
34 function initCategoryParameter(response? : JSON) : void {
35 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/categoryParametres.json').then((res) => {
40 url : Cypress.config('baseUrl') + "/category_parameter**",
41 response : response ? response : res
42 }).as('initCategoryParameters');
46 function initFlags(response? : JSON, delay?: number, status?: number) : void {
47 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((res) => {
51 delay : delay ? delay : 0,
52 status : status ? status : 200,
53 url : Cypress.config('baseUrl') + "/flags**",
54 response : response ? response : res
59 function initAuditInfoVID(response? : JSON, delay?: number, status?: number) : void {
60 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/auditInfoVid.json').then((res) => {
64 delay : delay ? delay : 0,
65 status : status ? status : 200,
66 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**?source=VID",
67 response : response ? response : res
68 }).as('initAuditInfoVID');
72 function initAuditInfoMSO(response? : JSON, delay?: number, status?: number) : void {
73 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/auditInfoMSO.json').then((res) => {
77 delay : delay ? delay : 0,
78 status : status ? status : 200,
79 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**?source=MSO",
80 response : response ? response : res
81 }).as('initAuditInfoMSO');
85 function initAuditInfoMSOALaCarte(response? : JSON, delay?: number, status?: number) : void {
86 cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
90 delay : delay ? delay : 0,
91 status : status ? status : 200,
92 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**/mso**",
93 response : response ? response : res
94 }).as('initAuditInfoMSOAlaCarte');
98 function initAuditInfoMSOALaCarteNew(response? : JSON, delay?: number, status?: number) : void {
99 cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json').then((res) => {
103 delay : delay ? delay : 0,
104 status : status ? status : 200,
105 url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**/mso**",
106 response : response ? response : res
107 }).as('initAuditInfoMSOALaCarteNew');
111 function initAsyncInstantiation(response? : JSON, delay?: number, status?: number) : void {
112 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicAsyncInstantiation.json').then((res) => {
116 delay : delay ? delay : 0,
117 status : status ? status : 200,
118 url : Cypress.config('baseUrl') + "/asyncInstantiation",
119 response : response ? response : res
120 }).as('initAsyncInstantiation');
124 function mockLatestVersionForService(serviceUuid: string, invariantId: string) {
126 url: Cypress.config('baseUrl') + '/aai_get_newest_model_version_by_invariant/' + invariantId,
130 "modelVersionId": serviceUuid,
131 "modelName": "SERVICE_INSTANCE_NAME",
132 "modelVersion": "2.0",
133 "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
134 "resourceVersion": "resourceVersion",
135 "modelDescription": "modelDescription"
137 }).as("expectLatestServiceModelUpgradeVersion")
140 function initVidMock(): void {
142 initCategoryParameter();
149 Cypress.Commands.add('initVidMock', initVidMock);
150 Cypress.Commands.add('preventErrorsOnLoading', preventErrorsOnLoading);
151 Cypress.Commands.add('initCategoryParameter', initCategoryParameter);
152 Cypress.Commands.add('initAuditInfoMSO', initAuditInfoMSO);
153 Cypress.Commands.add('initAuditInfoMSOALaCarte', initAuditInfoMSOALaCarte);
154 Cypress.Commands.add('initAuditInfoMSOALaCarteNew', initAuditInfoMSOALaCarteNew);
155 Cypress.Commands.add('initAsyncInstantiation', initAsyncInstantiation);
156 Cypress.Commands.add('mockLatestVersionForService', mockLatestVersionForService);