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