Skip to content
Snippets Groups Projects
Verified Commit deb94b59 authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

OZG-7591 add text editor e2e component

CR
parent 261df9e5
No related branches found
No related tags found
1 merge request!92Administration: Validierung der Pflichtfelder bei "Benutzer & Rollen"
......@@ -23,6 +23,7 @@
*/
import 'cypress-real-events';
import { convertToDataTestId } from '../../support/tech-util';
import { TextEditorE2eComponent } from '../ods/text-editor.e2e.component';
//TODO BenutzerListPage erstellen welche den Button und die Liste enthaelt.
export class BenutzerListE2EComponent {
......@@ -95,11 +96,6 @@ export class BenutzerListItemE2EComponent {
export class BenutzerE2EComponent {
private readonly headline: string = 'benutzer-form-headline';
private readonly userVorname: string = 'firstName-text-input';
private readonly userNachname: string = 'lastName-text-input';
private readonly userBenutzername: string = 'username-text-input';
private readonly userMail: string = 'email-text-input';
private readonly adminCheckboxLabel: string = 'Admin';
private readonly loeschenCheckboxLabel: string = 'Löschen';
private readonly userCheckboxLabel: string = 'User';
......@@ -111,12 +107,13 @@ export class BenutzerE2EComponent {
private readonly saveButton: string = 'save-button';
private readonly deleteButton: string = 'delete-button';
private readonly firstNameValidationError: string = 'firstName-text-editor-error';
private readonly lastNameValidationError: string = 'lastName-text-editor-error';
private readonly usernameValidationError: string = 'username-text-editor-error';
private readonly emailValidationError: string = 'email-text-editor-error';
private readonly rollenValidationError: string = 'rollen-error';
private readonly vornameTextFeld: TextEditorE2eComponent = new TextEditorE2eComponent('firstName');
private readonly nachnameTextFeld: TextEditorE2eComponent = new TextEditorE2eComponent('lastName');
private readonly benutzernameTextFeld: TextEditorE2eComponent = new TextEditorE2eComponent('username');
private readonly emailTextFeld: TextEditorE2eComponent = new TextEditorE2eComponent('email');
public getHeadline(): Cypress.Chainable<Element> {
return cy.getTestElement(this.headline);
}
......@@ -126,19 +123,19 @@ export class BenutzerE2EComponent {
}
public getVornameInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.userVorname);
return this.vornameTextFeld.getInput();
}
public getNachnameInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.userNachname);
return this.nachnameTextFeld.getInput();
}
public getBenutzernameInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.userBenutzername);
return this.benutzernameTextFeld.getInput();
}
public getMailInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.userMail);
return this.emailTextFeld.getInput();
}
public getAdminCheckbox(): BenutzerCheckboxE2EComponent {
......@@ -173,20 +170,20 @@ export class BenutzerE2EComponent {
return cy.getTestElement(this.deleteButton);
}
public getFirstNameValidationError(): Cypress.Chainable<Element> {
return cy.getTestElement(this.firstNameValidationError);
public getVornameValidationError(): Cypress.Chainable<Element> {
return this.vornameTextFeld.getErrorMessage();
}
public getLastNameValidationError(): Cypress.Chainable<Element> {
return cy.getTestElement(this.lastNameValidationError);
public getNachnameValidationError(): Cypress.Chainable<Element> {
return this.nachnameTextFeld.getErrorMessage();
}
public getUsernameValidationError(): Cypress.Chainable<Element> {
return cy.getTestElement(this.usernameValidationError);
public getBenutzernameValidationError(): Cypress.Chainable<Element> {
return this.benutzernameTextFeld.getErrorMessage();
}
public getEmailValidationError(): Cypress.Chainable<Element> {
return cy.getTestElement(this.emailValidationError);
return this.emailTextFeld.getErrorMessage();
}
public getRollenValidationError(): Cypress.Chainable<Element> {
......
export class TextEditorE2eComponent {
private readonly root: string;
private readonly validationError: string;
constructor(root: string) {
this.root = `${root}-text-editor`;
this.validationError = `${root}-text-editor-error`;
}
public getInput(): Cypress.Chainable<Element> {
return cy.getTestElement(this.root);
}
public getErrorMessage(): Cypress.Chainable<Element> {
return cy.getTestElement(this.validationError);
}
}
import { OrganisationsEinheitE2E } from '../../model/organisations-einheit';
import { AdminUserE2E } from '../../model/util';
import { waitForSpinnerToDisappear } from '../../page-objects/main.po';
import { E2EBenutzerExecutor } from './benutzer.executor';
import { E2EBenutzerNavigator } from './benutzer.navigator';
......@@ -72,11 +73,13 @@ export class E2EBenutzerHelper {
public saveBenutzer(): void {
this.executer.saveBenutzer();
waitForSpinnerToDisappear();
}
public deleteBenutzer(userName: string): void {
this.openBenutzerPage(userName);
this.executer.deleteBenutzer();
waitForSpinnerToDisappear();
}
public openBenutzerPage(userName: string): void {
......
import { EMPTY_STRING } from '@alfa-client/tech-shared';
import {
BenutzerE2EComponent,
BenutzerListE2EComponent,
......@@ -5,7 +6,7 @@ import {
} from '../../components/benutzer/benutzer.e2e.component';
import { BenutzerValidationMessages } from '../../model/benutzer.messages';
import { AdminUserE2E } from '../../model/util';
import { contains, exist, notBeEnabled, notContains, notExist } from '../../support/cypress.util';
import { contains, exist, haveText, notBeEnabled, notContains, notExist } from '../../support/cypress.util';
import { AlfaRollen } from '../../support/user-util';
export class E2EBenutzerVerifier {
......@@ -70,33 +71,33 @@ export class E2EBenutzerVerifier {
}
public verifyMissingVornameError(): void {
exist(this.benutzerPage.getFirstNameValidationError());
contains(this.benutzerPage.getFirstNameValidationError(), BenutzerValidationMessages.VORNAME_EMPTY_ERROR);
exist(this.benutzerPage.getVornameValidationError());
haveText(this.benutzerPage.getVornameValidationError(), BenutzerValidationMessages.VORNAME_EMPTY_ERROR);
}
public verifyLastNameError(): void {
exist(this.benutzerPage.getLastNameValidationError());
contains(this.benutzerPage.getLastNameValidationError(), BenutzerValidationMessages.NACHNAME_EMPTY_ERROR);
exist(this.benutzerPage.getNachnameValidationError());
haveText(this.benutzerPage.getNachnameValidationError(), BenutzerValidationMessages.NACHNAME_EMPTY_ERROR);
}
public verifyUsernameSizeError(): void {
exist(this.benutzerPage.getUsernameValidationError());
contains(this.benutzerPage.getUsernameValidationError(), BenutzerValidationMessages.BENUTZERNAME_SIZE_ERROR);
exist(this.benutzerPage.getBenutzernameValidationError());
haveText(this.benutzerPage.getBenutzernameValidationError(), BenutzerValidationMessages.BENUTZERNAME_SIZE_ERROR);
}
public verifyUserExistsError(): void {
exist(this.benutzerPage.getUsernameValidationError());
contains(this.benutzerPage.getUsernameValidationError(), BenutzerValidationMessages.BENUTZER_NAME_EXISTS);
exist(this.benutzerPage.getBenutzernameValidationError());
haveText(this.benutzerPage.getBenutzernameValidationError(), BenutzerValidationMessages.BENUTZER_NAME_EXISTS);
}
public verifyEmailInvalidError(): void {
exist(this.benutzerPage.getEmailValidationError());
contains(this.benutzerPage.getEmailValidationError(), BenutzerValidationMessages.EMAIL_INVALID_ERROR);
haveText(this.benutzerPage.getEmailValidationError(), BenutzerValidationMessages.EMAIL_INVALID_ERROR);
}
public verifyEmailExistsError(): void {
exist(this.benutzerPage.getEmailValidationError());
contains(this.benutzerPage.getEmailValidationError(), BenutzerValidationMessages.EMAIL_EXISTS);
haveText(this.benutzerPage.getEmailValidationError(), BenutzerValidationMessages.EMAIL_EXISTS);
}
public verifyRollenError(): void {
......@@ -105,19 +106,19 @@ export class E2EBenutzerVerifier {
}
public verifyNoFirstNameValidationError(): void {
notContains(this.benutzerPage.getFirstNameValidationError(), BenutzerValidationMessages.VORNAME_EMPTY_ERROR);
haveText(this.benutzerPage.getVornameValidationError(), EMPTY_STRING);
}
public verifyNoLastNameValidationError(): void {
notContains(this.benutzerPage.getLastNameValidationError(), BenutzerValidationMessages.NACHNAME_EMPTY_ERROR);
haveText(this.benutzerPage.getNachnameValidationError(), EMPTY_STRING);
}
public verifyNoUsernameSizeValidationError(): void {
notContains(this.benutzerPage.getUsernameValidationError(), BenutzerValidationMessages.BENUTZERNAME_SIZE_ERROR);
haveText(this.benutzerPage.getBenutzernameValidationError(), EMPTY_STRING);
}
public verifyNoEmailInvalidValidationError(): void {
notContains(this.benutzerPage.getEmailValidationError(), BenutzerValidationMessages.EMAIL_INVALID_ERROR);
haveText(this.benutzerPage.getEmailValidationError(), EMPTY_STRING);
}
public verifyNoRollenValidationError(): void {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment