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

Merge pull request 'OZG-4378-e2e-test-for-pdf-download' (#320) from...

Merge pull request 'OZG-4378-e2e-test-for-pdf-download' (#320) from OZG-4378-e2e-test-for-pdf-download into master

Reviewed-on: https://git.ozg-sh.de/mgm/goofy/pulls/320


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents ef82f497 a5a84d12
Branches
Tags
No related merge requests found
......@@ -27,11 +27,13 @@ import { UserProfileE2EComponent } from '../user-profile/user-profile.component.
export class PostfachMailE2EComponent {
private readonly locatorCreateMailButtonWithText: string = 'create-mail-button-with-text';
private readonly locatorCreateMailButtonWithoutText: string = 'create-mail-button-without-text';
private readonly locatorList: string = 'postfach-mail-list';
private readonly locatorNoPostfachText: string = 'no-postfach-text';
private readonly locatorAttachments: string = 'postfach-nachricht-attachments-container';
private readonly createMailButtonWithText: string = 'create-mail-button-with-text';
private readonly createMailButtonWithoutText: string = 'create-mail-button-without-text';
private readonly list: string = 'postfach-mail-list';
private readonly noPostfachText: string = 'no-postfach-text';
private readonly attachments: string = 'postfach-nachricht-attachments-container';
private readonly downloadButtonWithIcon: string = 'postfach-pdf-export-button';
private readonly downloadButtonWithLabel: string = 'postfach-pdf-export-label-button';
private readonly locatorRoot: string = 'postfach-nachrichten-container-in-vorgang';
......@@ -40,19 +42,19 @@ export class PostfachMailE2EComponent {
}
public getCreateButtonWithText() {
return cy.getTestElement(this.locatorCreateMailButtonWithText);
return cy.getTestElement(this.createMailButtonWithText);
}
public getCreateButtonWithoutText() {
return cy.getTestElement(this.locatorCreateMailButtonWithoutText);
return cy.getTestElement(this.createMailButtonWithoutText);
}
public getList() {
return cy.getTestElement(this.locatorList);
return cy.getTestElement(this.list);
}
public getNoPostfachText() {
return cy.getTestElement(this.locatorNoPostfachText);
return cy.getTestElement(this.noPostfachText);
}
public getListItem(subject: string): PostfachMailListItem {
......@@ -60,7 +62,15 @@ export class PostfachMailE2EComponent {
}
public getAttachments() {
return cy.getTestElement(this.locatorAttachments);
return cy.getTestElement(this.attachments);
}
public getDownloadButtonWithIcon() {
return cy.getTestElement(this.downloadButtonWithIcon);
}
public getDownloadButtonWithLabel() {
return cy.getTestElement(this.downloadButtonWithLabel);
}
}
......
......@@ -27,21 +27,33 @@ import { HttpMethodE2E } from '../../../model/util';
import { VorgangE2E } from '../../../model/vorgang';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { VorgangPage } from '../../../page-objects/vorgang.po';
import { dropCollections, interceptWithResponse } from '../../../support/cypress-helper';
import { dropCollections, 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';
import { loginAsSabine } from '../../../support/user-util';
import { createVorgang, initVorgang } from '../../../support/vorgang-util';
import { buildVorgang, createVorgang, initVorgaenge, objectIds } from '../../../support/vorgang-util';
import { PostfachMailItemE2E, 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 { 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 vorgang: VorgangE2E = createVorgang();
const vorgangWithReply: VorgangE2E = { ...buildVorgang(objectIds[0], 'VorgangWithReply') };
const postfachMailReply: PostfachMailItemE2E = createPostfachNachrichtReplyItem();
const postfachNachrichtAttachedItem: VorgangAttachedItemE2E = { ...createPostfachNachrichtAttachedItem(objectIds[1], objectIds[0]), item: postfachMailReply };
before(() => {
initVorgang(vorgang);
initVorgaenge([vorgang, vorgangWithReply]);
initVorgangAttachedItem([postfachNachrichtAttachedItem]);
loginAsSabine();
......@@ -53,7 +65,7 @@ describe('Postfach Nachrichten', () => {
dropCollections();
})
describe('navigate to vorganDetail', () => {
describe('navigate to vorgangDetail', () => {
beforeEach(() => {
interceptWithResponse(HttpMethodE2E.GET, '*/vorgangs/*', (req) => modifyResponse(req));
......@@ -74,4 +86,53 @@ 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
......@@ -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
import { rmdir } from 'fs';
import { Long, MongoClient, ObjectId } from 'mongodb';
const fs = require('fs');
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