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

OZG-1194 OZG-1653 e2e

parent 18c3065c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
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
......@@ -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 {
......
......@@ -22,6 +22,7 @@ export class PostfachMailItemE2E {
sentAt: Date | string;
sentSuccessful: boolean;
messageCode: PostfachNachrichtMessageCodeE2E;
attachments: string[];
}
export enum ReplyOptionE2E {
......
......@@ -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;
}
......
export enum LinkRelE2E {
POSTFACH_NACHRICHTEN = 'postfachMails' //TODO rename
POSTFACH_NACHRICHTEN = 'postfachMails', //TODO rename
POSTFACH_NACHRICHTEN_ATTACHMENTS = 'attachments'
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment