Newer
Older
* Copyright (C) 2023 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { convertToDataTestId } from '../../support/tech.util';
export class AttachmentContainerE2EComponent {
private readonly locatorFileUploadInput: string = '-file-upload-input';
private readonly attachmentList: AttachmentListE2EComponent = new AttachmentListE2EComponent();
public getList(): AttachmentListE2EComponent {
return this.attachmentList;
}
return cy.getTestElementContaining(this.locatorFileUploadInput);
export class AttachmentListE2EComponent {
private readonly locatorRoot: string = 'file-list';
private readonly downloadAttachmentsButton: string = 'download-archive-file-button';
public getRoot() {
return cy.getTestElement(this.locatorRoot);
}
public getItem(fileName: string): AttachmentE2EItem {
return new AttachmentE2EItem(fileName);
}
public getLoadingOrErrorItem(fileName: string): LoadingErrorAttachmentE2EItem {
return new LoadingErrorAttachmentE2EItem(fileName);
}
public getDownloadAttachmentsButton(): Cypress.Chainable<JQuery<HTMLElement>> {
return this.getRoot().findTestElementWithClass(this.downloadAttachmentsButton);
public downloadAttachments(): Cypress.Chainable<any> {
return this.getDownloadAttachmentsButton().click();
}
class AttachmentE2EItem {
private readonly locatorDeleteButton: string = 'delete-file-button';
private readonly locatorDownloadButton: string = 'download-file-button';
constructor(private fileName: string) {
this.locatorRoot = convertToDataTestId(this.fileName) + '-file-item';
}
public getRoot() {
return cy.getTestElement(this.locatorRoot);
}
public getDeleteButton() {
return this.getRoot().findTestElementWithClass(this.locatorDeleteButton);
}
public getDownloadButton() {
return this.getRoot().findTestElementWithClass(this.locatorDownloadButton);
}
}
class LoadingErrorAttachmentE2EItem {
private locatorRoot: string;
private readonly attachmentSuffixLocattor: string = '-file-upload-list-item-attachment-upload';
constructor(private fileName: string) {
this.locatorRoot = convertToDataTestId(this.fileName) + this.attachmentSuffixLocattor;
}
public getRoot() {
return cy.getTestElement(this.locatorRoot);
}
}