1 declare namespace Cypress {
3 setReduxState : typeof setReduxState;
4 getReduxState : typeof getReduxState;
5 clearSessionStorage: typeof clearSessionStorage;
6 setTestApiParamToGR: typeof setTestApiParamToGR;
7 setTestApiParamToVNF: typeof setTestApiParamToVNF;
11 /**********************************
12 Type to input with id some text
13 *********************************/
14 function setReduxState(state?: string) : void {
15 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicRedux.json').then((res) => {
16 cy.window().then((win) => {
17 win.sessionStorage.setItem('reduxState', JSON.stringify(state ? state : res));
21 function getReduxState(): Chainable<any> {
22 return cy.window().then((win) => {
23 let stateRaw = win.sessionStorage.getItem('reduxState');
24 return JSON.parse(stateRaw ? stateRaw : '{}');
28 function clearSessionStorage() : void {
29 cy.window().then((win) => {
30 win.sessionStorage.clear();
34 function setTestApiParamToGR() : void {
35 cy.window().then((win) => {
36 win.sessionStorage.setItem('msoRequestParametersTestApiValue', 'GR_API');
40 function setTestApiParamToVNF() : void {
41 cy.window().then((win) => {
42 win.sessionStorage.setItem('msoRequestParametersTestApiValue', 'VNF_API');
46 Cypress.Commands.add('setReduxState', setReduxState);
47 Cypress.Commands.add('getReduxState', getReduxState);
48 Cypress.Commands.add('clearSessionStorage', clearSessionStorage);
49 Cypress.Commands.add('setTestApiParamToGR', setTestApiParamToGR);
50 Cypress.Commands.add('setTestApiParamToVNF',setTestApiParamToVNF);