From 32dbf8017aeab06041992064feaf70953ef86e19 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Tue, 29 Oct 2019 12:58:49 +0200 Subject: Introduce cy.clearSessionStorage Issue-ID: VID-647 Change-Id: I51471f736577599c1ace8e330a4db089deccc8ca Signed-off-by: Ittay Stern --- vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts | 4 +--- .../cypress/integration/iFrames/auditInfo.modal.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts | 4 +--- .../cypress/integration/iFrames/collectionResource.e2e.ts | 4 +--- .../cypress/integration/iFrames/drawingBoard.e2e.ts | 4 +--- .../cypress/integration/iFrames/instantiationStatus.e2e.ts | 5 +---- .../cypress/integration/iFrames/network.popup.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts | 6 +----- vid-webpack-master/cypress/integration/iFrames/pnf.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts | 4 +--- .../cypress/integration/iFrames/searchExistingInstance.e2e.ts | 4 +--- .../cypress/integration/iFrames/service.popup.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts | 4 +--- .../cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts | 6 ++---- .../cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts | 4 +--- vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts | 4 +--- .../cypress/integration/shared/error.message.popup.e2e.ts | 8 +++----- vid-webpack-master/cypress/integration/shared/spinner.e2e.ts | 8 +++----- .../cypress/support/application/application.session.actions.ts | 8 ++++++++ 22 files changed, 34 insertions(+), 71 deletions(-) (limited to 'vid-webpack-master') diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts index 5c6d28e3a..57c673262 100644 --- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts @@ -14,8 +14,7 @@ describe('A la carte', function () { const CONFIRM_BUTTON: string = 'confirmButton'; beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); @@ -24,7 +23,6 @@ describe('A la carte', function () { cy.initAlaCarteService(); cy.initZones(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts index 77eca9145..ee147a944 100644 --- a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts @@ -9,8 +9,7 @@ describe('Audit information modal', function () { var jsonBuilderInstantiationBuilder: JsonBuilder = new JsonBuilder(); var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', @@ -19,7 +18,6 @@ describe('Audit information modal', function () { cy.initVidMock(); cy.initAsyncInstantiation(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts index ff43936a2..b3ef7f032 100644 --- a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts @@ -8,15 +8,13 @@ describe('Browse SDC', function () { beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.initZones(); cy.login(); cy.visit("welcome.htm") - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts index d59871310..a9649fa99 100644 --- a/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/collectionResource.e2e.ts @@ -8,13 +8,11 @@ describe('Drawing board : Collection resource', function () { let jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); const serviceModelId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts index a9cddfcbc..e379f7835 100644 --- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts @@ -4,15 +4,13 @@ import {ServiceModel} from "../../support/jsonBuilders/models/service.model"; describe('Drawing board', function () { beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.initActiveNetworks(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts index 90dbcdd01..6abd6a3db 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts @@ -3,15 +3,13 @@ import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model'; -import {ServiceModel} from "../../support/jsonBuilders/models/service.model"; describe('Instantiation status', function () { var jsonBuilderInstantiationBuilder : JsonBuilder = new JsonBuilder(); var asyncRes: Array; beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); @@ -23,7 +21,6 @@ describe('Instantiation status', function () { return res; }); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts index 387f34725..8768e34b5 100644 --- a/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/network.popup.e2e.ts @@ -8,8 +8,7 @@ describe('Network popup', function () { var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.permissionVidMock(); @@ -17,7 +16,6 @@ describe('Network popup', function () { cy.initAAIMock(); cy.initVidMock(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts index f14bc1b5b..22460a04f 100644 --- a/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/permission.e2e.ts @@ -6,15 +6,11 @@ describe('Permissions ', ()=> { var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - - - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/pnf.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/pnf.e2e.ts index a13094a6a..0e106188a 100644 --- a/vid-webpack-master/cypress/integration/iFrames/pnf.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/pnf.e2e.ts @@ -3,14 +3,12 @@ describe('Drawing board: PNF ', function() { beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts index 60c07f4e7..e544720a7 100644 --- a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts @@ -6,8 +6,7 @@ import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; describe('Retry Page', function () { let jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); jsonBuilderAndMock.basicMock('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json', @@ -16,7 +15,6 @@ describe('Retry Page', function () { cy.initZones(); cy.permissionVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts index 26173549b..e4fe593cd 100644 --- a/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/searchExistingInstance.e2e.ts @@ -7,15 +7,13 @@ describe('search existing instance', function () { var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.initZones(); cy.permissionVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts index d95cfdb32..d1d41d0d9 100644 --- a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts @@ -3,14 +3,12 @@ describe('Service popup', function () { describe('basic UI tests', () => { beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts index 79f6a8d13..40ba258bd 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewEdit.e2e.ts @@ -17,9 +17,7 @@ describe('View Edit Page', function () { let jsonBuilderAaiServiceInstances: JsonBuilder = new JsonBuilder(); let jsonBuilderEmpty: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); - }); + cy.clearSessionStorage(); cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson( res, diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts index 0d94e600c..f111189fc 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts @@ -47,9 +47,7 @@ describe('View Edit Page: Upgrade VFModule', function () { let jsonBuilderAaiServiceInstances: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); - }); + cy.clearSessionStorage(); cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { jsonBuilderAAIService.basicJson( res, @@ -130,7 +128,7 @@ describe('View Edit Page: Upgrade VFModule', function () { describe('More UI tests', () => { beforeEach(() => { - cy.window().then((win) => {win.sessionStorage.clear();}); + cy.clearSessionStorage(); cy.setTestApiParamToVNF(); cy.initVidMock(); cy.login(); diff --git a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts index 26d206df3..688d42e94 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts @@ -42,8 +42,7 @@ describe('View only drawing board', function () { const _VIEW = "VIEW"; beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); @@ -51,7 +50,6 @@ describe('View only drawing board', function () { cy.initZones(); cy.permissionVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts index 2c9850048..a014400d4 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts @@ -4,14 +4,12 @@ describe('Vnf popup', function () { describe('basic UI tests', () => { beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts index 7c942ea54..a314424f3 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts @@ -9,15 +9,13 @@ describe('Delete vnf instance', function () { let jsonBuilderInstantiationBuilder: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.initZones(); cy.permissionVidMock(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts index cd21f4e54..dc1b4bbf2 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts @@ -6,8 +6,7 @@ describe('Vnf Groups', function () { var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); @@ -15,7 +14,6 @@ describe('Vnf Groups', function () { cy.permissionVidMock(); cy.setTestApiParamToVNF(); cy.login(); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts index 717d3a927..6700ff425 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts @@ -6,8 +6,7 @@ describe('Drawing board : VRF', function () { var jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); @@ -22,7 +21,6 @@ describe('Drawing board : VRF', function () { status: 200, response: "[]", }).as("expectedPostAsyncInstantiation"); - }); }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts b/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts index 55f90cc69..6bbbd7aab 100644 --- a/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/shared/error.message.popup.e2e.ts @@ -1,21 +1,19 @@ /// /// -import { JsonBuilder } from '../../support/jsonBuilders/jsonBuilder'; -import { AsyncInstantiationModel } from '../../support/jsonBuilders/models/asyncInstantiation.model'; +import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; +import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model'; describe('Error message popup', function () { describe('show error on status 500', () => { var jsonBuilderInstantiationBuilder : JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts index cd14a1247..51e084b32 100644 --- a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts +++ b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts @@ -1,20 +1,18 @@ /// /// -import { JsonBuilder } from '../../support/jsonBuilders/jsonBuilder'; -import { AsyncInstantiationModel } from '../../support/jsonBuilders/models/asyncInstantiation.model'; +import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; +import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model'; describe('Spinner', function () { describe('spinner', () => { var jsonBuilderInstantiationBuilder : JsonBuilder = new JsonBuilder(); beforeEach(() => { - cy.window().then((win) => { - win.sessionStorage.clear(); + cy.clearSessionStorage(); cy.setReduxState(); cy.preventErrorsOnLoading(); cy.initAAIMock(); cy.initVidMock(); cy.login(); - }) }); afterEach(() => { diff --git a/vid-webpack-master/cypress/support/application/application.session.actions.ts b/vid-webpack-master/cypress/support/application/application.session.actions.ts index 42d4d6766..c054b2640 100644 --- a/vid-webpack-master/cypress/support/application/application.session.actions.ts +++ b/vid-webpack-master/cypress/support/application/application.session.actions.ts @@ -2,6 +2,7 @@ declare namespace Cypress { interface Chainable { setReduxState : typeof setReduxState; getReduxState : typeof getReduxState; + clearSessionStorage: typeof clearSessionStorage; setTestApiParamToGR: typeof setTestApiParamToGR; setTestApiParamToVNF: typeof setTestApiParamToVNF; buildReduxStateWithServiceRespone: typeof buildReduxStateWithServiceRespone; @@ -25,6 +26,12 @@ function getReduxState(): Chainable { }); } +function clearSessionStorage() : void { + cy.window().then((win) => { + win.sessionStorage.clear(); + }); +} + function setTestApiParamToGR() : void { cy.window().then((win) => { win.sessionStorage.setItem('msoRequestParametersTestApiValue', 'GR_API'); @@ -72,6 +79,7 @@ function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGe Cypress.Commands.add('setReduxState', setReduxState); Cypress.Commands.add('getReduxState', getReduxState); +Cypress.Commands.add('clearSessionStorage', clearSessionStorage); Cypress.Commands.add('setTestApiParamToGR', setTestApiParamToGR); Cypress.Commands.add('setTestApiParamToVNF',setTestApiParamToVNF); Cypress.Commands.add('buildReduxStateWithServiceRespone', buildReduxStateWithServiceRespone); -- cgit 1.2.3-korg