From b9f8ba6b905cdf8d9d847bd231dba30e9d6ac29d Mon Sep 17 00:00:00 2001 From: Martin <git@mail.de> Date: Wed, 26 Mar 2025 18:45:56 +0100 Subject: [PATCH 1/4] OZG-7872 use state vorgang directly on change listener (avoiding useless reloading) --- .../libs/kommentar-shared/src/lib/kommentar.service.spec.ts | 2 +- alfa-client/libs/kommentar-shared/src/lib/kommentar.service.ts | 2 +- .../libs/postfach-shared/src/lib/postfach.service.spec.ts | 2 +- alfa-client/libs/postfach-shared/src/lib/postfach.service.ts | 2 +- .../wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts | 2 +- .../libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts index 5860d36428..bd09cc77d8 100644 --- a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts +++ b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts @@ -461,7 +461,7 @@ describe('KommentarService', () => { it('should call vorgang service to get vorgang with eingang', () => { service._listenToVorgangChange(); - expect(vorgangService.getVorgangWithEingang).toHaveBeenCalled(); + expect(vorgangService.selectVorgangWithEingang).toHaveBeenCalled(); }); it('should call handle vorgang change', () => { diff --git a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.ts b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.ts index 395872897b..876f32e5af 100644 --- a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.ts +++ b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.ts @@ -107,7 +107,7 @@ export class KommentarService { _listenToVorgangChange(): void { this.vorgangSubscription = this.vorgangService - .getVorgangWithEingang() + .selectVorgangWithEingang() .subscribe((vorgangWithEingangStateResource: StateResource<VorgangWithEingangResource>) => this._handleVorgangChange(vorgangWithEingangStateResource), ); diff --git a/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts b/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts index 9149471c8d..876e08a03d 100644 --- a/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts +++ b/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts @@ -582,7 +582,7 @@ describe('PostfachService', () => { it('should call vorgang service to get vorgang with eingang', () => { service._listenToVorgangChange(); - expect(vorgangService.getVorgangWithEingang).toHaveBeenCalled(); + expect(vorgangService.selectVorgangWithEingang).toHaveBeenCalled(); }); it('should call handle vorgang change', () => { diff --git a/alfa-client/libs/postfach-shared/src/lib/postfach.service.ts b/alfa-client/libs/postfach-shared/src/lib/postfach.service.ts index f650edd3f4..b7fbfbe62d 100644 --- a/alfa-client/libs/postfach-shared/src/lib/postfach.service.ts +++ b/alfa-client/libs/postfach-shared/src/lib/postfach.service.ts @@ -292,7 +292,7 @@ export class PostfachService { _listenToVorgangChange(): void { this.vorgangChangeSubscription = this.vorgangService - .getVorgangWithEingang() + .selectVorgangWithEingang() .subscribe((vorgangWithEingangStateResource: StateResource<VorgangWithEingangResource>) => this._handleVorgangChange(vorgangWithEingangStateResource), ); diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts index 13e5fcd714..f2513adc3b 100644 --- a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts +++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts @@ -583,7 +583,7 @@ describe('WiedervorlageService', () => { it('should call vorgang service to get vorgang with eingang', () => { service._listenToVorgangChange(); - expect(vorgangService.getVorgangWithEingang).toHaveBeenCalled(); + expect(vorgangService.selectVorgangWithEingang).toHaveBeenCalled(); }); it('should call handle vorgang change', () => { diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts index 6590ff6738..ad5e3f9ea1 100644 --- a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts +++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.ts @@ -122,7 +122,7 @@ export class WiedervorlageService implements OnDestroy { _listenToVorgangChange(): void { this.vorgangSubscription = this.vorgangService - .getVorgangWithEingang() + .selectVorgangWithEingang() .subscribe((vorgangWithEingangStateResource: StateResource<VorgangWithEingangResource>) => this._handleVorgangChange(vorgangWithEingangStateResource), ); -- GitLab From 80320525d5d8a10901e28939e9c970db8dcd0056 Mon Sep 17 00:00:00 2001 From: Martin <git@mail.de> Date: Mon, 31 Mar 2025 23:51:41 +0200 Subject: [PATCH 2/4] OZG-7872 OZG-8041 add e2e test for pending send postfach command --- .../postfach/postfach-mail.e2e.component.ts | 107 +++++++++--------- .../vorgang-detail/vorgang-forwarding.cy.ts | 2 +- .../postfach-mail/postfach-mail-error.cy.ts | 77 ++++++------- .../postfach-mail/postfach-mail.cy.ts | 23 ++-- ...ail.filtered-by-organisationseinheit.cy.ts | 11 +- ...postfach-nachricht-authorize-by-role.cy.ts | 25 +--- .../postfach-nachricht-pending-send.cy.ts | 67 +++++++++++ .../postfach-nachricht-reply-button.cy.ts | 9 +- .../postfach-mail/postfach-nachrichten.cy.ts | 11 +- .../vorgang-forwarding.cy.ts | 2 +- .../src/fixtures/command/command.json | 7 +- .../postfach/send-postfach-nachricht.json | 23 ++++ .../usermanager/usermanager_user_ludwig.json | 18 +++ .../usermanager/usermanager_user_zonk.json | 18 +++ .../helper/forwarding/forwarding.navigator.ts | 2 +- .../postfach-nachricht.navigator.ts | 9 ++ .../postfach-nachricht.verifier.ts | 27 +++++ .../src/helper/vorgang/vorgang.navigator.ts | 10 +- .../apps/alfa-e2e/src/model/command.ts | 11 +- .../apps/alfa-e2e/src/page-objects/main.po.ts | 18 ++- .../postfach-mail.component.po.ts | 6 +- .../alfa-e2e/src/support/cypress-helper.ts | 4 + .../alfa-e2e/src/support/cypress-tasks.ts | 25 ++-- alfa-client/apps/alfa-e2e/src/support/e2e.ts | 7 ++ .../src/support/postfach-nachricht.util.ts | 6 + .../postfach-mail-button.component.html | 1 - .../incomming-mail.component.html | 8 +- .../incomming-mail.component.spec.ts | 4 +- ...tgoing-mail-error-container.component.html | 2 +- ...ing-mail-error-container.component.spec.ts | 57 ++++++---- ...outgoing-mail-error-container.component.ts | 25 ++-- .../outgoing-mail-error.component.html | 14 +-- .../outgoing-mail.component.html | 10 +- .../outgoing-mail.component.spec.ts | 8 +- .../postfach-mail-date.component.html | 4 +- .../postfach-mail-date.component.spec.ts | 5 +- ...stroked-button-with-spinner.component.html | 1 + ...d-stroked-button-with-spinner.component.ts | 1 + 38 files changed, 410 insertions(+), 255 deletions(-) create mode 100644 alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-pending-send.cy.ts create mode 100644 alfa-client/apps/alfa-e2e/src/fixtures/postfach/send-postfach-nachricht.json create mode 100644 alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_ludwig.json create mode 100644 alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_zonk.json create mode 100644 alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.navigator.ts create mode 100644 alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts diff --git a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts index 1bb7839d10..30a485fc0e 100644 --- a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts +++ b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts @@ -21,6 +21,7 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ +import { getTestElement } from '../../support/cypress-helper'; import { convertToDataTestId } from '../../support/tech.util'; import { AttachmentContainerE2EComponent } from '../attachment/attachment.e2e.component'; import { UserProfileE2EComponent } from '../user-profile/user-profile.component.e2e'; @@ -36,103 +37,105 @@ export class PostfachMailE2EComponent { private readonly locatorRoot: string = 'postfach-nachrichten-container-in-vorgang'; - public getRoot() { - return cy.getTestElement(this.locatorRoot); + public getRoot(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.locatorRoot); } - public getCreateButtonWithText() { - return cy.getTestElement(this.createMailButtonWithText); + public getCreateButtonWithText(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.createMailButtonWithText); } - public getCreateButtonWithoutText() { - return cy.getTestElement(this.createMailButtonWithoutText); + public getCreateButtonWithoutText(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.createMailButtonWithoutText); } - public getList() { - return cy.getTestElement(this.list); + public getList(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.list); } - public getNoPostfachText() { - return cy.getTestElement(this.noPostfachText); + public getNoPostfachText(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.noPostfachText); } - public getListItem(subject: string): PostfachMailListItem { - return new PostfachMailListItem(subject); + public getListItem(subject: string): PostfachMailListItemE2EComponent { + return new PostfachMailListItemE2EComponent(subject); } - public getAttachments() { - return cy.getTestElement(this.attachments); + public getAttachments(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.attachments); } - public getDownloadButtonWithIcon() { - return cy.getTestElement(this.downloadButtonWithIcon); + public getDownloadButtonWithIcon(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.downloadButtonWithIcon); } - public getDownloadButtonWithLabel() { - return cy.getTestElement(this.downloadButtonWithLabel); + public getDownloadButtonWithLabel(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.downloadButtonWithLabel); } } -export class PostfachMailListItem { - //TODO: Rename -> PostfachMailListItemE2EComponent +export class PostfachMailListItemE2EComponent { + private readonly createdAt: string = 'mail-created-at'; + private readonly subject: string = 'mail-subject'; + private readonly text: string = 'mail-text'; + private readonly replyIcon: string = 'reply-icon'; + private readonly sentAt: string = 'mail-sent-at'; + private readonly editButton: string = 'postfach-nachricht-edit-button-container'; - private readonly locatorCreatedAt: string = 'mail-created-at'; - private readonly locatorSubject: string = 'mail-subject'; - private readonly locatorText: string = 'mail-text'; - private readonly locatorReplyIcon: string = 'reply-icon'; - private readonly locatorSentAt: string = 'mail-sent-at'; + private readonly sendErrorText: string = 'mail-send-error-text'; + private readonly sendErrorIcon: string = 'mail-send-error-icon'; + private readonly resendButton: string = 'resend-nachricht-button'; - private readonly locatorMailSendErrorText: string = 'mail-send-error-text'; - private readonly locatorMailSendErrorIcon: string = 'mail-send-error-icon'; - private readonly locatorMailResendButton: string = 'mail-resend-button'; + private readonly attachmentContainer: AttachmentContainerE2EComponent = new AttachmentContainerE2EComponent(); - private readonly attachmentContainer: AttachmentContainerE2EComponent = - new AttachmentContainerE2EComponent(); - - private locatorRoot: string; + private root: string; constructor(subject: string) { - this.locatorRoot = convertToDataTestId(subject) + '-item'; + this.root = convertToDataTestId(subject) + '-item'; + } + + public getRoot(): Cypress.Chainable<JQuery<Element>> { + return getTestElement(this.root); } - public getRoot() { - return cy.getTestElement(this.locatorRoot); + public getEditButton(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.editButton); } - public getSubject() { - return this.getRoot().getTestElement(this.locatorSubject); + public getSubject(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.subject); } - public getText() { - return this.getRoot().getTestElement(this.locatorText); + public getText(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.text); } - public getCreatedAt() { - return this.getRoot().getTestElement(this.locatorCreatedAt); + public getCreatedAt(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.createdAt); } public getUserProfile(): UserProfileE2EComponent { - return new UserProfileE2EComponent(this.locatorRoot); + return new UserProfileE2EComponent(this.root); } - public getReplyIcon() { - return this.getRoot().getTestElement(this.locatorReplyIcon); + public getReplyIcon(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.replyIcon); } - public getSentAt() { - return this.getRoot().getTestElement(this.locatorSentAt); + public getSentAt(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.sentAt); } - public getMailSendErrorText() { - return this.getRoot().getTestElement(this.locatorMailSendErrorText); + public getSendErrorText(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.sendErrorText); } - public getMailSendErrorIcon() { - return this.getRoot().getTestElement(this.locatorMailSendErrorIcon); + public getSendErrorIcon(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.sendErrorIcon); } - public getResendButton() { - return this.getRoot().getTestElement(this.locatorMailResendButton); + public getResendButton(): Cypress.Chainable<JQuery<Element>> { + return this.getRoot().findTestElementWithClass(this.resendButton); } public getAttachmentContainer(): AttachmentContainerE2EComponent { diff --git a/alfa-client/apps/alfa-e2e/src/e2e/einheitlicher-ansprechpartner/vorgang-detail/vorgang-forwarding.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/einheitlicher-ansprechpartner/vorgang-detail/vorgang-forwarding.cy.ts index 82dd57a8ae..0a80fc4dc8 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/einheitlicher-ansprechpartner/vorgang-detail/vorgang-forwarding.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/einheitlicher-ansprechpartner/vorgang-detail/vorgang-forwarding.cy.ts @@ -31,7 +31,7 @@ describe('Vorgang weiterleiten innerhalb der OzgCloud', () => { }); it('should open vorgang', () => { - vorgangNavigator.openVorgangDetailByName(vorgangWeiterleiten.name); + vorgangNavigator.openVorgang(vorgangWeiterleiten.name); }); it('should display Weiterleiten button in Status Neu', () => { diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts index 14814f7d70..7248a1727b 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts @@ -21,35 +21,40 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ +import { E2EAppHelper } from 'apps/alfa-e2e/src/helper/app.helper'; +import { E2EPostfachNachrichtVerifier } from 'apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier'; +import { E2EVorgangNavigator } from 'apps/alfa-e2e/src/helper/vorgang/vorgang.navigator'; import { createPostfachNachrichtAttachedItem, createPostfachNachrichtReplyItem, } from 'apps/alfa-e2e/src/support/postfach-nachricht.util'; -import { PostfachMailE2EComponent, PostfachMailListItem } from '../../../components/postfach/postfach-mail.e2e.component'; +import { + PostfachMailE2EComponent, + PostfachMailListItemE2EComponent, +} from '../../../components/postfach/postfach-mail.e2e.component'; import { SnackBarE2EComponent } from '../../../components/ui/snackbar.e2e.component'; -import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-list.e2e.component'; import { VorgangSubnavigationE2EComponent } from '../../../components/vorgang/vorgang-subnavigation'; import { VorgangE2E } from '../../../model/vorgang'; import { DirectionE2E, PostfachMailItemE2E, PostfachNachrichtMessageCodeE2E, - PostfachNachrichtMessageCodeMessagesE2E, PostfachNachrichtSnackbarMessageE2E, VorgangAttachedItemE2E, } from '../../../model/vorgang-attached-item'; -import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; +import { containsSpinner, MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; -import { dropCollections } from '../../../support/cypress-helper'; import { contains, exist, notExist } from '../../../support/cypress.util'; -import { getUserSabineId, loginAsSabine } from '../../../support/user-util'; +import { getUserSabineId } from '../../../support/user-util'; import { initVorgangAttachedItem } from '../../../support/vorgang-attached-item-util'; import { createVorgang, initVorgang, objectIds } from '../../../support/vorgang-util'; describe('PostfachMail error', () => { + const appHelper: E2EAppHelper = new E2EAppHelper(); + const vorgangNavigator: E2EVorgangNavigator = new E2EVorgangNavigator(); + const mainPage: MainPage = new MainPage(); - const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList(); const snackbar: SnackBarE2EComponent = mainPage.getSnackBar(); const vorgangPage: VorgangPage = new VorgangPage(); @@ -58,9 +63,12 @@ describe('PostfachMail error', () => { const postfachMailPage: PostfachMailPage = new PostfachMailPage(); + const verifier: E2EPostfachNachrichtVerifier = new E2EPostfachNachrichtVerifier(); + const vorgang: VorgangE2E = createVorgang(); const postfachMailItem: PostfachMailItemE2E = { ...createPostfachNachrichtReplyItem(), + subject: 'Failed Outgoing Postfach Nachricht 1', createdBy: getUserSabineId(), direction: DirectionE2E.OUT, sentAt: '2022-12-02T15:00:00.790Z[UTC]', @@ -73,26 +81,26 @@ describe('PostfachMail error', () => { item: postfachMailItem, }; + const postfachNachricht2: PostfachMailItemE2E = { + ...postfachMailItem, + subject: 'Failed Outgoing Postfach Nachricht 2', + }; + const vorgangAttachedItem2: VorgangAttachedItemE2E = { + ...createPostfachNachrichtAttachedItem(objectIds[1], vorgang._id.$oid), + item: postfachNachricht2, + }; + before(() => { initVorgang(vorgang); - initVorgangAttachedItem([vorgangAttachedItem]); + initVorgangAttachedItem([vorgangAttachedItem, vorgangAttachedItem2]); - loginAsSabine(); - - waitForSpinnerToDisappear(); - exist(vorgangList.getRoot()); - }); - - after(() => { - dropCollections(); + appHelper.loginAsSabine(); }); describe('navigate to vorgang detail', () => { it('should open vorgang detail', () => { - vorgangList.getListItem(vorgang.name).getRoot().click(); + vorgangNavigator.openVorgang(vorgang.name); waitForSpinnerToDisappear(); - - exist(vorgangPage.getVorgangDetailHeader().getRoot()); }); it('should show postfach mail button', () => { @@ -109,44 +117,23 @@ describe('PostfachMail error', () => { }); describe('postfach mail list', () => { - let listItem: PostfachMailListItem; + let listItem: PostfachMailListItemE2EComponent; beforeEach(() => { listItem = postfachMailPage.getListItem(postfachMailItem.subject); }); - describe('contains failed sent mail item', () => { - it('should show mail subject', () => { - contains(listItem.getSubject(), postfachMailItem.subject); - }); - - it('should show user profile', () => { - exist(listItem.getUserProfile().getRoot()); - }); - - it('should show sent date', () => { - exist(listItem.getSentAt()); - }); - - it('should show text', () => { - contains(listItem.getMailSendErrorText(), PostfachNachrichtMessageCodeMessagesE2E.PROCESSING_FAILED); - }); - - it('should show error message', () => { - exist(listItem.getMailSendErrorIcon()); - }); - - it('should show button', () => { - exist(listItem.getResendButton()); - }); + it('should contains failed postfach nachricht item', () => { + verifier.verifyFailedItemInList(postfachMailItem.subject); }); describe('resend mail', () => { it('click on resend button should hide error', () => { listItem.getResendButton().click(); + containsSpinner(listItem.getResendButton()); waitForSpinnerToDisappear(); - notExist(listItem.getMailSendErrorIcon()); + notExist(listItem.getSendErrorIcon()); }); describe('resend mail item', () => { diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts index f818bb1783..6a33ba8948 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts @@ -34,7 +34,10 @@ import { createPostfachNachrichtReplyItem, } from 'apps/alfa-e2e/src/support/postfach-nachricht.util'; import { PostfachMailFormularE2EComponent } from '../../../components/postfach/postfach-mail-formular.e2e.component'; -import { PostfachMailE2EComponent, PostfachMailListItem } from '../../../components/postfach/postfach-mail.e2e.component'; +import { + PostfachMailE2EComponent, + PostfachMailListItemE2EComponent, +} from '../../../components/postfach/postfach-mail.e2e.component'; import { FixedDialogE2EComponent } from '../../../components/ui/fixed-dialog.e2e.component'; import { SnackBarE2EComponent } from '../../../components/ui/snackbar.e2e.component'; import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-list.e2e.component'; @@ -50,7 +53,7 @@ import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main. import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; import { expectIconWithBadge, expectIconWithoutBadge } from '../../../support/angular.util'; -import { dropCollections, readFileFromDownloads } from '../../../support/cypress-helper'; +import { readFileFromDownloads } from '../../../support/cypress-helper'; import { beChecked, contains, exist, notBeChecked, notBeVisible, notExist, visible } from '../../../support/cypress.util'; import { TEST_FILE_WITH_CONTENT, TEST_FILE_WITH_CONTENT_4_MB, TEST_FILE_WITHOUT_CONTENT } from '../../../support/data.util'; import { initUsermanagerUsers, loginAsSabine } from '../../../support/user-util'; @@ -122,10 +125,6 @@ describe('PostfachMail', () => { exist(vorgangList.getRoot()); }); - after(() => { - dropCollections(); - }); - describe('mail icon', () => { it('should not be visible', () => { notExist(vorgangList.getListItem(vorgang.name).getPostfachIcon()); @@ -328,7 +327,7 @@ describe('PostfachMail', () => { }); it('should show postfach mail in list', () => { - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem(postfachMailToSend.subject); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem(postfachMailToSend.subject); exist(postfachMailItem.getRoot()); exist(postfachMailItem.getUserProfile().getRoot()); @@ -340,7 +339,7 @@ describe('PostfachMail', () => { describe('click on postfach mail item with attachment', () => { it('should show postfach item list', () => { - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem(postfachMailToSend.subject); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem(postfachMailToSend.subject); postfachMailItem.getRoot().click(); waitForSpinnerToDisappear(); @@ -348,13 +347,13 @@ describe('PostfachMail', () => { }); it('should contain mail item with attachment', () => { - const postfachListItem: PostfachMailListItem = postfachMailPage.getListItem(postfachMailToSend.subject); + const postfachListItem: PostfachMailListItemE2EComponent = postfachMailPage.getListItem(postfachMailToSend.subject); exist(postfachListItem.getAttachmentContainer().getList().getItem(TEST_FILE_WITH_CONTENT).getRoot()); }); it('should download attachment after click', () => { - const postfachListItem: PostfachMailListItem = postfachMailPage.getListItem(postfachMailToSend.subject); + const postfachListItem: PostfachMailListItemE2EComponent = postfachMailPage.getListItem(postfachMailToSend.subject); postfachListItem.getAttachmentContainer().getList().getItem(TEST_FILE_WITH_CONTENT).getDownloadButton().click(); waitForSpinnerToDisappear(); @@ -363,7 +362,7 @@ describe('PostfachMail', () => { }); it('should not contain failed upload', () => { - const postfachListItem: PostfachMailListItem = postfachMailPage.getListItem(postfachMailToSend.subject); + const postfachListItem: PostfachMailListItemE2EComponent = postfachMailPage.getListItem(postfachMailToSend.subject); notExist( postfachListItem.getAttachmentContainer().getList().getLoadingOrErrorItem(TEST_FILE_WITH_CONTENT_4_MB).getRoot(), @@ -461,7 +460,7 @@ describe('PostfachMail', () => { }); describe('click on postfach mail item', () => { - let postfachMailReplyItem: PostfachMailListItem; + let postfachMailReplyItem: PostfachMailListItemE2EComponent; beforeEach(() => { postfachMailReplyItem = postfachMailPage.getListItem(postfachMailReply.subject); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts index bb94de6b4b..7c15088c5a 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts @@ -27,12 +27,9 @@ import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-lis import { EingangE2E, VorgangE2E } from '../../../model/vorgang'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; -import { dropCollections, visitUrl } from '../../../support/cypress-helper'; +import { visitUrl } from '../../../support/cypress-helper'; import { contains, exist, notExist } from '../../../support/cypress.util'; -import { - ORGANISATIONSEINHEITEN_ID_FOR_ADELHEIT, - ORGANISATIONSEINHEITEN_ID_FOR_SABINE, -} from '../../../support/data.util'; +import { ORGANISATIONSEINHEITEN_ID_FOR_ADELHEIT, ORGANISATIONSEINHEITEN_ID_FOR_SABINE } from '../../../support/data.util'; import { MessagesE2E } from '../../../support/messages'; import { loginAsAdelheit, loginAsSabine } from '../../../support/user-util'; import { buildVorgang, createVorgang, initVorgaenge } from '../../../support/vorgang-util'; @@ -72,10 +69,6 @@ describe('PostfachNachrichten filtered by organisationseinheit', () => { initVorgaenge([vorgangForSabine, vorgangForAdelheit]); }); - after(() => { - dropCollections(); - }); - describe('on user sabine', () => { const authorizedUrl = vorgangUrlVisibleToSabine; const forbiddenUrl = vorgangUrlVisibleToAdelheit; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts index cb4a23f20e..8fc722691d 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts @@ -25,7 +25,7 @@ import { SnackBarE2EComponent } from 'apps/alfa-e2e/src/components/ui/snackbar.e import { VorgangE2E, VorgangStatusE2E } from 'apps/alfa-e2e/src/model/vorgang'; import { MainPage, waitForSpinnerToDisappear } from 'apps/alfa-e2e/src/page-objects/main.po'; import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach-mail.component.po'; -import { dropCollections, visitUrl } from 'apps/alfa-e2e/src/support/cypress-helper'; +import { visitUrl } from 'apps/alfa-e2e/src/support/cypress-helper'; import { contains, exist, notExist } from 'apps/alfa-e2e/src/support/cypress.util'; import { MessagesE2E } from 'apps/alfa-e2e/src/support/messages'; import { createPostfachUriByVorgangId } from 'apps/alfa-e2e/src/support/postfach-util'; @@ -47,47 +47,32 @@ describe('Postfach Nachricht should be authorized by role', () => { }; const vorgangInStatusInBearbeitungId = '60250b9d383c182943f6ba79'; - const vorgangInStatusInBearbeitungUrl: string = createPostfachUriByVorgangId( - vorgangInStatusInBearbeitungId, - ); + const vorgangInStatusInBearbeitungUrl: string = createPostfachUriByVorgangId(vorgangInStatusInBearbeitungId); const vorgangInStatusInBearbeitung: VorgangE2E = { ...buildVorgang(vorgangInStatusInBearbeitungId, 'vorgangInStatusInBearbeitung'), status: VorgangStatusE2E.IN_BEARBEITUNG, }; const vorgangInStatusAbgeschlossenId: string = '602566a807bb665df9a86e87'; - const vorgangInStatusAbgeschlossenUrl: string = createPostfachUriByVorgangId( - vorgangInStatusAbgeschlossenId, - ); + const vorgangInStatusAbgeschlossenUrl: string = createPostfachUriByVorgangId(vorgangInStatusAbgeschlossenId); const vorgangInStatusAbgeschlossen: VorgangE2E = { ...buildVorgang(vorgangInStatusAbgeschlossenId, 'vorgangInStatusAbgeschlossen'), status: VorgangStatusE2E.ABGESCHLOSSEN, }; const vorgangInStatusBeschiedenId: string = '602566a207bb665df9a86e86'; - const vorgangInStatusBeschiedenUrl: string = createPostfachUriByVorgangId( - vorgangInStatusBeschiedenId, - ); + const vorgangInStatusBeschiedenUrl: string = createPostfachUriByVorgangId(vorgangInStatusBeschiedenId); const vorgangInStatusBeschieden: VorgangE2E = { ...buildVorgang(vorgangInStatusBeschiedenId, 'vorgangInStatusBeschieden'), status: VorgangStatusE2E.BESCHIEDEN, }; beforeEach(() => { - initVorgaenge([ - vorgangInStatusNeu, - vorgangInStatusInBearbeitung, - vorgangInStatusAbgeschlossen, - vorgangInStatusBeschieden, - ]); + initVorgaenge([vorgangInStatusNeu, vorgangInStatusInBearbeitung, vorgangInStatusAbgeschlossen, vorgangInStatusBeschieden]); loginAsPeter(); }); - after(() => { - dropCollections(); - }); - it(`should show vorgang in Stauts ${VorgangStatusE2E.NEU}`, () => { visitUrl(vorgangInStatusNeuUrl); waitForSpinnerToDisappear(); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-pending-send.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-pending-send.cy.ts new file mode 100644 index 0000000000..d2c1d45bf3 --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-pending-send.cy.ts @@ -0,0 +1,67 @@ +import { PostfachMailE2EComponent } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; +import { E2EAppHelper } from 'apps/alfa-e2e/src/helper/app.helper'; +import { E2EVorgangNavigator } from 'apps/alfa-e2e/src/helper/vorgang/vorgang.navigator'; +import { CommandE2E, CommandOrderE2E, CommandStatusE2E } from 'apps/alfa-e2e/src/model/command'; +import { createCommand, initCommand } from 'apps/alfa-e2e/src/support/command-util'; +import { + createPostfachNachrichtAttachedItem, + createSendPostfachNachrichtItem, +} from 'apps/alfa-e2e/src/support/postfach-nachricht.util'; +import { initVorgangAttachedItem } from 'apps/alfa-e2e/src/support/vorgang-attached-item-util'; +import { VorgangE2E } from '../../../model/vorgang'; +import { PostfachMailItemE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item'; +import { containsSpinner } from '../../../page-objects/main.po'; +import { VorgangPage } from '../../../page-objects/vorgang.po'; +import { exist } from '../../../support/cypress.util'; +import { createVorgang, initVorgang, objectIds } from '../../../support/vorgang-util'; + +describe('Postfach Nachricht pending send', () => { + const appHelper: E2EAppHelper = new E2EAppHelper(); + + const vorgangNavigator: E2EVorgangNavigator = new E2EVorgangNavigator(); + + const vorgangPage: VorgangPage = new VorgangPage(); + const postfachMailContainer: PostfachMailE2EComponent = vorgangPage.getPostfachMailcontainer(); + + const vorgangWithPendingSendCommand: VorgangE2E = { ...createVorgang(), name: 'VorgangWithPendingSendCommand' }; + const postfachSendNachrichtItem: PostfachMailItemE2E = { + ...createSendPostfachNachrichtItem(), + sentSuccessful: false, + }; + const postfachNachrichtAttachedItem: VorgangAttachedItemE2E = { + ...createPostfachNachrichtAttachedItem(objectIds[1], vorgangWithPendingSendCommand._id.$oid), + item: postfachSendNachrichtItem, + }; + const pendingSendCommand: CommandE2E = { + ...createCommand(), + order: CommandOrderE2E.SEND_POSTFACH_NACHRICHT, + status: CommandStatusE2E.PENDING, + finishedAt: null, + body: postfachSendNachrichtItem, + }; + + before(() => { + initVorgang(vorgangWithPendingSendCommand); + initVorgangAttachedItem([postfachNachrichtAttachedItem]); + initCommand(pendingSendCommand); + + appHelper.loginAsSabine(); + }); + + describe('area in vorgang detail', () => { + it('should have item in list', () => { + vorgangNavigator.openVorgang(vorgangWithPendingSendCommand.name); + + exist(postfachMailContainer.getListItem(postfachSendNachrichtItem.subject).getRoot()); + }); + + it('should show spinner on buttons', () => { + containsSpinner(postfachMailContainer.getCreateButtonWithText()); + containsSpinner(postfachMailContainer.getCreateButtonWithoutText()); + }); + + it('should show edit button', () => { + exist(postfachMailContainer.getListItem(postfachSendNachrichtItem.subject).getEditButton()); + }); + }); +}); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-reply-button.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-reply-button.cy.ts index ad58b9e3b8..009047f787 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-reply-button.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-reply-button.cy.ts @@ -25,7 +25,6 @@ import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-lis import { VorgangE2E } from '../../../model/vorgang'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; -import { dropCollections } from '../../../support/cypress-helper'; import { exist } from '../../../support/cypress.util'; import { generate12ByteId } from '../../../support/tech.util'; import { loginAsSabine } from '../../../support/user-util'; @@ -48,9 +47,7 @@ describe('Postfach Nachricht reply button', () => { postfachAddress: [ { type: 1, - identifier: new Map([ - ['postfachId', new Object('04d39269-81c5-4838-8b73-08d9567f06d7')], - ]), + identifier: new Map([['postfachId', new Object('04d39269-81c5-4838-8b73-08d9567f06d7')]]), }, ], }, @@ -66,10 +63,6 @@ describe('Postfach Nachricht reply button', () => { exist(vorgangList.getRoot()); }); - after(() => { - dropCollections(); - }); - describe('navigate to vorgang detail with OSI service konto', () => { it('should open vorgang detail', () => { vorgangList.getListItem(vorgangWithOsiServiceKonto.name).getRoot().click(); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts index d0d6d95237..fa8a20f7a6 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts @@ -35,12 +35,7 @@ import { VorgangE2E } from '../../../model/vorgang'; import { PostfachMailItemE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; -import { - countDownloadFiles, - deleteDownloadFolder, - dropCollections, - interceptWithResponse, -} from '../../../support/cypress-helper'; +import { countDownloadFiles, deleteDownloadFolder, interceptWithResponse } from '../../../support/cypress-helper'; import { exist, notExist } from '../../../support/cypress.util'; import { LinkRelE2E } from '../../../support/linkrels'; import { removeLinkFromResource } from '../../../support/tech.util'; @@ -73,10 +68,6 @@ describe('Postfach Nachrichten', () => { exist(vorgangList.getRoot()); }); - after(() => { - dropCollections(); - }); - describe('navigate to vorgangDetail', () => { beforeEach(() => { interceptWithResponse(HttpMethodE2E.GET, '*/vorgangs/*', (req) => modifyResponse(req)); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-detailansicht/vorgang-forwarding.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-detailansicht/vorgang-forwarding.cy.ts index 8634b339b8..9ac436d5a3 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-detailansicht/vorgang-forwarding.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-detailansicht/vorgang-forwarding.cy.ts @@ -140,7 +140,7 @@ describe('Vorgang weiterleiten', () => { }); it('should display Weiterleiten button in Status In Neu', () => { - vorgangNavigator.openVorgangDetailByName(vorgangWeiterleiten.name); + vorgangNavigator.openVorgang(vorgangWeiterleiten.name); vorgangVerifier.verifyForwardingButtonExists(); }); diff --git a/alfa-client/apps/alfa-e2e/src/fixtures/command/command.json b/alfa-client/apps/alfa-e2e/src/fixtures/command/command.json index 854f9990ea..9b286b5bbd 100644 --- a/alfa-client/apps/alfa-e2e/src/fixtures/command/command.json +++ b/alfa-client/apps/alfa-e2e/src/fixtures/command/command.json @@ -1,4 +1,7 @@ { + "_id": { + "$oid": "60d9fa33290e586b59a6b311" + }, "vorgangId": "602566a807bb665df9a86111", "createdAt": { "$date": "2022-06-20T10:51:52.073Z" @@ -10,8 +13,8 @@ "relationVersion": 0, "order": "SEND_POSTFACH_MAIL", "previousStatus": "NEU", - "_class": "Command", "finishedAt": { "$date": "2022-06-20T10:51:53.600Z" - } + }, + "_class": "Command" } diff --git a/alfa-client/apps/alfa-e2e/src/fixtures/postfach/send-postfach-nachricht.json b/alfa-client/apps/alfa-e2e/src/fixtures/postfach/send-postfach-nachricht.json new file mode 100644 index 0000000000..4954c8891b --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/fixtures/postfach/send-postfach-nachricht.json @@ -0,0 +1,23 @@ +{ + "attachment": [], + "mailBody": "\nSig für Sprint... <b>fix</b> a\n\nMfG\nIhre lustige Behörde", + "subject": "Send", + "vorgangId": "", + "sentAt": "", + "postfachAddress": { + "serviceKontoType": "OSI", + "identifier": { + "postfachId": "91ed5efa-9278-4366-e8f9-08db926b26f3" + }, + "type": "1", + "version": "1.0", + "class": "class de.ozgcloud.alfa.postfach.PostfachAddress" + }, + "createdAt": "2020-12-31T01:01:43.790Z[UTC]", + "sentSuccessful": "", + "createdBy": "", + "messageCode": "", + "id": "", + "replyOption": "POSSIBLE", + "direction": "OUT" +} diff --git a/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_ludwig.json b/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_ludwig.json new file mode 100644 index 0000000000..a6dd93d1bc --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_ludwig.json @@ -0,0 +1,18 @@ +{ + "_id": { + "$oid": "63284e55c39b316b2ad02a5d" + }, + "createdAt": { + "$date": "2022-08-25T08:29:45.025Z" + }, + "deleted": false, + "keycloakUserId": "108ee867-7290-466d-813f-ab1dc95d3691", + "firstName": "Ludwig", + "fullName": "Ludwig Löscher", + "lastName": "Lösher", + "email": "ludwig.loescher@e2e-ozg-sh.de", + "lastSyncTimestamp": 1663585874687, + "organisationsEinheitIds": [], + "roles": ["VERWALTUNG_LOESCHEN"], + "username": "ludwig" +} diff --git a/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_zonk.json b/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_zonk.json new file mode 100644 index 0000000000..8dd4e48252 --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/fixtures/usermanager/usermanager_user_zonk.json @@ -0,0 +1,18 @@ +{ + "_id": { + "$oid": "63284e54c33b916b2ad02e2a" + }, + "createdAt": { + "$date": "2022-08-25T08:29:45.025Z" + }, + "deleted": false, + "keycloakUserId": "108ee867-7290-466d-813f-ab1dc95d3691", + "firstName": "Zacharias", + "fullName": "Zacharias Zonk", + "lastName": "Zonk", + "email": "zacharias.zonk@e2e-ozg-sh.de", + "lastSyncTimestamp": 1663585874687, + "organisationsEinheitIds": [], + "roles": ["VERWALTUNG_USER"], + "username": "zonk" +} diff --git a/alfa-client/apps/alfa-e2e/src/helper/forwarding/forwarding.navigator.ts b/alfa-client/apps/alfa-e2e/src/helper/forwarding/forwarding.navigator.ts index 3400d79516..50a60041b6 100644 --- a/alfa-client/apps/alfa-e2e/src/helper/forwarding/forwarding.navigator.ts +++ b/alfa-client/apps/alfa-e2e/src/helper/forwarding/forwarding.navigator.ts @@ -10,7 +10,7 @@ export class E2EForwardingNavigator { private readonly forwardingDialog: ForwardingDialogE2EComponent = new ForwardingDialogE2EComponent(); public openForwardDialog(vorgangName: string): void { - this.vorgangNavigator.openVorgangDetailByName(vorgangName); + this.vorgangNavigator.openVorgang(vorgangName); this.formularButtons.getForwardButton().click(); exist(this.forwardingDialog.getRoot()); } diff --git a/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.navigator.ts b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.navigator.ts new file mode 100644 index 0000000000..3b7a2b0a0c --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.navigator.ts @@ -0,0 +1,9 @@ +import { E2EVorgangNavigator } from '../vorgang/vorgang.navigator'; + +export class E2EPostfachNachrichtNavigator { + private readonly vorgangNavigator: E2EVorgangNavigator = new E2EVorgangNavigator(); + + public openPostfachNachricht(vorgangName: string): void { + this.vorgangNavigator.openVorgang(vorgangName); + } +} diff --git a/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts new file mode 100644 index 0000000000..d6f9c0cebf --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts @@ -0,0 +1,27 @@ +import { PostfachMailListItemE2EComponent } from '../../components/postfach/postfach-mail.e2e.component'; +import { PostfachNachrichtMessageCodeMessagesE2E } from '../../model/vorgang-attached-item'; +import { PostfachMailPage } from '../../page-objects/postfach-mail.component.po'; +import { contains, exist } from '../../support/cypress.util'; + +export class E2EPostfachNachrichtVerifier { + private readonly postfachNachrichtPage: PostfachMailPage = new PostfachMailPage(); + + public verifyFailedItemInList(subject: string): void { + const item: PostfachMailListItemE2EComponent = this.getListItem(subject); + this.verifyItemInList(subject); + contains(item.getSendErrorText(), PostfachNachrichtMessageCodeMessagesE2E.PROCESSING_FAILED); + exist(item.getSendErrorIcon()); + exist(item.getResendButton()); + } + + public verifyItemInList(subject: string): void { + const item: PostfachMailListItemE2EComponent = this.getListItem(subject); + contains(item.getSubject(), subject); + exist(item.getUserProfile().getRoot()); + exist(item.getSentAt()); + } + + private getListItem(subject: string): PostfachMailListItemE2EComponent { + return this.postfachNachrichtPage.getListItem(subject); + } +} diff --git a/alfa-client/apps/alfa-e2e/src/helper/vorgang/vorgang.navigator.ts b/alfa-client/apps/alfa-e2e/src/helper/vorgang/vorgang.navigator.ts index 3225f82b8a..9642b588d8 100644 --- a/alfa-client/apps/alfa-e2e/src/helper/vorgang/vorgang.navigator.ts +++ b/alfa-client/apps/alfa-e2e/src/helper/vorgang/vorgang.navigator.ts @@ -11,16 +11,12 @@ export class E2EVorgangNavigator { private readonly vorgangListPage = new VorgangListE2EComponent(); - public openVorgangDetailByName(vorgangName: string): void { - this.vorgangListPage.getListItem(vorgangName).getRoot().click(); - waitForSpinnerToDisappear(); - this.verifier.verifyVorgangDetailOpen(vorgangName); - } - public openVorgang(vorgangName: string): void { this.appHelper.navigateToDomain(); waitForSpinnerToDisappear(); exist(this.vorgangListPage.getRoot()); - this.openVorgangDetailByName(vorgangName); + + this.vorgangListPage.getListItem(vorgangName).getRoot().click(); + this.verifier.verifyVorgangDetailOpen(vorgangName); } } diff --git a/alfa-client/apps/alfa-e2e/src/model/command.ts b/alfa-client/apps/alfa-e2e/src/model/command.ts index 537bd8680f..bdc72b43d4 100644 --- a/alfa-client/apps/alfa-e2e/src/model/command.ts +++ b/alfa-client/apps/alfa-e2e/src/model/command.ts @@ -21,12 +21,12 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -import { DateE2E } from './util'; +import { DateE2E, ObjectIdE2E } from './util'; export enum CommandOrderE2E { ASSIGN_USER = 'ASSIGN_USER', CREATE_ATTACHED_ITEM = 'CREATE_ATTACHED_ITEM', - FORWARD_VORGANG = 'REDIRECT_VORGANG', //TODO Rename Order + FORWARD_VORGANG = 'REDIRECT_VORGANG', FORWARD_SUCCESSFUL = 'FORWARD_SUCCESSFULL', //TODO Rename Order FORWARD_FAILED = 'FORWARD_FAILED', PATCH_ATTACHED_ITEM = 'PATCH_ATTACHED_ITEM', @@ -38,7 +38,14 @@ export enum CommandOrderE2E { UPDATE_ATTACHED_ITEM = 'UPDATE_ATTACHED_ITEM', VORGANG_WIEDEREROEFFNEN = 'VORGANG_WIEDEREROEFFNEN', } + +export enum CommandStatusE2E { + PENDING = 'PENDING', + FINISHED = 'FINISHED', +} + export class CommandE2E { + id: ObjectIdE2E; vorgangId: string; createdAt: DateE2E; createdBy: string; diff --git a/alfa-client/apps/alfa-e2e/src/page-objects/main.po.ts b/alfa-client/apps/alfa-e2e/src/page-objects/main.po.ts index 433d726179..d47b4e62dc 100644 --- a/alfa-client/apps/alfa-e2e/src/page-objects/main.po.ts +++ b/alfa-client/apps/alfa-e2e/src/page-objects/main.po.ts @@ -33,9 +33,13 @@ import { InternalServerErrorDialogE2EComponent } from '../components/ui/internal import { SnackBarE2EComponent } from '../components/ui/snackbar.e2e.component'; import { VorgangListE2EComponent } from '../components/vorgang/vorgang-list.e2e.component'; import { VorgangViewsE2EComponent } from '../components/vorgang/vorgang-views.e2e.component'; +import { getTestElementWithClass } from '../support/cypress-helper'; +import { exist, notExist } from '../support/cypress.util'; import { HeaderE2EComponent } from './header.po'; export class MainPage { + public static readonly SPINNER: string = 'spinner'; + private readonly buildInfo: BuildInfoE2EComponent = new BuildInfoE2EComponent(); private readonly header: HeaderE2EComponent = new HeaderE2EComponent(); private readonly navigation: NavigationE2EComponent = new NavigationE2EComponent(); @@ -95,10 +99,20 @@ export class MainPage { } } -export function waitForSpinnerToDisappear(): boolean { - return cy.getTestElementWithClass('spinner').should('not.exist'); +export function waitForSpinnerToDisappear(): void { + notExist(getSpinner()); +} + +export function getSpinner(): Cypress.Chainable<JQuery<Element>> { + return getTestElementWithClass(MainPage.SPINNER); +} + +export function containsSpinner(rootElement: Cypress.Chainable<JQuery<Element>>): void { + exist(rootElement.findTestElementWithClass(MainPage.SPINNER)); } +//TODO Funktion loeschen export function waitforSpinnerToAppear(): void { // exist(cy.getTestElementWithClass('spinner')); } +// diff --git a/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts b/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts index c76682e1c2..50d8ffd1fb 100644 --- a/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts +++ b/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts @@ -23,7 +23,7 @@ */ //TODO Datei umbenennen in postfach.po.ts import { PostfachMailSubnavigation } from '../components/postfach/postfach-mail-subnavigation.e2e.component'; -import { PostfachMailListItem } from '../components/postfach/postfach-mail.e2e.component'; +import { PostfachMailListItemE2EComponent } from '../components/postfach/postfach-mail.e2e.component'; export class PostfachMailPage { private readonly root: string = 'postfach-mail-list'; @@ -50,8 +50,8 @@ export class PostfachMailPage { return this.headingText; } - getListItem(subject: string): PostfachMailListItem { - return new PostfachMailListItem(subject); + getListItem(subject: string): PostfachMailListItemE2EComponent { + return new PostfachMailListItemE2EComponent(subject); } getDownloadButton() { diff --git a/alfa-client/apps/alfa-e2e/src/support/cypress-helper.ts b/alfa-client/apps/alfa-e2e/src/support/cypress-helper.ts index 9e520f34e3..8bdfdfa1e0 100644 --- a/alfa-client/apps/alfa-e2e/src/support/cypress-helper.ts +++ b/alfa-client/apps/alfa-e2e/src/support/cypress-helper.ts @@ -192,6 +192,10 @@ export function getTestElement(value: string) { return cy.getTestElement(value); } +export function getTestElementWithClass(value: string): Cypress.Chainable<JQuery<Element>> { + return cy.getTestElementWithClass(value); +} + export function getElement(value: string) { return cy.get(value); } diff --git a/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts b/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts index 0c4ad2fdcb..335686bf99 100644 --- a/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts +++ b/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts @@ -160,7 +160,8 @@ function parseCommandData(commands) { return commands; } -function parseCommand(command) { +function parseCommand(command): void { + command._id = createObjectId(command); command.createdAt = createDate(command.createdAt); if (command.finishedAt) { command.finishedAt = createDate(command.finishedAt); @@ -173,7 +174,7 @@ function parseGridFsFileData(gridFsFiles) { return gridFsFiles; } -function parseGridFsFile(gridFsFile) { +function parseGridFsFile(gridFsFile): void { gridFsFile._id = createObjectId(gridFsFile); gridFsFile.length = createNumberLong(gridFsFile.length); gridFsFile.uploadDate = createDate(gridFsFile.uploadDate); @@ -184,7 +185,7 @@ function parseGridFsChunkData(gridFsChunks) { return gridFsChunks; } -function parseGridFsChunk(gridFsChunk) { +function parseGridFsChunk(gridFsChunk): void { gridFsChunk._id = createObjectId(gridFsChunk); //TODO createObjectId nutzen, sobald diese umgestellt ist gridFsChunk.files_id = new ObjectId(gridFsChunk.files_id.$oid); @@ -196,18 +197,18 @@ function parseOzgCloudFileData(ozgCloudFiles: OzgCloudFileE2E[]) { return ozgCloudFiles; } -function parseOzgCloudFile(ozgCloudFile) { +function parseOzgCloudFile(ozgCloudFile): void { ozgCloudFile._id = createObjectId(ozgCloudFile); ozgCloudFile.size = createNumberLong(ozgCloudFile.size); ozgCloudFile.version = createNumberLong(ozgCloudFile.version); } -function parseVorgangData(data) { +function parseVorgangData(data): void { data.forEach((vorgang) => parseVorgang(vorgang)); return data; } -function parseVorgang(vorgang) { +function parseVorgang(vorgang): void { vorgang._id = createObjectId(vorgang); vorgang.createdAt = createDate(vorgang.createdAt); @@ -221,7 +222,7 @@ function parseVorgang(vorgang) { } } -function parseEingang(eingang) { +function parseEingang(eingang): void { eingang.header.createdAt = createDate(eingang.header.createdAt); } @@ -229,16 +230,16 @@ function createBinData(encoded64Value) { return Binary(Buffer.from(encoded64Value, 'base64'), 0); } -function parseWiedervorlage(wiedervorlage) { +function parseWiedervorlage(wiedervorlage): void { wiedervorlage.frist = createDate(wiedervorlage.frist); wiedervorlage.createdAt = createDate(wiedervorlage.createdAt); } -function parseKommentar(kommentar) { +function parseKommentar(kommentar): void { kommentar.createdAt = createDate(kommentar.createdAt); } -function createDate(field) { +function createDate(field): Date { return new Date(field.$date); } @@ -247,7 +248,7 @@ function parseVorgangAttachedItemData(vorgangAttachedItems) { return vorgangAttachedItems; } -function parseVorgangAttachedItem(parseVorgangAttachedItem) { +function parseVorgangAttachedItem(parseVorgangAttachedItem): void { parseVorgangAttachedItem._id = createObjectId(parseVorgangAttachedItem); parseVorgangAttachedItem.version = createNumberLong(parseVorgangAttachedItem.version); } @@ -257,7 +258,7 @@ function parseUserData(data) { return data; } -function parseUser(user) { +function parseUser(user): void { user._id = createObjectId(user); user.createdAt = createDate(user.createdAt); } diff --git a/alfa-client/apps/alfa-e2e/src/support/e2e.ts b/alfa-client/apps/alfa-e2e/src/support/e2e.ts index ee993cca1c..6334e8ea63 100644 --- a/alfa-client/apps/alfa-e2e/src/support/e2e.ts +++ b/alfa-client/apps/alfa-e2e/src/support/e2e.ts @@ -41,6 +41,7 @@ import 'cypress-mochawesome-reporter/register'; import 'cypress-real-events'; import 'cypress-timestamps/support'; import './commands'; +import { dropCollections } from './cypress-helper'; import './file-upload'; Cypress.on('command:start', ({ attributes }) => { @@ -66,3 +67,9 @@ Cypress.on('fail', (err) => { Cypress.Keyboard.defaults({ keystrokeDelay: 30, }); + +after(() => { + cy.log('Cleanup after test suite...'); + dropCollections(); + cy.log('...cleanup done.'); +}); diff --git a/alfa-client/apps/alfa-e2e/src/support/postfach-nachricht.util.ts b/alfa-client/apps/alfa-e2e/src/support/postfach-nachricht.util.ts index ce4a9c9587..6b661b1da1 100644 --- a/alfa-client/apps/alfa-e2e/src/support/postfach-nachricht.util.ts +++ b/alfa-client/apps/alfa-e2e/src/support/postfach-nachricht.util.ts @@ -4,9 +4,11 @@ import { VorgangAttachedItemE2E, VorgangAttachedItemNameE2E, } from '../model/vorgang-attached-item'; +import { getUserSabineId } from './user-util'; import { VORGANG_ATTACHED_ITEM_CLASS } from './vorgang-attached-item-util'; const postfachNachrichtReplyItemFixture: PostfachMailItemE2E = require('../fixtures/postfach/postfach-nachricht-reply-item.json'); +const sendPostfachNachrichtCommandFixture: PostfachMailItemE2E = require('../fixtures/postfach/send-postfach-nachricht.json'); export function createPostfachNachrichtReplyItem(): PostfachMailItemE2E { return postfachNachrichtReplyItemFixture; @@ -27,3 +29,7 @@ export function createPostfachNachrichtAttachedItem(_id: string, vorgangId: stri _class: VORGANG_ATTACHED_ITEM_CLASS, }; } + +export function createSendPostfachNachrichtItem(): PostfachMailItemE2E { + return { ...sendPostfachNachrichtCommandFixture, createdBy: getUserSabineId() }; +} diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html index eff1422c21..33bdf6e2f6 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html @@ -24,7 +24,6 @@ --> @if (postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL) { - <!-- TODO Aufteilen in 3 einzelne Komponenten --> @if (showAsIconButton) { <ods-button dataTestId="send-mail-icon-button" diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.html index 948be283b5..1e21300e35 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.html @@ -25,19 +25,19 @@ --> <a [routerLink]="onPage ? null : 'postfach'" data-test-class="incoming-mail-routing"> <div class="mail-head"> - <div class="subject" data-test-id="mail-subject"> - <mat-icon data-test-id="reply-icon">reply</mat-icon> + <div class="subject" data-test-class="mail-subject"> + <mat-icon data-test-class="reply-icon">reply</mat-icon> <span class="overflow">{{ postfachMail.subject }}</span> </div> <alfa-postfach-mail-date class="date" [postfachMail]="postfachMail"></alfa-postfach-mail-date> </div> <div class="second-row"> - <div class="message overflow" data-test-id="mail-text"> + <div class="message overflow" data-test-class="mail-text"> {{ postfachMail.mailBody }} </div> <mat-icon *ngIf="(postfachMail | hasLink: postfachNachrichtLinkRel.ATTACHMENTS) && !onPage" - data-test-id="postfach-nachricht-attachment-icon" + data-test-class="postfach-nachricht-attachment-icon" >attach_file</mat-icon > </div> diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.spec.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.spec.ts index 7ef16d31fb..6aa766b89b 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.spec.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/incomming-mail/incomming-mail.component.spec.ts @@ -29,7 +29,7 @@ import localeDe from '@angular/common/locales/de'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatIcon } from '@angular/material/icon'; import { provideRouter, RouterLinkWithHref, RouterModule } from '@angular/router'; -import { getDataTestClassOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test'; +import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { MockComponent } from 'ng-mocks'; import { createPostfachMailResource } from '../../../../../../../postfach-shared/test/postfach'; import { PostfachMailDateComponent } from '../postfach-mail-date/postfach-mail-date.component'; @@ -41,7 +41,7 @@ describe('IncommingMailComponent', () => { let component: IncommingMailComponent; let fixture: ComponentFixture<IncommingMailComponent>; - const attachmentIcon: string = getDataTestIdOf('postfach-nachricht-attachment-icon'); + const attachmentIcon: string = getDataTestClassOf('postfach-nachricht-attachment-icon'); const routing: string = getDataTestClassOf('incoming-mail-routing'); beforeEach(async () => { diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.html index e77aa1c04b..b0350e73cf 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.html @@ -24,7 +24,7 @@ --> <alfa-outgoing-mail-error - *ngIf="postfachMailResource | hasLink: postfachMailLinkRel.RESEND_POSTFACH_MAIL" + *ngIf="postfachMailResource | hasLink: PostfachMailLinkRel.RESEND_POSTFACH_MAIL" data-test-id="outgoing-mail-error" [postfachMailResource]="postfachMailResource" [resendPostfachMailStateResource]="resendPostfachMailStateResource$ | async" diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.spec.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.spec.ts index 43ea6995be..20855cb121 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.spec.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.spec.ts @@ -21,30 +21,33 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { OutgoingMailErrorContainerComponent } from './outgoing-mail-error-container.component'; +import { CommandResource } from '@alfa-client/command-shared'; import { PostfachMailLinkRel, PostfachService } from '@alfa-client/postfach-shared'; -import { mock } from '@alfa-client/test-utils'; -import { OutgoingMailErrorComponent } from './outgoing-mail-error/outgoing-mail-error.component'; +import { createEmptyStateResource, createStateResource, HasLinkPipe, StateResource } from '@alfa-client/tech-shared'; +import { existsAsHtmlElement, Mock, mock, notExistsAsHtmlElement } from '@alfa-client/test-utils'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { createCommandResource } from 'libs/command-shared/test/command'; +import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { MockComponent } from 'ng-mocks'; -import { HasLinkPipe } from '@alfa-client/tech-shared'; +import { of } from 'rxjs'; import { createPostfachMailResource } from '../../../../../../../../postfach-shared/test/postfach'; +import { singleColdCompleted } from '../../../../../../../../tech-shared/test/marbles'; +import { OutgoingMailErrorContainerComponent } from './outgoing-mail-error-container.component'; +import { OutgoingMailErrorComponent } from './outgoing-mail-error/outgoing-mail-error.component'; describe('OutgoingMailErrorContainerComponent', () => { let component: OutgoingMailErrorContainerComponent; let fixture: ComponentFixture<OutgoingMailErrorContainerComponent>; - const postfachService = mock(PostfachService); - const mailError: string = '[data-test-id="outgoing-mail-error"]'; + let postfachService: Mock<PostfachService>; + + const mailError: string = getDataTestIdOf('outgoing-mail-error'); beforeEach(async () => { + postfachService = mock(PostfachService); + await TestBed.configureTestingModule({ - declarations: [ - OutgoingMailErrorContainerComponent, - MockComponent(OutgoingMailErrorComponent), - HasLinkPipe, - ], + declarations: [OutgoingMailErrorContainerComponent, MockComponent(OutgoingMailErrorComponent), HasLinkPipe], providers: [ { provide: PostfachService, @@ -65,32 +68,42 @@ describe('OutgoingMailErrorContainerComponent', () => { }); describe('resendMail', () => { + const commandStateResource: StateResource<CommandResource> = createStateResource(createCommandResource()); + + beforeEach(() => { + postfachService.resendMail.mockReturnValue(of(commandStateResource)); + }); + it('should call postfach service', () => { component.resendMail(); expect(postfachService.resendMail).toHaveBeenCalled(); }); + + it('should assign service response', () => { + component.resendPostfachMailStateResource$ = of(createEmptyStateResource<CommandResource>()); + + component.resendMail(); + + expect(component.resendPostfachMailStateResource$).toBeObservable(singleColdCompleted(commandStateResource)); + }); }); describe('outgoing mail error', () => { it('should show', () => { - component.postfachMailResource = createPostfachMailResource([ - PostfachMailLinkRel.RESEND_POSTFACH_MAIL, - ]); - fixture.detectChanges(); + component.postfachMailResource = createPostfachMailResource([PostfachMailLinkRel.RESEND_POSTFACH_MAIL]); - const element = fixture.nativeElement.querySelector(mailError); + fixture.detectChanges(); - expect(element).toBeInstanceOf(HTMLElement); + existsAsHtmlElement(fixture, mailError); }); it('should hide', () => { component.postfachMailResource = createPostfachMailResource(); - fixture.detectChanges(); - const element = fixture.nativeElement.querySelector(mailError); + fixture.detectChanges(); - expect(element).not.toBeInstanceOf(HTMLElement); + notExistsAsHtmlElement(fixture, mailError); }); }); }); diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.ts index 680063ef32..c0d8d6589d 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error-container.component.ts @@ -21,15 +21,11 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -import { Component, Input, OnInit } from '@angular/core'; -import { StateResource } from '@alfa-client/tech-shared'; import { CommandResource } from '@alfa-client/command-shared'; +import { PostfachMailLinkRel, PostfachMailResource, PostfachService } from '@alfa-client/postfach-shared'; +import { StateResource } from '@alfa-client/tech-shared'; +import { Component, inject, Input, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; -import { - PostfachMailLinkRel, - PostfachMailResource, - PostfachService, -} from '@alfa-client/postfach-shared'; @Component({ selector: 'alfa-outgoing-mail-error-container', @@ -39,18 +35,17 @@ import { export class OutgoingMailErrorContainerComponent implements OnInit { @Input() postfachMailResource: PostfachMailResource; - resendPostfachMailStateResource$: Observable<StateResource<CommandResource>>; + private readonly postfachService: PostfachService = inject(PostfachService); - readonly postfachMailLinkRel = PostfachMailLinkRel; + public resendPostfachMailStateResource$: Observable<StateResource<CommandResource>>; - constructor(private postfachService: PostfachService) {} + public readonly PostfachMailLinkRel = PostfachMailLinkRel; - resendMail() { - this.postfachService.resendMail(this.postfachMailResource); + ngOnInit() { + this.resendPostfachMailStateResource$ = this.postfachService.getPendingSendPostfachMailCommand(); } - ngOnInit() { - this.resendPostfachMailStateResource$ = - this.postfachService.getPendingSendPostfachMailCommand(); + public resendMail(): void { + this.resendPostfachMailStateResource$ = this.postfachService.resendMail(this.postfachMailResource); } } diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error/outgoing-mail-error.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error/outgoing-mail-error.component.html index 2eaa38bcef..ee571d9b2d 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error/outgoing-mail-error.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail-error-container/outgoing-mail-error/outgoing-mail-error.component.html @@ -23,19 +23,13 @@ unter der Lizenz sind dem Lizenztext zu entnehmen. --> -<div - *ngIf="postfachMailResource.messageCode" - data-test-id="mail-send-error" - class="mail-send-error" -> - <span data-test-id="mail-send-error-text">{{ message }}</span> - <mat-icon data-test-id="mail-send-error-icon" class="mail-send-error__icon text-error" - >error_outline_white</mat-icon - > +<div *ngIf="postfachMailResource.messageCode" data-test-id="mail-send-error" class="mail-send-error"> + <span data-test-class="mail-send-error-text">{{ message }}</span> + <mat-icon data-test-class="mail-send-error-icon" class="mail-send-error__icon text-error">error_outline_white</mat-icon> </div> <!-- TODO Eigene Component fuer den Button --> <ozgcloud-stroked-button-with-spinner - dataTestId="mail-resend-button" + dataTestClass="resend-nachricht-button" text="Erneut versuchen" icon="autorenew" [stateResource]="resendPostfachMailStateResource" diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.html index a3d8233fcc..8c3c6ee468 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.html @@ -38,18 +38,18 @@ <alfa-postfach-mail-date *ngIf="postfachMail.sentAt" [postfachMail]="postfachMail" - data-test-id="postfach-outgoing-nachricht-date" + data-test-class="postfach-outgoing-nachricht-date" ></alfa-postfach-mail-date> </div> - <span class="overflow subject" data-test-id="mail-subject">{{ postfachMail.subject }}</span> - <div class="message overflow" data-test-id="mail-text"> + <span class="overflow subject" data-test-class="mail-subject">{{ postfachMail.subject }}</span> + <div class="message overflow" data-test-class="mail-text"> {{ postfachMail.mailBody }} </div> <mat-icon *ngIf="(postfachMail | hasLink: postfachNachrichtLinkRel.ATTACHMENTS) && !onPage" - data-test-id="postfach-nachricht-attachment-icon" + data-test-class="postfach-nachricht-attachment-icon" >attach_file</mat-icon > </a> @@ -57,7 +57,7 @@ <alfa-outgoing-mail-error-container [postfachMailResource]="postfachMail"></alfa-outgoing-mail-error-container> <alfa-postfach-nachricht-edit-button-container *ngIf="(postfachMail | hasLink: postfachNachrichtLinkRel.EDIT) && !onPage" - data-test-id="postfach-nachricht-edit-button-container" + data-test-class="postfach-nachricht-edit-button-container" [postfachNachricht]="postfachMail" [vorgangStateResource]="vorgangStateResource" > diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.spec.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.spec.ts index 1c5549014c..09aa734b77 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.spec.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/outgoing-mail/outgoing-mail.component.spec.ts @@ -35,7 +35,7 @@ import { VorgangWithEingangResource } from '@alfa-client/vorgang-shared'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatIcon } from '@angular/material/icon'; import { provideRouter, RouterLinkWithHref, RouterModule } from '@angular/router'; -import { getDataTestClassOf, getDataTestIdOf } from 'libs/tech-shared/test/data-test'; +import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang'; import { MockComponent } from 'ng-mocks'; import { createPostfachMailResource } from '../../../../../../../postfach-shared/test/postfach'; @@ -48,9 +48,9 @@ describe('OutgoingMailComponent', () => { let component: OutgoingMailComponent; let fixture: ComponentFixture<OutgoingMailComponent>; - const attachmentIcon: string = getDataTestIdOf('postfach-nachricht-attachment-icon'); - const postfachEditButton: string = getDataTestIdOf('postfach-nachricht-edit-button-container'); - const postfachOutgoingNachrichtDate: string = getDataTestIdOf('postfach-outgoing-nachricht-date'); + const attachmentIcon: string = getDataTestClassOf('postfach-nachricht-attachment-icon'); + const postfachEditButton: string = getDataTestClassOf('postfach-nachricht-edit-button-container'); + const postfachOutgoingNachrichtDate: string = getDataTestClassOf('postfach-outgoing-nachricht-date'); const routing: string = getDataTestClassOf('outgoing-mail-routing'); diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.html b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.html index 5b1bd5617b..0355d59f69 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.html +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.html @@ -24,12 +24,12 @@ --> <ng-container *ngIf="isIncomingMail; else sentAt"> - <div class="date" data-test-id="mail-created-at"> + <div class="date" data-test-class="mail-created-at"> {{ postfachMail.createdAt | formatDateWithTimePipe: false }} </div> </ng-container> <ng-template #sentAt> - <div class="date" data-test-id="mail-sent-at"> + <div class="date" data-test-class="mail-sent-at"> {{ postfachMail.sentAt | formatDateWithTimePipe: false }} </div> </ng-template> diff --git a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.spec.ts b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.spec.ts index ca8fd42b29..80f60496e9 100644 --- a/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.spec.ts +++ b/alfa-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list/postfach-mail/postfach-mail-date/postfach-mail-date.component.spec.ts @@ -28,6 +28,7 @@ import { registerLocaleData } from '@angular/common'; import localeDe from '@angular/common/locales/de'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { createPostfachMailResource } from 'libs/postfach-shared/test/postfach'; +import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { PostfachMailDateComponent } from './postfach-mail-date.component'; registerLocaleData(localeDe); @@ -36,8 +37,8 @@ describe('PostfachMailDateComponent', () => { let component: PostfachMailDateComponent; let fixture: ComponentFixture<PostfachMailDateComponent>; - const sentAt: string = '[data-test-id="mail-sent-at"]'; - const createdAt: string = '[data-test-id="mail-created-at"]'; + const sentAt: string = getDataTestClassOf('mail-sent-at'); + const createdAt: string = getDataTestClassOf('mail-created-at'); beforeEach(async () => { await TestBed.configureTestingModule({ diff --git a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html index 1c6c7d8515..3f72b62337 100644 --- a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html +++ b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html @@ -33,6 +33,7 @@ [tooltip]="toolTip" [class.with-text]="text" (click)="clickEmitter.emit($event)" + [attr.data-test-class]="dataTestClass" > <ozgcloud-button-content [icon]="icon" diff --git a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts index 36f102a0d7..48acab5184 100644 --- a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts +++ b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts @@ -48,6 +48,7 @@ export class OzgcloudStrokedButtonWithSpinnerComponent implements OnInit { @Input() dataTestId: string; @Input() showSpinner: boolean = false; @Input() strokedButton: boolean = true; + @Input() dataTestClass: string; @Output() public clickEmitter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>(); -- GitLab From b3b5fff877eb48ebec8cc6124ee820a6879c1834 Mon Sep 17 00:00:00 2001 From: Martin <git@mail.de> Date: Wed, 2 Apr 2025 09:38:46 +0200 Subject: [PATCH 3/4] OZG-7872 test unit test --- .../libs/kommentar-shared/src/lib/kommentar.service.spec.ts | 2 +- .../libs/postfach-shared/src/lib/postfach.service.spec.ts | 2 +- .../ozgcloud-stroked-button-with-spinner.component.html | 1 - .../ozgcloud-stroked-button-with-spinner.component.spec.ts | 2 +- .../ozgcloud-stroked-button-with-spinner.component.ts | 2 +- .../wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts index bd09cc77d8..4fa2802ae1 100644 --- a/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts +++ b/alfa-client/libs/kommentar-shared/src/lib/kommentar.service.spec.ts @@ -66,7 +66,7 @@ describe('KommentarService', () => { navigationService = mock(NavigationService); vorgangService = { ...mock(VorgangService), - getVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), + selectVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), }; binaryFileService = mock(BinaryFileService); diff --git a/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts b/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts index 876e08a03d..492502ba27 100644 --- a/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts +++ b/alfa-client/libs/postfach-shared/src/lib/postfach.service.spec.ts @@ -70,7 +70,7 @@ describe('PostfachService', () => { beforeEach(() => { vorgangService = { ...mock(VorgangService), - getVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), + selectVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), }; navigationService.urlChanged = jest.fn(); navigationService.urlChanged.mockReturnValue(of(urlChangedParams)); diff --git a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html index 3f72b62337..9370aa544d 100644 --- a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html +++ b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.html @@ -25,7 +25,6 @@ --> <button mat-stroked-button - data-test-class="icon-button" [attr.data-test-id]="dataTestId" [color]="color" [type]="type" diff --git a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.spec.ts b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.spec.ts index ac0307f012..003beefa16 100644 --- a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.spec.ts +++ b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.spec.ts @@ -24,13 +24,13 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatButton } from '@angular/material/button'; import { MatRipple } from '@angular/material/core'; +import { TooltipDirective } from '@ods/system'; import { createCommandResource } from 'libs/command-shared/test/command'; import { getDataTestClassOf } from 'libs/tech-shared/test/data-test'; import { MockComponent, MockDirective } from 'ng-mocks'; import { OzgcloudButtonContentComponent } from '../shared/ozgcloud-button-content/ozgcloud-button-content.component'; import { OzgcloudStrokedButtonWithSpinnerComponent } from './ozgcloud-stroked-button-with-spinner.component'; -import { TooltipDirective } from '@ods/system'; import * as ResourceUtils from 'libs/tech-shared/src/lib/resource/resource.util'; describe('OzgcloudStrokedButtonWithSpinnerComponent', () => { diff --git a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts index 48acab5184..8b9cc56e39 100644 --- a/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts +++ b/alfa-client/libs/ui/src/lib/ui/ozgcloud-button/ozgcloud-stroked-button-with-spinner/ozgcloud-stroked-button-with-spinner.component.ts @@ -48,7 +48,7 @@ export class OzgcloudStrokedButtonWithSpinnerComponent implements OnInit { @Input() dataTestId: string; @Input() showSpinner: boolean = false; @Input() strokedButton: boolean = true; - @Input() dataTestClass: string; + @Input() dataTestClass: string = 'icon-button'; @Output() public clickEmitter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>(); diff --git a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts index f2513adc3b..2f47bc7ea5 100644 --- a/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts +++ b/alfa-client/libs/wiedervorlage-shared/src/lib/wiedervorlage.service.spec.ts @@ -88,7 +88,7 @@ describe('WiedervorlageService', () => { binaryFileService = mock(BinaryFileService); vorgangService = { ...mock(VorgangService), - getVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), + selectVorgangWithEingang: jest.fn().mockReturnValue(of(vorgangWithEingangStateResource)), }; navigationService.urlChanged.mockReturnValue(of({})); -- GitLab From b8ddd0983e1df4a8724edb3bb7914379adfb33f9 Mon Sep 17 00:00:00 2001 From: Martin <git@mail.de> Date: Thu, 3 Apr 2025 08:47:17 +0200 Subject: [PATCH 4/4] OZG-7872 add id to command --- .../e2e/main-tests/historie/historie.cy.ts | 141 ++++++------------ .../vorgang-xdomea-inhalte.cy.ts | 5 +- .../apps/alfa-e2e/src/model/command.ts | 2 +- .../apps/alfa-e2e/src/support/command-util.ts | 7 +- 4 files changed, 51 insertions(+), 104 deletions(-) diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/historie/historie.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/historie/historie.cy.ts index cd1bd8b8cc..34ed5740b5 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/historie/historie.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/historie/historie.cy.ts @@ -31,11 +31,7 @@ import { WiedervorlageHistorieItemE2EComponent, } from 'apps/alfa-e2e/src/components/vorgang/vorgang.formular-daten.historie.e2e.component'; import { CommandE2E, CommandOrderE2E } from 'apps/alfa-e2e/src/model/command'; -import { - HistorieAttachmentE2E, - HistorieHeadlineE2E, - SYSTEM_USER_NAME, -} from 'apps/alfa-e2e/src/model/historie'; +import { HistorieAttachmentE2E, HistorieHeadlineE2E, SYSTEM_USER_NAME } from 'apps/alfa-e2e/src/model/historie'; import { PostfachE2E } from 'apps/alfa-e2e/src/model/postfach-nachricht'; import { DirectionE2E } from 'apps/alfa-e2e/src/model/vorgang-attached-item'; import { buildCommand, createCommand, initCommands } from 'apps/alfa-e2e/src/support/command-util'; @@ -50,13 +46,8 @@ import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main. import { VorgangPage } from '../../../page-objects/vorgang.po'; import { dropCollections } from '../../../support/cypress-helper'; import { contains, exist, notExist } from '../../../support/cypress.util'; -import { - getUserSabine, - getUserSabineId, - initUsermanagerUsers, - loginAsSabine, -} from '../../../support/user-util'; -import { createVorgang, initVorgang } from '../../../support/vorgang-util'; +import { getUserSabine, getUserSabineId, initUsermanagerUsers, loginAsSabine } from '../../../support/user-util'; +import { createVorgang, initVorgang, objectIds } from '../../../support/vorgang-util'; registerLocaleData(localeDe, 'de', localeDeExtra); @@ -65,15 +56,14 @@ describe('Historie', () => { const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList(); const vorgangPage: VorgangPage = new VorgangPage(); - const vorgangDatenFormular: VorgangFormularDatenE2EComponent = - vorgangPage.getFormularDatenContainer(); + const vorgangDatenFormular: VorgangFormularDatenE2EComponent = vorgangPage.getFormularDatenContainer(); const vorgangHeader: VorgangDetailHeaderE2EComponent = vorgangPage.getVorgangDetailHeader(); const vorgang: VorgangE2E = createVorgang(); const assignUserCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.ASSIGN_USER, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[1], CommandOrderE2E.ASSIGN_USER, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { assignedTo: getUserSabineId() }, createdAt: { $date: '2020-01-01T10:00:00.000Z' }, }; @@ -83,7 +73,7 @@ describe('Historie', () => { item: { ...createKommentar(), attachments: 'DummyAttachment' }, }; const createKommentarCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[2], CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: createKommentarCommandBody, createdAt: { $date: '2020-01-01T10:01:00.000Z' }, }; @@ -92,21 +82,21 @@ describe('Historie', () => { item: { ...createKommentar(), attachments: ['DummyAttachment', 'DummyAttachment2'] }, }; const editKommentarCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.UPDATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[3], CommandOrderE2E.UPDATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: editKommentarCommandBody, createdAt: { $date: '2020-01-01T10:02:00.000Z' }, }; const forwardVorgangCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.FORWARD_VORGANG, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[4], CommandOrderE2E.FORWARD_VORGANG, vorgang._id.$oid, vorgang._id.$oid), createdAt: { $date: '2020-01-01T10:03:00.000Z' }, }; const forwardSuccessfulCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.FORWARD_SUCCESSFUL, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[5], CommandOrderE2E.FORWARD_SUCCESSFUL, vorgang._id.$oid, vorgang._id.$oid), createdAt: { $date: '2020-01-01T10:04:00.000Z' }, }; const forwardFailedCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.FORWARD_FAILED, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[6], CommandOrderE2E.FORWARD_FAILED, vorgang._id.$oid, vorgang._id.$oid), createdAt: { $date: '2020-01-01T10:05:00.000Z' }, }; @@ -117,6 +107,7 @@ describe('Historie', () => { attachments: 'dummyAttachment', }; const sendPostfachMailCommand: CommandE2E = { + _id: { $oid: objectIds[7] }, ...createCommand(), bodyObject: sendPostfachMailCommandBody, createdAt: { $date: '2020-01-01T10:06:00.000Z' }, @@ -128,12 +119,12 @@ describe('Historie', () => { attachments: ['dummyAttachment', 'dummyAttachment2'], }; const sendPostfachNachrichtCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.SEND_POSTFACH_NACHRICHT, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[8], CommandOrderE2E.SEND_POSTFACH_NACHRICHT, vorgang._id.$oid, vorgang._id.$oid), bodyObject: sendPostfachNachrichtCommandBody, createdAt: { $date: '2020-01-01T10:07:00.000Z' }, }; const receivePostfachNachrichtCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[9], CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { itemName: 'PostfachMail', item: { @@ -150,6 +141,7 @@ describe('Historie', () => { }; const resendPostfachNachricht: CommandE2E = buildCommand( + objectIds[10], CommandOrderE2E.RESEND_POSTFACH_NACHRICHT, vorgang._id.$oid, vorgang._id.$oid, @@ -160,7 +152,7 @@ describe('Historie', () => { attachments: 'DummyAttachment', }; const createWiedervorlageCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[11], CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { itemName: 'Wiedervorlage', item: createWiedervorlageCommandBody }, createdAt: { $date: '2020-01-01T10:09:00.000Z' }, }; @@ -170,17 +162,17 @@ describe('Historie', () => { done: true, }; const editWiedervorlageCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.UPDATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[12], CommandOrderE2E.UPDATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { itemName: 'Wiedervorlage', item: editWiedervorlageCommandBody }, createdAt: { $date: '2020-01-01T10:10:00.000Z' }, }; const wiedervorlageErledigenCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.PATCH_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[13], CommandOrderE2E.PATCH_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { itemName: 'Wiedervorlage', item: { done: 'true' }, vorgangId: vorgang._id.$oid }, createdAt: { $date: '2020-01-01T10:11:00.000Z' }, }; const wiedervorlageWiedereroeffnenCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.PATCH_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), + ...buildCommand(objectIds[14], CommandOrderE2E.PATCH_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), bodyObject: { itemName: 'Wiedervorlage', item: { done: 'false' }, vorgangId: vorgang._id.$oid }, createdAt: { $date: '2020-01-01T10:12:00.000Z' }, }; @@ -241,8 +233,7 @@ describe('Historie', () => { describe('vorgang order', () => { it('assign user', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(0); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(0); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.ASSIGN_USER); @@ -253,8 +244,7 @@ describe('Historie', () => { describe('kommentar order', () => { it('create kommentar', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(1); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(1); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.CREATE_KOMMENTAR); @@ -268,8 +258,7 @@ describe('Historie', () => { }); it('edit kommentar', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(2); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(2); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.EDIT_KOMMENTAR); @@ -279,17 +268,13 @@ describe('Historie', () => { const kommentarItem: KommentarHistorieItemE2EComponent = historieItem.getKommentar(); contains(kommentarItem.getText(), editKommentarCommandBody.item.text); - contains( - kommentarItem.getAttachment(), - HistorieAttachmentE2E.MULTIPLE_TEXT.replace('{countAttachments}', '2'), - ); + contains(kommentarItem.getAttachment(), HistorieAttachmentE2E.MULTIPLE_TEXT.replace('{countAttachments}', '2')); }); }); describe('forward order', () => { it('forward vorgang', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(3); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(3); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.FORWARD_VORGANG); @@ -298,8 +283,7 @@ describe('Historie', () => { }); it('forward successful', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(4); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(4); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.FORWARD_SUCCESSFUL); @@ -308,8 +292,7 @@ describe('Historie', () => { }); it('forward failed', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(5); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(5); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.FORWARD_FAILED); @@ -320,52 +303,35 @@ describe('Historie', () => { describe('postfach nachricht order', () => { it('send postfach mail', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(6); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(6); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.SEND_POSTFACH_NACHRICHT); contains(historieItem.getUser(), userName); historieItem.getExpandButton().click(); - const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = - historieItem.getPostfachNachricht(); + const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = historieItem.getPostfachNachricht(); - contains( - postfachNachtichtItem.getPostfachNachrichtSubject(), - sendPostfachMailCommandBody.subject, - ); - contains( - postfachNachtichtItem.getPostfachNachrichtMailBody(), - sendPostfachMailCommandBody.mailBody, - ); + contains(postfachNachtichtItem.getPostfachNachrichtSubject(), sendPostfachMailCommandBody.subject); + contains(postfachNachtichtItem.getPostfachNachrichtMailBody(), sendPostfachMailCommandBody.mailBody); }); it('send postfach nachricht', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(7); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(7); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.SEND_POSTFACH_NACHRICHT); contains(historieItem.getUser(), userName); historieItem.getExpandButton().click(); - const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = - historieItem.getPostfachNachricht(); + const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = historieItem.getPostfachNachricht(); - contains( - postfachNachtichtItem.getPostfachNachrichtSubject(), - sendPostfachNachrichtCommandBody.subject, - ); - contains( - postfachNachtichtItem.getPostfachNachrichtMailBody(), - sendPostfachNachrichtCommandBody.mailBody, - ); + contains(postfachNachtichtItem.getPostfachNachrichtSubject(), sendPostfachNachrichtCommandBody.subject); + contains(postfachNachtichtItem.getPostfachNachrichtMailBody(), sendPostfachNachrichtCommandBody.mailBody); }); it('receive postfach nachricht', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(8); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(8); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.RECEIVE_POSTFACH_NACHRICHT); @@ -373,8 +339,7 @@ describe('Historie', () => { contains(historieItem.getSystemUser(), SYSTEM_USER_NAME); historieItem.getExpandButton().click(); - const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = - historieItem.getPostfachNachricht(); + const postfachNachtichtItem: PostfachNachrichtHistorieItemE2EComponent = historieItem.getPostfachNachricht(); contains( postfachNachtichtItem.getPostfachNachrichtSubject(), @@ -387,8 +352,7 @@ describe('Historie', () => { }); it('resend postfach nachricht', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(9); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(9); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.RESEND_POSTFACH_NACHRICHT); @@ -398,53 +362,39 @@ describe('Historie', () => { describe('wiedervorlage order', () => { it('create wiedervorlage', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(10); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(10); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.CREATE_WIEDERVORLAGE); contains(historieItem.getUser(), userName); historieItem.getExpandButton().click(); - const wiedervorlageItem: WiedervorlageHistorieItemE2EComponent = - historieItem.getWiedervorlage(); + const wiedervorlageItem: WiedervorlageHistorieItemE2EComponent = historieItem.getWiedervorlage(); contains(wiedervorlageItem.getStatus(), 'offen'); contains(wiedervorlageItem.getBetreff(), createWiedervorlageCommandBody.betreff); - contains( - wiedervorlageItem.getBeschreibung(), - createWiedervorlageCommandBody.beschreibung, - ); + contains(wiedervorlageItem.getBeschreibung(), createWiedervorlageCommandBody.beschreibung); contains(wiedervorlageItem.getAttachment(), HistorieAttachmentE2E.SINGLE_TEXT); }); it('edit wiedervorlage', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(11); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(11); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.EDIT_WIEDERVORLAGE); contains(historieItem.getUser(), userName); historieItem.getExpandButton().click(); - const wiedervorlageItem: WiedervorlageHistorieItemE2EComponent = - historieItem.getWiedervorlage(); + const wiedervorlageItem: WiedervorlageHistorieItemE2EComponent = historieItem.getWiedervorlage(); contains(wiedervorlageItem.getStatus(), 'geschlossen'); contains(wiedervorlageItem.getBetreff(), editWiedervorlageCommandBody.betreff); - contains( - wiedervorlageItem.getBeschreibung(), - editWiedervorlageCommandBody.beschreibung, - ); - contains( - wiedervorlageItem.getAttachment(), - HistorieAttachmentE2E.MULTIPLE_TEXT.replace('{countAttachments}', '2'), - ); + contains(wiedervorlageItem.getBeschreibung(), editWiedervorlageCommandBody.beschreibung); + contains(wiedervorlageItem.getAttachment(), HistorieAttachmentE2E.MULTIPLE_TEXT.replace('{countAttachments}', '2')); }); it('wiedervorlage erledigen', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(12); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(12); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_ERLEDIGEN); @@ -453,8 +403,7 @@ describe('Historie', () => { }); it('wiedervorlage wiedereroeffnen', () => { - const historieItem: VorgangFormularDatenHistorieItemE2EComponent = - vorgangDatenFormular.getHistorieItemByIndex(13); + const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieItemByIndex(13); exist(historieItem.getRoot()); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_WIEDEREROEFFNEN); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-xdomea/vorgang-xdomea-inhalte.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-xdomea/vorgang-xdomea-inhalte.cy.ts index ff177ddcff..9050a22745 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-xdomea/vorgang-xdomea-inhalte.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-xdomea/vorgang-xdomea-inhalte.cy.ts @@ -78,13 +78,14 @@ describe('check xDomea contents', () => { }; const assignUserCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.ASSIGN_USER, vorgangExportieren._id.$oid, vorgangExportieren._id.$oid), + ...buildCommand(objectIds[1], CommandOrderE2E.ASSIGN_USER, vorgangExportieren._id.$oid, vorgangExportieren._id.$oid), bodyObject: { assignedTo: getUserDorotheaId() }, finishedAt: { $date: '2024-06-20T07:25:30.000Z' }, }; const changeStatusCommand: CommandE2E = { ...buildCommand( + objectIds[2], CommandOrderE2E.VORGANG_WIEDEREROEFFNEN, vorgangExportieren._id.$oid, @@ -95,7 +96,7 @@ describe('check xDomea contents', () => { }; const setAktenzeichenCommand: CommandE2E = { - ...buildCommand(CommandOrderE2E.SET_AKTENZEICHEN, vorgangExportieren._id.$oid, vorgangExportieren._id.$oid), + ...buildCommand(objectIds[3], CommandOrderE2E.SET_AKTENZEICHEN, vorgangExportieren._id.$oid, vorgangExportieren._id.$oid), order: CommandOrderE2E.SET_AKTENZEICHEN, bodyObject: { aktenzeichen: 'AKT_ENZ_EIC_HEN1' }, finishedAt: { $date: '2024-06-19T07:25:30.000Z' }, diff --git a/alfa-client/apps/alfa-e2e/src/model/command.ts b/alfa-client/apps/alfa-e2e/src/model/command.ts index bdc72b43d4..1050041aa9 100644 --- a/alfa-client/apps/alfa-e2e/src/model/command.ts +++ b/alfa-client/apps/alfa-e2e/src/model/command.ts @@ -45,7 +45,7 @@ export enum CommandStatusE2E { } export class CommandE2E { - id: ObjectIdE2E; + _id: ObjectIdE2E; vorgangId: string; createdAt: DateE2E; createdBy: string; diff --git a/alfa-client/apps/alfa-e2e/src/support/command-util.ts b/alfa-client/apps/alfa-e2e/src/support/command-util.ts index f70f24389b..2ee84ad777 100644 --- a/alfa-client/apps/alfa-e2e/src/support/command-util.ts +++ b/alfa-client/apps/alfa-e2e/src/support/command-util.ts @@ -31,13 +31,10 @@ export function createCommand(): CommandE2E { return { ...commandFixture, createdBy: getUserSabineId() }; } -export function buildCommand( - order: CommandOrderE2E, - vorgangId: string, - relationId: string, -): CommandE2E { +export function buildCommand(id: string, order: CommandOrderE2E, vorgangId: string, relationId: string): CommandE2E { return { ...createCommand(), + _id: { $oid: id }, vorgangId, relationId, order, -- GitLab