diff --git a/goofy-client/apps/goofy-e2e/src/components/anhang/anhang-list.e2e.component.ts b/goofy-client/apps/goofy-e2e/src/components/anhang/anhang-list.e2e.component.ts index 285c659faaf9d8a70e4ba41f626f6156a4cd329d..c5f33c2afe25b8d4983d0f0b48df4910187c3c48 100644 --- a/goofy-client/apps/goofy-e2e/src/components/anhang/anhang-list.e2e.component.ts +++ b/goofy-client/apps/goofy-e2e/src/components/anhang/anhang-list.e2e.component.ts @@ -4,11 +4,7 @@ export class AnhangE2EComponent { private readonly locatorAnhaenge: string = 'anhaenge'; private readonly locatorEmptyAnhaenge: string = 'empty-anhaenge'; - private spinnerComponent: SpinnerE2EComponent; - - constructor() { - this.spinnerComponent = new SpinnerE2EComponent(); - } + private spinnerComponent: SpinnerE2EComponent = new SpinnerE2EComponent() public getEmptyAnhaenge() { return cy.getTestElement(this.locatorEmptyAnhaenge); @@ -22,7 +18,7 @@ export class AnhangE2EComponent { return cy.getTestElement(`${name}-file-item`); } - public waitForDownloadSpinnerToDisappear(name: string) { + public waitForDownloadSpinnerToDisappear(name: string): void { this.spinnerComponent.waitToDisappear(this.getAnhang(name)); } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component.ts b/goofy-client/apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component.ts index decdfa8eb293c5640c1c91e5e7c0ca0d5b6a3265..b657d267fa741a9eac0e9a9fa6b0c2b5bd8d95a5 100644 --- a/goofy-client/apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component.ts +++ b/goofy-client/apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component.ts @@ -5,6 +5,8 @@ export class PostfachMailE2EComponent { private readonly locatorButton: string = 'send-mail-button'; private readonly locatorList: string = 'postfach-mail-list'; private readonly locatorNoPostfachText: string = 'no-postfach-text'; + private readonly locatorAttachments: string = 'postfach-nachricht-attachments-container'; + private readonly locatorRoot: string; constructor(root: string) { @@ -27,15 +29,17 @@ export class PostfachMailE2EComponent { return cy.getTestElement(this.locatorNoPostfachText); } - public getListItem(subject: string) { + public getListItem(subject: string): PostfachMailListItem { return new PostfachMailListItem(subject); } + + public getAttachments() { + return cy.getTestElement(this.locatorAttachments); + } } export class PostfachMailListItem { - private locatorRoot: string; - private readonly locatorUserProfile: string = 'user-profile-in-postfach-mail'; private readonly locatorCreatedAt: string = 'mail-created-at'; private readonly locatorSubject: string = 'mail-subject'; @@ -47,6 +51,7 @@ export class PostfachMailListItem { private readonly locatorMailSendErrorIcon: string = 'mail-send-error-icon'; private readonly locatorMailResendButton: string = 'mail-resend-button'; + private locatorRoot: string; constructor(subject: string) { this.locatorRoot = replaceAllWhitespaces(subject, '_') + '-item'; @@ -76,7 +81,6 @@ export class PostfachMailListItem { return this.getRoot().getTestElement(this.locatorReplyIcon); } - getSentAt() { return this.getRoot().getTestElement(this.locatorSentAt); } @@ -92,4 +96,8 @@ export class PostfachMailListItem { getResendButton() { return this.getRoot().getTestElement(this.locatorMailResendButton); } + + downloadAttachment(fileName: string): void { + this.getRoot().getTestElement(`${fileName}-postfach-attachment`).click(); + } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/integration/postfach-mail/postfach-nachricht-attachments.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/postfach-mail/postfach-nachricht-attachments.e2e-spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7df543bdc7b330a1073c3087818306d8dde7dae5 --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/integration/postfach-mail/postfach-nachricht-attachments.e2e-spec.ts @@ -0,0 +1,103 @@ +import { PostfachMailSubnavigation } from '../../components/postfach/postfach-mail-subnavigation.e2e.component'; +import { PostfachMailE2EComponent, PostfachMailListItem } from '../../components/postfach/postfach-mail.e2e.component'; +import { VorgangListE2EComponent } from '../../components/vorgang/vorgang-list.e2e.component'; +import { VorgangSubnavigationE2EComponent } from '../../components/vorgang/vorgang-subnavigation'; +import { BinaryFileFieldE2E, BinaryFilePersistanceWrapperE2E } from '../../model/binary-file'; +import { VorgangE2E } from '../../model/vorgang'; +import { PostfachMailItemE2E, VorgangAttachedItemE2E } from '../../model/vorgang-attached-item'; +import { MainPage } from '../../page-objects/main.po'; +import { PostfachMailPage } from '../../page-objects/postfach-mail.component.po'; +import { VorgangPage } from '../../page-objects/vorgang.po'; +import { createBinaryFile, initBinaryFiles } from '../../support/binary-file-util'; +import { readFileFromDownloads } from '../../support/cypress-helper'; +import { exist } from '../../support/cypress.util'; +import { loginAsBeate } from '../../support/user-util'; +import { createPostfachNachrichtReplyItem, createVorgangAttachedItem, initVorgangAttachedItem } from '../../support/vorgang-attached-item-util'; +import { createVorgang, initVorgang } from '../../support/vorgang-util'; + +describe('Postfach Nachrichten', () => { + const mainPage: MainPage = new MainPage(); + const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList(); + + const vorgangPage: VorgangPage = new VorgangPage(); + const postfachMail: PostfachMailE2EComponent = vorgangPage.getPostfachMailcontainer(); + const subnavigation: VorgangSubnavigationE2EComponent = vorgangPage.getSubnavigation(); + + const postfachPage: PostfachMailPage = new PostfachMailPage(); + const postfachSubnavigation: PostfachMailSubnavigation = postfachPage.getSubnavigation(); + + const vorgang: VorgangE2E = createVorgang(); + + const binaryFileWithContent: BinaryFilePersistanceWrapperE2E = { ...createBinaryFile(), field: BinaryFileFieldE2E.POSTFACH_NACHRICHT_ATTACHMENT }; + + const postfachMailReply: PostfachMailItemE2E = { ...createPostfachNachrichtReplyItem(), attachments: ['60d9fa33290e586b59a6b311'] }; + const vorgangAttachedItem: VorgangAttachedItemE2E = { ...createVorgangAttachedItem(), item: postfachMailReply }; + + before(() => { + initBinaryFiles([binaryFileWithContent]); + initVorgang(vorgang); + + initVorgangAttachedItem([vorgangAttachedItem]); + + loginAsBeate(); + + exist(vorgangList.getRoot()); + }) + + describe('download attachment from vorgang detail', () => { + + it('should show vorgang on navigation', () => { + vorgangList.getListItem(vorgang.name).getRoot().click(); + + exist(vorgangPage.getVorgangDetailHeader().getRoot()); + }) + + it('should show postfach nachrichten attachments', () => { + exist(vorgangPage.getPostfachMailcontainer().getAttachments()); + }) + + it('should download attachment', () => { + postfachMail.getListItem(postfachMailReply.subject).downloadAttachment(binaryFileWithContent.file.name); + vorgangPage.waitForSpinnerToDisappear(); + + exist(readFileFromDownloads(binaryFileWithContent.file.name)); + }) + }) + + describe('download attachment from postfach nachrichten page', () => { + + const listItem: PostfachMailListItem = postfachPage.getListItem(postfachMailReply.subject); + + it('should navigate on click on subject', () => { + postfachMail.getListItem(postfachMailReply.subject).getRoot().click(); + + exist(postfachPage.getRoot()); + }) + + it('should show item in list', () => { + exist(listItem.getRoot()); + }) + + it('should download attachment', () => { + listItem.downloadAttachment(binaryFileWithContent.file.name); + vorgangPage.waitForSpinnerToDisappear(); + + exist(readFileFromDownloads(binaryFileWithContent.file.name)); + }) + }) + + describe('navigate back', () => { + + it('should show vorgang detail', () => { + postfachSubnavigation.getBackButton().click(); + + exist(vorgangPage.getVorgangDetailHeader().getRoot()); + }) + + it('should show vorgang list', () => { + subnavigation.clickBackButton(); + + exist(vorgangList.getRoot()); + }) + }) +}) \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/model/binary-file.ts b/goofy-client/apps/goofy-e2e/src/model/binary-file.ts index b96c6ad32320e7f1187444d3eeb16ca4699d392f..77f948262a762463fe31f1019f1c2d4539ebed47 100644 --- a/goofy-client/apps/goofy-e2e/src/model/binary-file.ts +++ b/goofy-client/apps/goofy-e2e/src/model/binary-file.ts @@ -9,8 +9,9 @@ export class BinaryFilePersistanceWrapperE2E { file: FileDataE2E; } -export enum FieldE2E { - WIEDERVORLAGE_ATTACHMENT = 'wiedervorlageAttachment' +export enum BinaryFileFieldE2E { + WIEDERVORLAGE_ATTACHMENT = 'wiedervorlageAttachment', + POSTFACH_NACHRICHT_ATTACHMENT = 'PostfachNachrichtAttachment' } export class FileDataE2E { diff --git a/goofy-client/apps/goofy-e2e/src/model/vorgang-attached-item.ts b/goofy-client/apps/goofy-e2e/src/model/vorgang-attached-item.ts index e4561bc76d38001db49a586c5070b2894d05c6af..d596d3aaed7b31fdff4d4045c73f084ae13570a8 100644 --- a/goofy-client/apps/goofy-e2e/src/model/vorgang-attached-item.ts +++ b/goofy-client/apps/goofy-e2e/src/model/vorgang-attached-item.ts @@ -22,6 +22,7 @@ export class PostfachMailItemE2E { sentAt: Date | string; sentSuccessful: boolean; messageCode: PostfachNachrichtMessageCodeE2E; + attachments: string[]; } export enum ReplyOptionE2E { diff --git a/goofy-client/apps/goofy-e2e/src/page-objects/postfach-mail.component.po.ts b/goofy-client/apps/goofy-e2e/src/page-objects/postfach-mail.component.po.ts index f2f7d4ad69616d83daf5d8218b80cc5001f89b5b..3dfc074932f6a1086f599cfa9d98f82e2062be86 100644 --- a/goofy-client/apps/goofy-e2e/src/page-objects/postfach-mail.component.po.ts +++ b/goofy-client/apps/goofy-e2e/src/page-objects/postfach-mail.component.po.ts @@ -4,9 +4,14 @@ import { PostfachMailListItem } from '../components/postfach/postfach-mail.e2e.c export class PostfachMailPage { private readonly locatorBreadcrump: string = 'postfach-breadcrump'; + private readonly locatorRoot: string = 'postfach-mail-list'; private readonly subnavigation: PostfachMailSubnavigation = new PostfachMailSubnavigation(); + getRoot() { + return cy.getTestElement(this.locatorRoot); + } + getSubnavigation(): PostfachMailSubnavigation { return this.subnavigation; } diff --git a/goofy-client/apps/goofy-e2e/src/support/linkrels.ts b/goofy-client/apps/goofy-e2e/src/support/linkrels.ts index 564df157e4f856a613a92ad8135883a8ef48c149..5c5d40ba775c311d6645b61d5697db202dd2cb71 100644 --- a/goofy-client/apps/goofy-e2e/src/support/linkrels.ts +++ b/goofy-client/apps/goofy-e2e/src/support/linkrels.ts @@ -1,3 +1,4 @@ export enum LinkRelE2E { - POSTFACH_NACHRICHTEN = 'postfachMails' //TODO rename + POSTFACH_NACHRICHTEN = 'postfachMails', //TODO rename + POSTFACH_NACHRICHTEN_ATTACHMENTS = 'attachments' } \ No newline at end of file