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

Download Prüfung für Vorgang Main Page und Nachrichten Details

parent 588277c5
Branches
Tags
No related merge requests found
...@@ -36,12 +36,14 @@ import { buildVorgang, createHasNewPostfachNachrichtClientAttribute, createHasPo ...@@ -36,12 +36,14 @@ import { buildVorgang, createHasNewPostfachNachrichtClientAttribute, createHasPo
import { PostfachMailItemE2E, PostfachNachrichtSnackbarMessageE2E, VorgangAttachedItemClientE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item'; 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 { 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', () => { describe('Postfach Nachrichten', () => {
const vorgangList: VorgangListE2EComponent = new MainPage().getVorgangList(); const vorgangList: VorgangListE2EComponent = new MainPage().getVorgangList();
const vorgangPage: VorgangPage = new VorgangPage(); const vorgangPage: VorgangPage = new VorgangPage();
const postfachMailContainer: PostfachMailE2EComponent = vorgangPage.getPostfachMailcontainer(); const postfachMailContainer: PostfachMailE2EComponent = vorgangPage.getPostfachMailcontainer();
const postfachMailPage: PostfachMailPage = new PostfachMailPage();
const clientAttributes: ClientAttributesE2E = { const clientAttributes: ClientAttributesE2E = {
[VorgangAttachedItemClientE2E.KOP_NACHRICHTEN_MANAGER]: { [VorgangAttachedItemClientE2E.KOP_NACHRICHTEN_MANAGER]: {
...@@ -70,16 +72,41 @@ describe('Postfach Nachrichten', () => { ...@@ -70,16 +72,41 @@ describe('Postfach Nachrichten', () => {
dropCollections(); dropCollections();
}) })
describe('download mails as pdf button', () => { describe('navigate to vorgangDetail', () => {
beforeEach(() => {
interceptWithResponse(HttpMethodE2E.GET, '*/vorgangs/*', (req) => modifyResponse(req));
})
function modifyResponse(req: CyHttpMessages.IncomingHttpRequest): void {
req.reply(res => res.send(removeLinkFromResource(res.body, LinkRelE2E.POSTFACH_NACHRICHTEN)));
}
it('navigate to vorgangDetail', () => {
vorgangList.getListItem(vorgang.name).getRoot().click();
waitForSpinnerToDisappear();
exist(vorgangPage.getVorgangDetailHeader().getRoot());
})
it('should hide postfach nachrichten area if no postfach is configured', () => {
notExist(vorgangPage.getPostfachMailcontainer().getRoot());
})
})
describe('download nachrichten as pdf', () => {
describe('by download button on vorgang main page', () => {
it('should be visible as icon button', () => { it('should be visible as icon button', () => {
vorgangPage.getSubnavigation().getBackButton().click();
vorgangList.getListItem(vorgangWithReply.name).getRoot().click(); vorgangList.getListItem(vorgangWithReply.name).getRoot().click();
waitForSpinnerToDisappear(); waitForSpinnerToDisappear();
exist(postfachMailContainer.getDownloadButtonWithLabel()); exist(postfachMailContainer.getDownloadButtonWithLabel());
}) })
it('should have 1 file in download folder after download', () => { it('should have 1 file in download folder after click on download', () => {
postfachMailContainer.getDownloadButtonWithLabel().click(); postfachMailContainer.getDownloadButtonWithLabel().click();
waitForSpinnerToDisappear(); waitForSpinnerToDisappear();
...@@ -88,28 +115,30 @@ describe('Postfach Nachrichten', () => { ...@@ -88,28 +115,30 @@ describe('Postfach Nachrichten', () => {
deleteDownloadFolder(); deleteDownloadFolder();
}); });
}) })
}) })
describe('navigate to vorgangDetail', () => { describe('by download button on nachrichten details page', () => {
beforeEach(() => { it ('should show an overview of all nachrichten after clicking on nachricht', () => {
interceptWithResponse(HttpMethodE2E.GET, '*/vorgangs/*', (req) => modifyResponse(req)); postfachMailContainer.getList().click();
waitForSpinnerToDisappear();
exist(postfachMailPage.getRoot());
}) })
function modifyResponse(req: CyHttpMessages.IncomingHttpRequest): void { it ('should exist a pdf download button', () => {
req.reply(res => res.send(removeLinkFromResource(res.body, LinkRelE2E.POSTFACH_NACHRICHTEN))); exist(postfachMailPage.getDownloadButton());
} })
it('navigate to vorgangDetail', () => { it('should have 1 file in download folder after click on download', () => {
vorgangList.getListItem(vorgang.name).getRoot().click(); postfachMailPage.getDownloadButton().click();
waitForSpinnerToDisappear(); waitForSpinnerToDisappear();
exist(vorgangPage.getVorgangDetailHeader().getRoot()); countDownloadFiles().then((count) => {
expect(count).to.eq(1);
deleteDownloadFolder();
});
}) })
it('should hide postfach nachrichten area if no postfach is configured', () => {
notExist(vorgangPage.getPostfachMailcontainer().getRoot());
}) })
}) })
}) })
\ No newline at end of file
...@@ -27,13 +27,14 @@ import { PostfachMailListItem } from '../components/postfach/postfach-mail.e2e.c ...@@ -27,13 +27,14 @@ import { PostfachMailListItem } from '../components/postfach/postfach-mail.e2e.c
export class PostfachMailPage { export class PostfachMailPage {
private readonly locatorBreadcrump: string = 'postfach-breadcrump'; private readonly breadcrump: string = 'postfach-breadcrump';
private readonly locatorRoot: string = 'postfach-mail-list'; private readonly root: string = 'postfach-mail-list';
private readonly downloadButton: string = 'postfach-pdf-export-button';
private readonly subnavigation: PostfachMailSubnavigation = new PostfachMailSubnavigation(); private readonly subnavigation: PostfachMailSubnavigation = new PostfachMailSubnavigation();
getRoot() { getRoot() {
return cy.getTestElement(this.locatorRoot); return cy.getTestElement(this.root);
} }
getSubnavigation(): PostfachMailSubnavigation { getSubnavigation(): PostfachMailSubnavigation {
...@@ -41,10 +42,14 @@ export class PostfachMailPage { ...@@ -41,10 +42,14 @@ export class PostfachMailPage {
} }
getBreadcrump() { getBreadcrump() {
return cy.getTestElement(this.locatorBreadcrump); return cy.getTestElement(this.breadcrump);
} }
getListItem(subject: string): PostfachMailListItem { getListItem(subject: string): PostfachMailListItem {
return new PostfachMailListItem(subject); return new PostfachMailListItem(subject);
} }
getDownloadButton() {
return cy.getTestElement(this.downloadButton);
}
} }
\ No newline at end of file
import { rmdir } from 'fs'; import { rmdir } from 'fs';
import { Long, MongoClient, ObjectId } from 'mongodb'; import { Long, MongoClient, ObjectId } from 'mongodb';
const fs = require('fs');
const Binary = require('mongodb').Binary; const Binary = require('mongodb').Binary;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment