blob: acb58c261ed2f1437a8a8f88a628a2c985348be8 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001declare namespace Cypress {
2 interface Chainable {
3 initAAIMock: typeof initAAIMock;
4 initAlaCarteService : typeof initAlaCarteService;
5 initZones : typeof initZones;
Ittay Stern6f900cc2018-08-29 17:01:32 +03006 initTenants : typeof initTenants;
7 initSearchVNFMemebers : typeof initSearchVNFMemebers;
Ittay Sternf7926712019-07-07 19:23:03 +03008 initActiveNetworks : typeof initActiveNetworks;
9 initActiveVPNs : typeof initActiveVPNs;
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030010 }
11}
12
13function initGetSubscribers(response? : JSON) : void {
14 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => {
15 cy.server()
16 .route({
17 method: 'GET',
18 status : 200,
19 url : Cypress.config('baseUrl') + "/aai_get_subscribers**",
20 response : response ? response : res
21 }).as('initGetSubscribers')
22 });
23}
24
Ittay Stern6f900cc2018-08-29 17:01:32 +030025function initAaiGetFullSubscribers(response? : JSON) : void {
26 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/subscribers.json').then((res) => {
27 cy.server()
28 .route({
29 method: 'GET',
30 status : 200,
31 url : Cypress.config('baseUrl') + "/aai_get_full_subscribers**",
32 response : response ? response : res
33 }).as('initGetSubscribers')
34 });
35}
36
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030037function initGetAAISubDetails(response? : JSON) : void {
38 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => {
39 cy.server()
40 .route({
41 method: 'GET',
42 status: 200,
43 url: Cypress.config('baseUrl') + "/aai_sub_details**",
44 response: response ? response : res
45 })
46 });
47}
48
49function initAlaCarteService(response? : JSON) : void {
50 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/a-la-carteService.json').then((res) => {
51 cy.server()
52 .route({
53 method: 'GET',
54 status: 200,
55 url: Cypress.config('baseUrl') + "/rest/models/services**",
56 response: response ? response : res
57 }).as('initAlaCarteService')
58 });
59}
60
Ittay Stern6f900cc2018-08-29 17:01:32 +030061
62
63
64
65function initTenants(response? : JSON) : void {
66 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/tenants.json').then((res) => {
67 cy.server()
68 .route({
69 method: 'GET',
70 status: 200,
71 url: Cypress.config('baseUrl') + "/aai_get_tenants/**",
72 response: response ? response : res
73 }).as('initTenants')
74 });
75}
76
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030077function initAAIServices(response? : JSON) : void {
78 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServices.json').then((res) => {
79 cy.server()
80 .route({
81 method: 'GET',
82 status : 200,
83 url : Cypress.config('baseUrl') + "/aai_get_services**",
84 response : response ? response : res
85 }).as(('initAAIServices'));
86 });
87}
88
89function initZones(response? : JSON) : void {
90 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/zones.json').then((res) => {
91 cy.server()
92 .route({
93 method: 'GET',
94 status : 200,
95 url : Cypress.config('baseUrl') + "/aai_get_aic_zones**",
96 response : response ? response : res
97 }).as(('zones'));
98 });
99}
100
Ittay Stern6f900cc2018-08-29 17:01:32 +0300101//Mock of vnf's that members for VNF Group
102function initSearchVNFMemebers(response? : JSON) : void {
103 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
104 cy.server()
105 .route({
106 method: 'GET',
107 status : 200,
108 url : Cypress.config('baseUrl') + "/aai_search_group_members/**",
109 response : response ? response : res
110 }).as(('searchVNFMembers'));
111 });
112}
113
Ittay Sternf7926712019-07-07 19:23:03 +0300114function initActiveNetworks(response? : JSON) : void {
115 cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiGetActiveNetworks.json').then((res) => {
116 cy.server()
117 .route({
118 method: 'GET',
119 status : 200,
120 url : Cypress.config('baseUrl') + "/aai_get_active_networks/**",
121 response : response ? response : res
122 }).as(('getActiveNetworks'));
123 });
124}
Ittay Stern6f900cc2018-08-29 17:01:32 +0300125
Ittay Sternf7926712019-07-07 19:23:03 +0300126function initActiveVPNs(response? : JSON) : void {
127 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiActiveVPNs.json').then((res) => {
128 cy.server()
129 .route({
130 method: 'GET',
131 status : 200,
132 url : Cypress.config('baseUrl') + "/aai_get_vpn_list/**",
133 response : response ? response : res
134 }).as(('getVPNs'));
135 });
136}
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300137
138function initAAIMock(): void {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300139 initAaiGetFullSubscribers();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300140 initGetSubscribers();
141 initAAIServices();
Ittay Stern6f900cc2018-08-29 17:01:32 +0300142 initTenants();
Ittay Sternf7926712019-07-07 19:23:03 +0300143
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300144}
145
146
147Cypress.Commands.add('initAAIMock', initAAIMock);
148Cypress.Commands.add('initAlaCarteService', initAlaCarteService);
149Cypress.Commands.add('initZones', initZones);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300150Cypress.Commands.add('initTenants', initTenants);
151Cypress.Commands.add('initAaiGetFullSubscribers', initAaiGetFullSubscribers);
152Cypress.Commands.add('initSearchVNFMemebers', initSearchVNFMemebers);
Ittay Sternf7926712019-07-07 19:23:03 +0300153Cypress.Commands.add('initActiveNetworks', initActiveNetworks);
154Cypress.Commands.add('initActiveVPNs', initActiveVPNs);
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300155
156