Skip to content
Snippets Groups Projects
Commit 0a9610f4 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4547 set default/initial vorgangStatistic

parent 85126cdc
Branches
Tags
No related merge requests found
import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de';
import localeDeExtra from '@angular/common/locales/extra/de';
import { CurrentUserProfileE2EComponent } from 'apps/goofy-e2e/src/components/user-profile/current-user-profile.component.e2e';
import { VorgangViewE2EComponent, VorgangViewsE2EComponent } from 'apps/goofy-e2e/src/components/vorgang/vorgang-views.e2e.component';
import { UserE2E } from 'apps/goofy-e2e/src/model/user';
import { HeaderE2EComponent } from 'apps/goofy-e2e/src/page-objects/header.po';
import { MainPage, waitForSpinnerToDisappear } from 'apps/goofy-e2e/src/page-objects/main.po';
import { containClass, exist } from 'apps/goofy-e2e/src/support/cypress.util';
import { getUserSabine, loginAsSabine, loginByUi } from 'apps/goofy-e2e/src/support/user-util';
registerLocaleData(localeDe, 'de', localeDeExtra);
describe('Vorgang search view', () => {
const mainPage: MainPage = new MainPage();
const header: HeaderE2EComponent = mainPage.getHeader();
const views: VorgangViewsE2EComponent = mainPage.getViews();
const sucheView: VorgangViewE2EComponent = views.getSuche();
const currentUserProfile: CurrentUserProfileE2EComponent = header.getCurrentUserProfile();
const user: UserE2E = getUserSabine();
before(() => {
loginAsSabine();
waitForSpinnerToDisappear();
})
describe('should select search view', () => {
it('should set selected after click', () => {
sucheView.getRoot().click();
waitForSpinnerToDisappear();
containClass(sucheView.getRoot(), 'selected');
})
it('should show new view after logout and login', () => {
currentUserProfile.logout();
loginByUi(user);
waitForSpinnerToDisappear();
exist(views.getNeu().getRoot());
})
})
})
\ No newline at end of file
...@@ -120,3 +120,12 @@ export enum UserRoleE2E { ...@@ -120,3 +120,12 @@ export enum UserRoleE2E {
VERWALTUNG_POSTSTELLE = 'VERWALTUNG_POSTSTELLE', VERWALTUNG_POSTSTELLE = 'VERWALTUNG_POSTSTELLE',
VERWALTUNG_USER = 'VERWALTUNG_USER' VERWALTUNG_USER = 'VERWALTUNG_USER'
} }
//TODO Cleanup
export function loginByUi(user: UserE2E): void {
cy.visit('')
.get('#kc-login').should('exist')
.get('#username').type(user.name)
.get('#password').type(user.password)
.get('#kc-login').click();
}
\ No newline at end of file
...@@ -935,4 +935,68 @@ describe('Vorgang Reducer', () => { ...@@ -935,4 +935,68 @@ describe('Vorgang Reducer', () => {
}) })
}) })
}) })
describe('initialState', () => {
describe('vorgangStatistic', () => {
describe('byStatus', () => {
it('should have 0 as neu', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.neu).toEqual(0);
})
it('should have 0 as angenommen', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.angenommen).toEqual(0);
})
it('should have 0 as inBearbeitung', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.inBearbeitung).toEqual(0);
})
it('should have 0 as beschieden', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.beschieden).toEqual(0);
})
it('should have 0 as abgeschlossen', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.abgeschlossen).toEqual(0);
})
it('should have 0 as verworfen', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.verworfen).toEqual(0);
})
it('should have 0 as zuLoeschen', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.byStatus.zuLoeschen).toEqual(0);
})
})
it('should have 0 as wiedervorlagen', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.wiedervorlagen).toBe(0);
})
it('should have false as existsWiedervorlageOverdue', () => {
const vorgangStatistic: StateResource<VorgangStatistic> = Reducer.initialState.vorgangStatistic;
expect(vorgangStatistic.resource.existsWiedervorlageOverdue).toBeFalsy();
})
})
})
}); });
\ No newline at end of file
...@@ -66,7 +66,7 @@ export interface VorgangState { ...@@ -66,7 +66,7 @@ export interface VorgangState {
export const initialState: VorgangState = { export const initialState: VorgangState = {
vorgangList: createEmptyStateResource(), vorgangList: createEmptyStateResource(),
vorgangStatistic: createEmptyStateResource(), vorgangStatistic: createStateResource(createEmptyVorgangStatistic()),
vorgaenge: EMPTY_ARRAY, vorgaenge: EMPTY_ARRAY,
searchString: EMPTY_STRING, searchString: EMPTY_STRING,
searchPreviewList: createEmptyStateResource(), searchPreviewList: createEmptyStateResource(),
...@@ -84,6 +84,22 @@ export const initialState: VorgangState = { ...@@ -84,6 +84,22 @@ export const initialState: VorgangState = {
vorgangExport: createEmptyStateResource(), vorgangExport: createEmptyStateResource(),
}; };
function createEmptyVorgangStatistic(): VorgangStatistic {
return {
byStatus: {
abgeschlossen:0,
angenommen: 0,
neu: 0,
inBearbeitung: 0,
beschieden: 0,
verworfen: 0,
zuLoeschen: 0
},
wiedervorlagen: 0,
existsWiedervorlageOverdue: false
};
}
const vorgangReducer: ActionReducer<VorgangState, Action> = createReducer( const vorgangReducer: ActionReducer<VorgangState, Action> = createReducer(
initialState, initialState,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment