diff --git a/goofy-client/apps/goofy-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts b/goofy-client/apps/goofy-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts index cff401cae73b38d69d34c5c8c8394c55b97d1f90..5c011fa59fb82f9ce613e582b2fe4325d8764526 100644 --- a/goofy-client/apps/goofy-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts +++ b/goofy-client/apps/goofy-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts @@ -35,13 +35,15 @@ import { loginAsSabine } from '../../../support/user-util'; import { buildVorgang, createHasNewPostfachNachrichtClientAttribute, createHasPostfachNachrichtClientAttribute, createVorgang, initVorgaenge, objectIds } from '../../../support/vorgang-util'; import { PostfachMailItemE2E, PostfachNachrichtSnackbarMessageE2E, VorgangAttachedItemClientE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item'; import { createPostfachNachrichtAttachedItem, createPostfachNachrichtReplyItem, initVorgangAttachedItem } from 'apps/goofy-e2e/src/support/vorgang-attached-item-util'; -import { PostfachMailE2EComponent } from 'apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component'; +import { PostfachMailE2EComponent} from 'apps/goofy-e2e/src/components/postfach/postfach-mail.e2e.component'; +import { PostfachMailPage } from 'apps/goofy-e2e/src/page-objects/postfach-mail.component.po'; describe('Postfach Nachrichten', () => { const vorgangList: VorgangListE2EComponent = new MainPage().getVorgangList(); const vorgangPage: VorgangPage = new VorgangPage(); const postfachMailContainer: PostfachMailE2EComponent = vorgangPage.getPostfachMailcontainer(); + const postfachMailPage: PostfachMailPage = new PostfachMailPage(); const clientAttributes: ClientAttributesE2E = { [VorgangAttachedItemClientE2E.KOP_NACHRICHTEN_MANAGER]: { @@ -70,27 +72,6 @@ describe('Postfach Nachrichten', () => { dropCollections(); }) - describe('download mails as pdf button', () => { - - it('should be visible as icon button', () => { - vorgangList.getListItem(vorgangWithReply.name).getRoot().click(); - waitForSpinnerToDisappear(); - - exist(postfachMailContainer.getDownloadButtonWithLabel()); - }) - - it('should have 1 file in download folder after download', () => { - postfachMailContainer.getDownloadButtonWithLabel().click(); - waitForSpinnerToDisappear(); - - countDownloadFiles().then((count) => { - expect(count).to.eq(1); - deleteDownloadFolder(); - }); - }) - - }) - describe('navigate to vorgangDetail', () => { beforeEach(() => { @@ -112,4 +93,52 @@ describe('Postfach Nachrichten', () => { notExist(vorgangPage.getPostfachMailcontainer().getRoot()); }) }) + + describe('download nachrichten as pdf', () => { + + describe('by download button on vorgang main page', () => { + + it('should be visible as icon button', () => { + vorgangPage.getSubnavigation().getBackButton().click(); + vorgangList.getListItem(vorgangWithReply.name).getRoot().click(); + waitForSpinnerToDisappear(); + + exist(postfachMailContainer.getDownloadButtonWithLabel()); + }) + + it('should have 1 file in download folder after click on download', () => { + postfachMailContainer.getDownloadButtonWithLabel().click(); + waitForSpinnerToDisappear(); + + countDownloadFiles().then((count) => { + expect(count).to.eq(1); + deleteDownloadFolder(); + }); + }) + }) + + describe('by download button on nachrichten details page', () => { + + it ('should show an overview of all nachrichten after clicking on nachricht', () => { + postfachMailContainer.getList().click(); + waitForSpinnerToDisappear(); + exist(postfachMailPage.getRoot()); + }) + + it ('should exist a pdf download button', () => { + exist(postfachMailPage.getDownloadButton()); + }) + + it('should have 1 file in download folder after click on download', () => { + postfachMailPage.getDownloadButton().click(); + waitForSpinnerToDisappear(); + + countDownloadFiles().then((count) => { + expect(count).to.eq(1); + deleteDownloadFolder(); + }); + }) + }) + + }) }) \ No newline at end of file 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 713082709338690a9594492a2b4cb125d1981078..a7d10ebb4e964c7385f8371e1f0ee99f62890ff9 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 @@ -27,13 +27,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 breadcrump: string = 'postfach-breadcrump'; + private readonly root: string = 'postfach-mail-list'; + private readonly downloadButton: string = 'postfach-pdf-export-button'; private readonly subnavigation: PostfachMailSubnavigation = new PostfachMailSubnavigation(); getRoot() { - return cy.getTestElement(this.locatorRoot); + return cy.getTestElement(this.root); } getSubnavigation(): PostfachMailSubnavigation { @@ -41,10 +42,14 @@ export class PostfachMailPage { } getBreadcrump() { - return cy.getTestElement(this.locatorBreadcrump); + return cy.getTestElement(this.breadcrump); } getListItem(subject: string): PostfachMailListItem { return new PostfachMailListItem(subject); } + + getDownloadButton() { + return cy.getTestElement(this.downloadButton); + } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/support/cypress-tasks.ts b/goofy-client/apps/goofy-e2e/src/support/cypress-tasks.ts index d92b9e80d3c05c57f3e62671449e84d4ecd40f5b..b8a1bac27dbf39c722b3c2e268d4ef58780c6e54 100644 --- a/goofy-client/apps/goofy-e2e/src/support/cypress-tasks.ts +++ b/goofy-client/apps/goofy-e2e/src/support/cypress-tasks.ts @@ -1,5 +1,6 @@ import { rmdir } from 'fs'; import { Long, MongoClient, ObjectId } from 'mongodb'; +const fs = require('fs'); const Binary = require('mongodb').Binary;