Move onap UI loader and icons to VID
[vid.git] / vid-webpack-master / cypress / integration / shared / spinner.e2e.ts
1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 /// <reference types="Cypress" />
3 import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4 import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model';
5
6 describe('Spinner', function () {
7   describe('spinner', () => {
8     var jsonBuilderInstantiationBuilder : JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
9     beforeEach(() => {
10         cy.clearSessionStorage();
11         cy.setReduxState();
12         cy.preventErrorsOnLoading();
13         cy.initAAIMock();
14         cy.initVidMock();
15         cy.login();
16     });
17
18     afterEach(() => {
19       cy.screenshot();
20     });
21
22     it('spinner should display after api call', function () {
23       const timeBomb:Date = new Date(2018,6,10,0,0,0); //month 6 is July
24       if (new Date(Date.now()) > timeBomb) {
25
26         cy.readFile('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => {
27
28           jsonBuilderInstantiationBuilder.basicJson(res,
29             Cypress.config('baseUrl') + "/asyncInstantiation**",
30             200,
31             4000,
32             "error 500 asyncInstantiation");
33           cy.openIframe('app/ui/#/instantiationStatus');
34
35           cy.get('.custom-loader')
36             .and('be.visible');
37
38         });
39       }
40     });
41   });
42 });