change management cypress test
[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.window().then((win) => {
11         win.sessionStorage.clear();
12         cy.setReduxState();
13         cy.preventErrorsOnLoading();
14         cy.initAAIMock();
15         cy.initVidMock();
16         cy.login();
17       })
18     });
19
20     afterEach(() => {
21       cy.screenshot();
22     });
23
24     it('spinner should display after api call', function () {
25       const timeBomb:Date = new Date(2018,6,10,0,0,0); //month 6 is July
26       if (new Date(Date.now()) > timeBomb) {
27
28         cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json').then((res) => {
29
30           jsonBuilderInstantiationBuilder.basicJson(res,
31             Cypress.config('baseUrl') + "/asyncInstantiation**",
32             200,
33             4000,
34             "error 500 asyncInstantiation");
35           cy.openIframe('app/ui/#/instantiationStatus');
36
37           cy.get('.sdc-loader')
38             .and('be.visible');
39
40         });
41       }
42     });
43   });
44 });