diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/historie/historie.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/historie/historie.e2e-spec.ts index 4bbddb7020c05495e5ff116a5e633b0411ae4c31..6beecd8570879b42760b3275126fa433c9f08890 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/historie/historie.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/historie/historie.e2e-spec.ts @@ -128,6 +128,8 @@ describe('Historie', () => { createdAt: { $date: '2020-01-01T10:08:00.000Z' } }; + const resendPostfachNachricht: CommandE2E = buildCommand(CommandOrderE2E.RESEND_POSTFACH_NACHRICHT, vorgang._id.$oid, vorgang._id.$oid); + const createWiedervorlageCommandBody = { ...createWiedervorlageItem('Create Wiedervorlage Betreff'), attachments: 'DummyAttachment' }; const createWiedervorlageCommand: CommandE2E = { ...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), @@ -157,7 +159,7 @@ describe('Historie', () => { assignUserCommand, createKommentarCommand, editKommentarCommand, forwardVorgangCommand, forwardSuccessfulCommand, forwardFailedCommand, - sendPostfachMailCommand, sendPostfachNachrichtCommand, receivePostfachNachrichtCommand, + sendPostfachMailCommand, sendPostfachNachrichtCommand, receivePostfachNachrichtCommand, resendPostfachNachricht, createWiedervorlageCommand, editWiedervorlageCommand, wiedervorlageErledigenCommand, wiedervorlageWiedereroeffnenCommand ]); initUsermanagerUsers([getUserManagerUserSabine(), getUserManagerUserPeter(), getUserManagerUserEmil()]); @@ -315,12 +317,20 @@ describe('Historie', () => { contains(postfachNachtichtItem.getPostfachNachrichtSubject(), receivePostfachNachrichtCommand.bodyObject.item.subject); contains(postfachNachtichtItem.getPostfachNachrichtMailBody(), receivePostfachNachrichtCommand.bodyObject.item.mailBody); }) + + it('resend postfach nachricht', () => { + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(9); + + exist(historieItem.getRoot()); + contains(historieItem.getHeadline(), HistorieHeadlineE2E.RESEND_POSTFACH_NACHRICHT); + contains(historieItem.getUser(), userName); + }) }) describe('wiedervorlage order', () => { it('create wiedervorlage', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(9); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(10); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.CREATE_WIEDERVORLAGE); @@ -336,7 +346,7 @@ describe('Historie', () => { }) it('edit wiedervorlage', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(10); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(11); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.EDIT_WIEDERVORLAGE); @@ -352,7 +362,7 @@ describe('Historie', () => { }) it('wiedervorlage erledigen', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(11); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(12); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_ERLEDIGEN); @@ -361,7 +371,7 @@ describe('Historie', () => { }) it('wiedervorlage wiedereroeffnen', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(12); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(13); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_WIEDEREROEFFNEN); diff --git a/goofy-client/apps/goofy-e2e/src/model/command.ts b/goofy-client/apps/goofy-e2e/src/model/command.ts index c68548d4379883e4258cd0a357e64391fcfab542..e3a50c9e633c23e9c1f942f9c86ce3282b353b45 100644 --- a/goofy-client/apps/goofy-e2e/src/model/command.ts +++ b/goofy-client/apps/goofy-e2e/src/model/command.ts @@ -31,9 +31,10 @@ export enum CommandOrderE2E { FORWARD_SUCCESSFUL = 'FORWARD_SUCCESSFULL', //TODO Rename Order FORWARD_FAILED = 'FORWARD_FAILED', PATCH_ATTACHED_ITEM = 'PATCH_ATTACHED_ITEM', + RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT', + RESEND_POSTFACH_NACHRICHT = 'RESEND_POSTFACH_MAIL', SEND_POSTFACH_MAIL = 'SEND_POSTFACH_MAIL', SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT', - RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT', UPDATE_ATTACHED_ITEM = 'UPDATE_ATTACHED_ITEM' } export class CommandE2E { diff --git a/goofy-client/apps/goofy-e2e/src/model/historie.ts b/goofy-client/apps/goofy-e2e/src/model/historie.ts index 74729a9839e7c11a58efa12ac15a738e91b6a107..454be1a37e654ea3fe007607a585abc0c5f70a5f 100644 --- a/goofy-client/apps/goofy-e2e/src/model/historie.ts +++ b/goofy-client/apps/goofy-e2e/src/model/historie.ts @@ -35,6 +35,7 @@ export enum HistorieHeadlineE2E { FORWARD_FAILED = 'die Weiterleitung widerrufen.', SEND_POSTFACH_NACHRICHT = 'eine Nachricht geschrieben', RECEIVE_POSTFACH_NACHRICHT = 'eine Nachricht des Antragstellers empfangen.', + RESEND_POSTFACH_NACHRICHT = 'eine Nachricht erneut versendet.', WIEDERVORLAGE_ERLEDIGEN = 'eine Wiedervorlage als erledigt markiert.', WIEDERVORLAGE_WIEDEREROEFFNEN = 'eine Wiedervorlage als offen markiert.', } diff --git a/goofy-client/libs/command-shared/src/lib/command.model.ts b/goofy-client/libs/command-shared/src/lib/command.model.ts index 616a7f6fd2dfc7ac327d260ea65138148af514c6..6579c4078a0cf95bf26ca1b016621ca7a851d3ac 100644 --- a/goofy-client/libs/command-shared/src/lib/command.model.ts +++ b/goofy-client/libs/command-shared/src/lib/command.model.ts @@ -64,6 +64,7 @@ export enum CommandOrder { FORWARD_SUCCESSFULL = 'FORWARD_SUCCESSFULL', SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT', RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT', + RESEND_POSTFACH_NACHRICHT = 'RESEND_POSTFACH_MAIL', WIEDERVORLAGE_ERLEDIGEN = 'WIEDERVORLAGE_ERLEDIGEN', WIEDERVORLAGE_WIEDEREROEFFNEN = 'WIEDERVORLAGE_WIEDEREROEFFNEN', VORGANG_ANNEHMEN = 'VORGANG_ANNEHMEN', @@ -96,6 +97,7 @@ export const ORDER_TYPE_BY_COMMAND_ORDER = { [CommandOrder.FORWARD_SUCCESSFULL]: CommandOrderType.FORWARDING, [CommandOrder.SEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT, [CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT, + [CommandOrder.RESEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT, [CommandOrder.WIEDERVORLAGE_ERLEDIGEN]: CommandOrderType.WIEDERVORLAGE, [CommandOrder.WIEDERVORLAGE_WIEDEREROEFFNEN]: CommandOrderType.WIEDERVORLAGE, [CommandOrder.VORGANG_ANNEHMEN]: CommandOrderType.VORGANG, diff --git a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.html b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.html index 7db6f631f0ac80bf8d9d7ecbdfc3148ba2f7261e..2e6396c725aa5a59f922649d096841572838f58a 100644 --- a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.html +++ b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.html @@ -23,8 +23,13 @@ unter der Lizenz sind dem Lizenztext zu entnehmen. --> -<goofy-client-expansion-panel-with-user [headline]="headline" [resource]="command" data-test-id="historie-item-wiedervorlage-user-expansion-panel"> +<goofy-client-expansion-panel-with-user *ngIf="postfachNachricht; else withoutBody" [headline]="headline" [resource]="command" data-test-class="historie-item-postfach-nachricht-user-expansion-panel-with-body"> <p data-test-class="postfach-nachricht-subject" class="subject">{{postfachNachricht.subject}}</p> <p data-test-class="postfach-nachricht-mail-body">{{postfachNachricht.mailBody}}</p> - <goofy-client-historie-item-attachment *ngIf="postfachNachricht.attachments" [attachments]="postfachNachricht.attachments" data-test-id="historie-item-postfach-nachricht-attachment"></goofy-client-historie-item-attachment> -</goofy-client-expansion-panel-with-user> \ No newline at end of file + <goofy-client-historie-item-attachment *ngIf="postfachNachricht.attachments" [attachments]="postfachNachricht.attachments" data-test-class="historie-item-postfach-nachricht-attachment"></goofy-client-historie-item-attachment> +</goofy-client-expansion-panel-with-user> + +<ng-template #withoutBody> + <goofy-client-expansion-panel-with-user [headline]="headline" [resource]="command" data-test-class="historie-item-postfach-nachricht-user-expansion-panel"> + </goofy-client-expansion-panel-with-user> +</ng-template> \ No newline at end of file diff --git a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.spec.ts b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.spec.ts index 07c17114170ef1ae3cdfb4d936e1f8302578bb4a..1c2a657fd15b7162a293fdfaadc229a14eadaa0e 100644 --- a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.spec.ts +++ b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.spec.ts @@ -27,8 +27,8 @@ import { CommandOrder, CommandResource } from '@goofy-client/command-shared'; import { PostfachMail } from '@goofy-client/postfach-shared'; import { getElementFromFixture } from '@goofy-client/test-utils'; import { createCommandResource } from 'libs/command-shared/test/command'; -import { createPostfachMail } from 'libs/postfach-shared/test/postfach'; -import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; +import { createPostfachMail, createPostfachMailResource } from 'libs/postfach-shared/test/postfach'; +import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { MockComponent } from 'ng-mocks'; import { ExpansionPanelWithUserComponent } from '../expansion-panel-with-user/expansion-panel-with-user.component'; import { HistorieItemAttachmentComponent } from '../historie-item-attachment/historie-item-attachment.component'; @@ -41,7 +41,9 @@ describe('HistorieItemPostfachNachrichtComponent', () => { const item: PostfachMail = createPostfachMail(); const postfachNachrichtCommand: CommandResource = { ...createCommandResource(), body: { item: item } }; - const attachment: string = getDataTestIdOf('historie-item-postfach-nachricht-attachment'); + const attachment: string = getDataTestClassOf('historie-item-postfach-nachricht-attachment'); + const expansionPanel: string = getDataTestClassOf('historie-item-postfach-nachricht-user-expansion-panel'); + const mailBody: string = getDataTestClassOf('postfach-nachricht-mail-body'); beforeEach(async () => { await TestBed.configureTestingModule({ @@ -136,4 +138,45 @@ describe('HistorieItemPostfachNachrichtComponent', () => { expect(attachmentElement).toBeInstanceOf(HTMLElement); }) }) + + describe('postfach nachricht body exists', () => { + + beforeEach(() => { + component.postfachNachricht = createPostfachMailResource(); + fixture.detectChanges(); + }) + + it('should show postfach nachricht with body', () => { + const element = getElementFromFixture(fixture, mailBody); + + expect(element).toBeInstanceOf(HTMLElement); + }) + + it('should hide postfach nachricht', () => { + const element = getElementFromFixture(fixture, expansionPanel); + + expect(element).not.toBeInstanceOf(HTMLElement); + }) + }) + + + describe('postfach nachricht body not exists', () => { + + beforeEach(() => { + component.postfachNachricht = undefined; + fixture.detectChanges(); + }) + + it('should show postfach nachricht', () => { + const element = getElementFromFixture(fixture, expansionPanel); + + expect(element).toBeInstanceOf(HTMLElement); + }) + + it('should hide postfach nachricht with body', () => { + const element = getElementFromFixture(fixture, mailBody); + + expect(element).not.toBeInstanceOf(HTMLElement); + }) + }) }); diff --git a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.ts b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.ts index f3382c93cd54a0fbbb4d33d89afff16a4b44c9ea..c70881f46cdcfcc7c8b899ca88faf41f24509d84 100644 --- a/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.ts +++ b/goofy-client/libs/historie/src/lib/historie-container/historie-list/historie-item-postfach-nachricht/historie-item-postfach-nachricht.component.ts @@ -54,4 +54,5 @@ export class HistorieItemPostfachNachrichtComponent { const HISTORIE_TEXT_BY_POSTFACH_NACHRICHT_ORDER: { [order: string]: string } = { [CommandOrder.SEND_POSTFACH_NACHRICHT]: 'eine Nachricht geschrieben.', [CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: 'eine Nachricht des Antragstellers empfangen.', + [CommandOrder.RESEND_POSTFACH_NACHRICHT]: 'eine Nachricht erneut versendet.' } \ No newline at end of file diff --git a/goofy-client/libs/postfach-shared/src/lib/postfach.util.spec.ts b/goofy-client/libs/postfach-shared/src/lib/postfach.util.spec.ts index eda58d027602cd83900721e3c908c6e952b5345a..45933557f8c418aa2ada0769ca72cab98ef1e285 100644 --- a/goofy-client/libs/postfach-shared/src/lib/postfach.util.spec.ts +++ b/goofy-client/libs/postfach-shared/src/lib/postfach.util.spec.ts @@ -109,13 +109,21 @@ describe('PostfachUtil', () => { expect(count).toBe(PostfachNachrichtenCount.NONE); }) - it('should return NONE on non existing resources', () => { + it('should return NONE on empty resource list', () => { var listResource: PostfachMailListResource = createListResource([]); var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource); expect(count).toBe(PostfachNachrichtenCount.NONE); }) + + it('should return NONE on non existing resources', () => { + var listResource: PostfachMailListResource = toResource({}, [], {}); + + var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource); + + expect(count).toBe(PostfachNachrichtenCount.NONE); + }) }) it('should return SINGLE on one existing resources', () => { diff --git a/goofy-client/libs/postfach-shared/src/lib/postfach.util.ts b/goofy-client/libs/postfach-shared/src/lib/postfach.util.ts index 26aa4629e075eea205f9cf34266f77ea7bd0e029..96878d24ffcaa6e1e5cfa08a0329d16c16b9454a 100644 --- a/goofy-client/libs/postfach-shared/src/lib/postfach.util.ts +++ b/goofy-client/libs/postfach-shared/src/lib/postfach.util.ts @@ -49,7 +49,7 @@ export function getPostfachNachrichtenCount(postfachMailListResource: PostfachMa } const resources: PostfachMailResource[] = getEmbeddedResource<PostfachMailResource[]>(postfachMailListResource, PostfachMailListLinkRel.POSTFACH_MAIL_LIST); - if (resources.length == 0) { + if (isNil(resources) || resources.length == 0) { return PostfachNachrichtenCount.NONE; } if (resources.length == 1) {