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

Merge pull request 'features/OZG-2160' (#32) from features/OZG-2160 into master

parents 025c7c4c 0d2c3d65
No related branches found
No related tags found
No related merge requests found
Showing
with 175 additions and 29 deletions
export class AttachmentListE2EComponent {
constructor(private root: string) { }
public getRoot() {
return cy.getTestElement(this.root);
}
public getAttachment(fileName: string): AttachmentE2EItem {
return new AttachmentE2EItem(fileName);
}
public getAttachments() {
return this.getRoot().children();
}
}
class AttachmentE2EItem {
private readonly locatorDeleteButton: string = 'icon-button';
private readonly locatorDownloadButton: string = 'file-download-button';
constructor(private fileName: string) { }
public getRoot() {
return cy.getTestElement(this.fileName + '-file-item');
}
public delete(): void {
this.getRoot().findTestElementWithClass(this.locatorDeleteButton).click();
}
public download(): void {
this.getRoot().findTestElementWithClass(this.locatorDownloadButton).click();
}
}
\ No newline at end of file
import { AttachmentListE2EComponent } from './attachment-list.e2e.component';
export class AttachmentContainerE2EComponent {
private readonly locatorFileUploadInput: string = '-file-upload-input';
private readonly locatorAttachmentList: string = 'attachment-list';
private readonly attachmentList: AttachmentListE2EComponent = new AttachmentListE2EComponent(this.locatorAttachmentList);
public getUploadInput() {
return cy.getTestElement(this.locatorFileUploadInput);
}
public getAttachmentList(): AttachmentListE2EComponent {
return this.attachmentList;
}
public uploadFile(fileName: string): void {
this.getUploadInput().attachFile(fileName);
}
}
\ No newline at end of file
import { AttachmentContainerE2EComponent } from '../attachment/attachment.e2e.component';
export class PostfachMailFormularE2EComponent {
private readonly locatorEmpfaenger: string = 'postfach-empfaenger';
......@@ -12,6 +14,8 @@ export class PostfachMailFormularE2EComponent {
private readonly replyOption: ReplyOption = new ReplyOption();
private readonly attachmentContainer: AttachmentContainerE2EComponent = new AttachmentContainerE2EComponent();
public getEmpfaenger() {
return cy.getTestElement(this.locatorEmpfaenger);
}
......@@ -39,6 +43,11 @@ export class PostfachMailFormularE2EComponent {
public getReplyOption(): ReplyOption {
return this.replyOption;
}
public getAttachmentContainer(): AttachmentContainerE2EComponent {
return this.attachmentContainer;
}
}
export class ReplyOption {
......
......@@ -99,6 +99,10 @@ export class PostfachMailListItem {
return this.getRoot().getTestElement(this.locatorMailResendButton);
}
getAttachment(fileName: string): void {
return this.getRoot().getTestElement(`${fileName}-postfach-attachment`);
}
downloadAttachment(fileName: string): void {
this.getRoot().getTestElement(`${fileName}-postfach-attachment`).click();
}
......
export class SnackBarE2EComponent {
private readonly locatorMessage: string = 'message';
private readonly locatorCloseButton: string = 'close-button';
private readonly locatorRevokeButton: string = 'revoke-button';
private readonly locatorMessage: string = 'snackbar-message';
private readonly locatorCloseButton: string = 'snackbar-close-button';
private readonly locatorRevokeButton: string = 'snackbar-revoke-button';
constructor(private root: string) { }
public getRoot() {
return cy.getTestElement(this.root);
}
public getMessage() {
return cy.getTestElement(this.locatorMessage);
......
File added
......@@ -7,14 +7,18 @@ import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-lis
import { VorgangSubnavigationE2EComponent } from '../../../components/vorgang/vorgang-subnavigation';
import { EingangE2E, VorgangE2E } from '../../../model/vorgang';
import { PostfachMailItemE2E, PostfachNachrichtSnackbarMessageE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item';
import { MainPage } from '../../../page-objects/main.po';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po';
import { AttachmentContainerE2EComponent } from '../../../components/attachment/attachment.e2e.component';
import { AttachmentListE2EComponent } from '../../../components/attachment/attachment-list.e2e.component';
import { VorgangPage } from '../../../page-objects/vorgang.po';
import { dropCollections, wait } from '../../../support/cypress-helper';
import { dropCollections } from '../../../support/cypress-helper';
import { contains, exist, notBeVisible, notExist, visible } from '../../../support/cypress.util';
import { loginAsSabine } from '../../../support/user-util';
import { buildVorgangAttachedItem, createPostfachNachrichtReplyItem, initVorgangAttachedItem } from '../../../support/vorgang-attached-item-util';
import { buildVorgang, createVorgang, initVorgaenge, objectIds } from '../../../support/vorgang-util';
import { TEST_FILE, TEST_FILE_WITH_CONTENT, TEST_FILE_WITH_CONTENT_4_MB } from '../../../support/data.util';
import { uploadEmptyFile, uploadFile } from '../../../support/file-upload';
describe('PostfachMail', () => {
const mainPage: MainPage = new MainPage();
......@@ -26,6 +30,8 @@ describe('PostfachMail', () => {
const subnavigation: VorgangSubnavigationE2EComponent = vorgangPage.getSubnavigation();
const fixedDialog: FixedDialogE2EComponent = vorgangPage.getFixedDialog();
const postfachMailFormular: PostfachMailFormularE2EComponent = vorgangPage.getPostfachMailFormular();
const attachmentContainer: AttachmentContainerE2EComponent = postfachMailFormular.getAttachmentContainer();
const attachmentList: AttachmentListE2EComponent = attachmentContainer.getAttachmentList();
const postfachMailPage: PostfachMailPage = new PostfachMailPage();
......@@ -98,6 +104,7 @@ describe('PostfachMail', () => {
exist(postfachMailFormular.getBetreff());
exist(postfachMailFormular.getText());
exist(postfachMailFormular.getSendButton());
exist(postfachMailFormular.getAttachmentContainer().getUploadInput());
exist(postfachMailFormular.getReplyOption().getRoot());
})
......@@ -105,26 +112,26 @@ describe('PostfachMail', () => {
contains(postfachMailFormular.getEmpfaenger(), 'Max Testermann');
})
it('click on "X" should close Dialog', () => {
it('should close Dialog if click on "X"', () => {
fixedDialog.getCloseButton().click();
notExist(postfachMailFormular.getEmpfaenger());
})
it('click on icon button should open dialog', () => {
it('should open dialog click on icon button', () => {
subnavigation.getPostfachMailIconButton().click();
exist(postfachMailFormular.getEmpfaenger());
})
it('click on minimize should hide dialog content', () => {
it('should hide dialog content click on minimize', () => {
fixedDialog.getMinMaxButton().click();
notBeVisible(fixedDialog.getDialogContent());
exist(fixedDialog.getCloseButton());
})
it('click on maximize should show dialog content', () => {
it('should show dialog content click on maximize', () => {
fixedDialog.getMinMaxButton().click();
visible(fixedDialog.getDialogContent());
......@@ -133,13 +140,13 @@ describe('PostfachMail', () => {
describe('formular fields', () => {
it('show error on subject if send empty', () => {
it('should show error on subject if send empty', () => {
postfachMailFormular.getSendButton().click();
exist(postfachMailFormular.getBetreffError());
})
it('show error on text if send empty', () => {
it('should show error on text if send empty', () => {
postfachMailFormular.getSendButton().click();
exist(postfachMailFormular.getTextError());
......@@ -151,6 +158,43 @@ describe('PostfachMail', () => {
})
})
describe('attach files', () => {
it('should show empty attachment after uploading it', () => {
uploadEmptyFile(attachmentContainer.getUploadInput(), TEST_FILE)
exist(attachmentList.getAttachment(TEST_FILE).getRoot());
})
it('should show empty attachment and attachment with content after uploading it', () => {
uploadFile(postfachMailFormular.getAttachmentContainer().getUploadInput(), TEST_FILE_WITH_CONTENT);
exist(attachmentList.getAttachment(TEST_FILE).getRoot());
exist(attachmentList.getAttachment(TEST_FILE_WITH_CONTENT).getRoot());
})
it('should not show empty attachment after deleting it', () => {
attachmentList.getAttachment(TEST_FILE).delete();
notExist(attachmentList.getAttachment(TEST_FILE).getRoot());
})
});
describe('attach file > 3 MB', () => {
it('should show error snackbar', () => {
uploadFile(postfachMailFormular.getAttachmentContainer().getUploadInput(), TEST_FILE_WITH_CONTENT_4_MB);
contains(snackbar.getMessage(), PostfachNachrichtSnackbarMessageE2E.ATTACHMENT_TOO_BIG);
})
it('should close snackbar', () => {
snackbar.getCloseButton().click();
notExist(snackbar.getRoot());
})
})
describe('click on reply option button', () => {
it('should show reply options', () => {
......@@ -160,7 +204,7 @@ describe('PostfachMail', () => {
exist(postfachMailFormular.getReplyOption().getForbiddenOption());
})
it('change reply option to possible', () => {
it('should change reply option to possible', () => {
postfachMailFormular.getReplyOption().getPossibleOption().click();
})
})
......@@ -188,10 +232,37 @@ describe('PostfachMail', () => {
contains(postfachMailItem.getText(), postfachMailToSend.mailBody);
})
it('navigate back to list', () => {
vorgangPage.waitForSpinnerToDisappear();
})
describe('click on postfach mail item with attachment', () => {
it('should show postfach item list', () => {
const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem(postfachMailToSend.subject);
postfachMailItem.getRoot().click();
waitForSpinnerToDisappear();
exist(postfachMailPage.getRoot());
});
it('should contain mail item with attachment', () => {
const postfachListItem: PostfachMailListItem = postfachMailPage.getListItem(postfachMailToSend.subject);
exist(postfachListItem.getAttachment(TEST_FILE_WITH_CONTENT));
});
});
describe('click on back button', () => {
it('should navigate to vorgang detail', () => {
postfachMailPage.getSubnavigation().getBackButton().click();
waitForSpinnerToDisappear();
exist(vorgangPage.getVorgangDetailHeader().getRoot());
})
it('should navigate back to vorgang list', () => {
vorgangPage.getSubnavigation().clickBackButton();
waitForSpinnerToDisappear();
exist(vorgangList.getRoot());
})
......@@ -201,8 +272,8 @@ describe('PostfachMail', () => {
describe('navigate to vorgang detail', () => {
it('should open vorgang detail', () => {
wait(500);
vorgangList.getListItem(vorgangWithoutPostfach.name).getRoot().click();
waitForSpinnerToDisappear();
exist(vorgangPage.getVorgangDetailHeader().getRoot());
})
......@@ -219,10 +290,9 @@ describe('PostfachMail', () => {
contains(postfachMailContainer.getNoPostfachText(), 'Dieser Vorgang ist nicht mit einem Postfach verknüpft.');
})
it('navigate back to list', () => {
vorgangPage.waitForSpinnerToDisappear();
it('should navigate back to list', () => {
vorgangPage.getSubnavigation().clickBackButton();
waitForSpinnerToDisappear();
exist(vorgangList.getRoot());
})
......@@ -231,12 +301,10 @@ describe('PostfachMail', () => {
describe('navigate to vorgang detail', () => {
it('should open vorgang detail', () => {
wait(500);
vorgangList.getListItem(vorgangWithReply.name).getRoot().click();
waitForSpinnerToDisappear();
exist(vorgangPage.getVorgangDetailHeader().getRoot());
vorgangPage.waitForSpinnerToDisappear();
})
it('should show postfach mail button', () => {
......
......@@ -46,5 +46,6 @@ export enum PostfachNachrichtMessageCodeMessagesE2E {
}
export enum PostfachNachrichtSnackbarMessageE2E {
SEND_SUCCESSFUL = 'Die Nachricht wurde erfolgreich versendet.'
SEND_SUCCESSFUL = 'Die Nachricht wurde erfolgreich versendet.',
ATTACHMENT_TOO_BIG = 'Der Anhang wurde nicht hinzugefügt.'
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ export const FORWARDING_TEST_EMAIL: string = 'ea@ozg-sh.de';
export const TEST_FILE_WITH_CONTENT: string = 'upload-me.withContent';
export const TEST_FILE: string = 'upload-me.withoutContent';
export const TEST_FILE_WITH_CONTENT_4_MB: string = 'upload-me.withContent4MB';
export const ORGANISATIONSEINHEITEN_ID_FOR_KORDNER = '10363455';
export const ORGANISATIONSEINHEITEN_ID_FOR_KFINDER = '9030229';
......
<span data-test-id="message" class="message">{{ message }}</span>
<span data-test-id="snackbar-message" class="message">{{ message }}</span>
<button mat-icon-button (click)="close()" data-test-id="close-button">
<button mat-icon-button (click)="close()" data-test-id="snackbar-close-button">
<mat-icon data-test-class="icon">clear</mat-icon>
</button>
\ No newline at end of file
<span data-test-id="message">{{ message }}</span>
<span data-test-id="snackbar-message">{{ message }}</span>
<button *ngIf="showRevokeButton()" data-test-id="revoke-button"
<button *ngIf="showRevokeButton()" data-test-id="snackbar-revoke-button"
mat-button
color="primary"
(click)="revoke()">
Rückgängig
</button>
<button mat-icon-button (click)="close()" data-test-id="close-button">
<button mat-icon-button (click)="close()" data-test-id="snackbar-close-button">
<mat-icon data-test-class="icon">clear</mat-icon>
</button>
\ No newline at end of file
......@@ -14,7 +14,7 @@ describe('SnackbarInfoComponent', () => {
const snackBarData: SnackBarData = { message: 'Message', commandResource: createCommandResource() };
const snackBarRef = { ...mock(MatSnackBarRef), dissmis: jest.fn(), dismissWithAction: jest.fn() };
const revokeButton: string = '[data-test-id="revoke-button"]';
const revokeButton: string = '[data-test-id="snackbar-revoke-button"]';
beforeEach(async () => {
await TestBed.configureTestingModule({
......
......@@ -13,7 +13,7 @@ import { FormControlEditorAbstractComponent } from '../formcontrol-editor.abstra
viewProviders: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
})
export class FileUploadEditorComponent extends FormControlEditorAbstractComponent implements OnInit {
@Input() label: string;
@Input() label: string = '';
@Input() parentFormArrayName: string;
@Input() accept: string = '*/*';
@Input() uploadInProgress: StateResource<any>;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment